Skip to content

Fix type inferencing and syntax highlighting for super call in trait #961

@eric-milles

Description

@eric-milles

Consider the following:

trait Filtering {
  StringBuilder append(String str) {
    def subst = str.replace('o', '')
    super.append(subst)
  }
  String toString() {
    super.toString()
  }
}

def sb = new StringBuilder().withTraits(Filtering)
sb.append('Groovy')
println sb.toString()

(source http://docs.groovy-lang.org/latest/html/documentation/#_semantics_of_super_inside_a_trait)

"super.append" and "super.toString" have their method names highlighted as "default" instead of "unkonwn" (underlined). Since the type of "super" cannot be determined from the trait, it should be treated as dynamic.

Also, "super" should not be hoverable/selectable in these expressions.

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions