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

ASTTest transform produces improper compiler error #1155

Closed
eric-milles opened this issue Aug 22, 2020 · 2 comments
Closed

ASTTest transform produces improper compiler error #1155

eric-milles opened this issue Aug 22, 2020 · 2 comments
Assignees
Milestone

Comments

@eric-milles
Copy link
Member

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

@eric-milles eric-milles self-assigned this Aug 22, 2020
@eric-milles eric-milles added this to the v3.9.0 milestone Aug 23, 2020
@eric-milles
Copy link
Member Author

image

@eric-milles
Copy link
Member Author

image

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