eclipse-archived/ceylon

Implement or disallow ++ on indexed expressions

Opened this issue · 1 comments

The typechecker allows a[i]++, but this fails on the backends:

  • Java: error: compiler bug: compiler bug: IndexExpression is not supported yet at unknown
  • JS: silent failure

Note that the typechecker does not allow a[i] += 1.

Full example:

shared void run() {
    value a = Array { 0, 0, 0 };
    variable Integer i = 0;
    a[i++]++;
    print(a); // should be { 1, 0, 0 }
    print(i); // should be 1
}
xkr47 commented

I would vote to implement both.