Error:(33, 29) Groovyc: [GContracts] Postconditions only allow 'old' and 'result' closure parameters.
I've never done anything with the Groovy AST stuff, but from a quick look at the code, I suspect that the ClosureExpressionValidator instance is recursing to the inner closure when it visits the AST of the closure passed to @Ensures, instead of just doing the top-level one. The inner closure is not a valid top-level closure, but I don't think it should have to be.
Given this code (which I believe should be valid):
The compiler gives this error:
I've never done anything with the Groovy AST stuff, but from a quick look at the code, I suspect that the
ClosureExpressionValidator
instance is recursing to the inner closure when it visits the AST of the closure passed to @Ensures, instead of just doing the top-level one. The inner closure is not a valid top-level closure, but I don't think it should have to be.