Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Nested closures #46

Open
barneyb opened this issue Jul 17, 2014 · 0 comments
Open

Nested closures #46

barneyb opened this issue Jul 17, 2014 · 0 comments

Comments

@barneyb
Copy link

barneyb commented Jul 17, 2014

Given this code (which I believe should be valid):

@Ensures({ result.every { t -> t.target == target } })
Collection<Mapping> getMappings(Entity target) {
    // buncha code...
}

The compiler gives this error:

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant