Rewrites don't trigger on accessing NTAs

Issue #258 invalid
Jesper Öqvist created an issue

It seems like rewrites should trigger when accessing an NTA child, but this does not happen. For example:

X ::= /A/;
A ::= <Transformed:Boolean>;

aspect Test {
  rewrite A {
    when (!getTransformed())
    to A {
       return new A(true);
    }
  }

  syn lazy A X.getA() = new A(false);
}

public class Test {
  void test() {
    A a = new X().getA();
    assert a.getTransformed(); // Assertion error!
  }
}

This behavior seems a little counter-intuitive, because rewrites are implicitly triggered when accessing other child nodes. Perhaps we should implement rewriting of NTA children, or maybe we should leave it as it is. I have marked this issue as a bug because I didn't think the other labels fit too good, but this is not an obvious bug.

Comments (1)

  1. Jesper Öqvist reporter

    I added a test case to test this, and it turned out I was wrong. Rewrites DO trigger when accessing an NTA. I should have checked before I reported this issue.

  2. Log in to comment