Skip to content

Annotation occurs constraint for location producing javac errors #919

@unironically

Description

@unironically

Compiling the following grammar produces the build errors seen below.
Have not yet tried similar constraints for other annotations.

grammar test;

fun main IO<Integer> ::= largs::[String] = pure(0);

--

synthesized attribute things::[Thing];

nonterminal Foo with location, things;

production foo
top::Foo ::=
{ top.things = [thingWithLocation(top)]; }

--

nonterminal Thing;

production thingWithLocation
annotation location occurs on a =>
top::Thing ::= node::a
{}

Build errors:

grammars:
    [javac] Compiling 7 source files to /home/silver/generated/bin
    [javac] /home/silver/generated/src/test/PthingWithLocation.java:263: error: deconstruction patterns are not supported in -source 11
    [javac] 			if (!c_node instanceof makeAnnoName(silver:core:location)) {
    [javac] 			                                   ^
    [javac]   (use -source 21 or higher to enable deconstruction patterns)
    [javac] /home/silver/generated/src/test/PthingWithLocation.java:263: error: <identifier> expected
    [javac] 			if (!c_node instanceof makeAnnoName(silver:core:location)) {
    [javac] 			                                          ^
    [javac] /home/silver/generated/src/test/PthingWithLocation.java:263: error: not a statement
    [javac] 			if (!c_node instanceof makeAnnoName(silver:core:location)) {
    [javac] 			                                                ^
    [javac] /home/silver/generated/src/test/PthingWithLocation.java:263: error: ';' expected
    [javac] 			if (!c_node instanceof makeAnnoName(silver:core:location)) {
    [javac] 			                                                        ^
    [javac] /home/silver/generated/src/test/PthingWithLocation.java:285: error: <identifier> expected
    [javac] 			if (!c_node instanceof makeAnnoName(silver:core:location)) {
    [javac] 			                                          ^
    [javac] /home/silver/generated/src/test/PthingWithLocation.java:285: error: not a statement
    [javac] 			if (!c_node instanceof makeAnnoName(silver:core:location)) {
    [javac] 			                                                ^
    [javac] /home/silver/generated/src/test/PthingWithLocation.java:285: error: ';' expected
    [javac] 			if (!c_node instanceof makeAnnoName(silver:core:location)) {
    [javac] 			                                                        ^
    [javac] 7 errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions