Skip to content

Fix type inferencing for extension methods used in type that implements Iterable, etc. #810

@eric-milles

Description

@eric-milles

Consider the following:

class Bar { Number number }
class Foo implements Iterable<Bar> {
  List<Bar> bars
  Iterator<Bar> iterator() {
    return bars.iterator()
  }
  void test() {
    this.any { bar -> bar.number > 0 } // any(Object,Closure) vs. any(Iterable,Closure)
  }
}

The reference to "any" from within a type the implements Iterable is showing as unknown (underlined). CategoryTypeLookup uses ClassNode.getTypeClass() as part of algortihm to choose from multiple category method options -- any(Object,Closure) vs. any(Iterable,Closure) in this case. Because Foo is a source type, it may not have been built to a class file yet.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions