Acknowledged
over 1 year ago

bug / feature-request: compiler should fail if trying to use constant as reference when optimizer constant folded it

const STR = "1234";
var str = STR;
if (str != STR) {
    System.println("WTF?");
}

in monkey.jungle:
project.optimization = 3z

I guess the reason it doesn't work with SDK 6.4.2 is the optimizations and constant folding (it does work with project.optimization=0), which is understandable, but please if the compiler does know it is doing this optimization, then make the build fail with some error message i.e:

usage of reference to constant is not possible with project.optimization = 1,2,3, either change it to 0 or don't use the constant reference