ceylon icon indicating copy to clipboard operation
ceylon copied to clipboard

Implement or disallow ++ on indexed expressions

Open jvasileff opened this issue 7 years ago • 1 comments
trafficstars

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
}

jvasileff avatar Sep 26 '18 18:09 jvasileff

I would vote to implement both.

xkr47 avatar Nov 02 '18 10:11 xkr47