Skip to content

Fix type inferencing, syntax highlighting and code navigation for methods that use @DelegatesTo.Target #1147

@eric-milles

Description

@eric-milles

Consider the following:

final class C extends spock.lang.Specification {

  static int NUM = 123

  def 'with map'() {
   given:
    def map = [key: 123]
   expect:
    with(map) {
      containsKey('key')
    }
  }
}

"with" resolves to public <U> void with(@DelegatesTo.Target U target, @DelegatesTo(strategy = Closure.DELEGATE_FIRST) @ClosureParams(FirstParam.class) Closure<?> closure) in Specification. However the perceived type of the delegate is Object because the argument passed was declared using def.

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions