Skip to content

ASTTest transform produces improper compiler error #1155

@eric-milles

Description

@eric-milles

Consider the following:

import groovy.transform.*
import static org.codehaus.groovy.control.CompilePhase.*
import static org.codehaus.groovy.transform.stc.StaticTypesMarker.*

@CompileStatic
class C {
  void m() {
    def that = this;
    { ->
      @ASTTest(phase=INSTRUCTION_SELECTION, value={
        def type = node.getNodeMetaData(INFERRED_TYPE)
        assert type.name == 'C'
      })
      def ref = getThisObject()
      assert ref == that
    }()
  }
}
new C().m()

The @ASTTest is marked with an error indicating that a closure literal should be supplied for the "value" member. However one is given, so the error is unexpected. Also, syntax highlighting seems to be missing for the "value" name and value.

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions