Yes the resulting query has some issues with brackets according to the error.
But my original dql query should be fine, so I think there must be something wrong when rewriting the query.
I don’t think the error is where you are pointing at, since the brackets are closed later. When rewriting it seems additional brackets around the expression are added by the system. But there is another issue with the rewritten checkpwd result:
In the custom dql
check as checkpwd(User.password, "password")
Is rewritten to
check as User.password)
I don’t know what this is supposed to look like, but the bracket is for sure wrong.
Sorry for mistakes, I’m writing this from my phone.