NTA-attribute confusion causes syntax error in generated code

Issue #272 new
Jesper Öqvist created an issue

The following slightly contrived test case causes JastAdd 2.2.2-27-g62a22f6 to generate faulty Java code:

// Attribute NTA and child NTA with same name cause syntax error in generated code.
// .grammar: { A ::= /A/; }
// .result: COMPILE_PASS
aspect Test {
  // The following NTA equation does not match the declaration of the /A/ child:
  syn nta A A.getA(int index) = new A();

  // This attribute matches the NTA child /A/:
  syn lazy A A.getA() = new A();
}

Output:

    [junit] Compilation failed when expected to pass:
    [junit] tmp/nta/missing_eq01f/A.java:179: error: ';' expected
    [junit]                     return (A) getChild(getA_intChildPosition()));
    [junit]                                                                 ^

Comments (0)

  1. Log in to comment