Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve flow typing support for methods with closure parameters #523

Closed
eric-milles opened this issue Mar 11, 2018 · 0 comments
Closed

Improve flow typing support for methods with closure parameters #523

eric-milles opened this issue Mar 11, 2018 · 0 comments
Assignees
Milestone

Comments

@eric-milles
Copy link
Member

Methods like with have a return type that depends on the passed Closure's return type. Because the method must be visited before the arguments to collect @ClosureParams and @DelegatesTo information, the passed closure expression is not visited in time to determine the return type.

Consider the following:

Matcher[] meth() {
}
def arr = with {
  return meth()
}
arr.length
arr[0].group(0)
arr[0].matches()

In this example, the type of arr is dependent on the return type of the closure expression. length, group, and matches are currently highlighted as unknown.

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

No branches or pull requests

1 participant