Under Review

SDK 8.2.3: member lookup is broken both in type checker and compiler

Compiler options are "-w -l 3 -O 3z".

import Toybox.Lang;

module M {
    class C1 {
        static const CONST = 1;
    }
    class C2 {
        function f() as Number {
            return C1.CONST; // Cannot find symbol ':CONST' on class definition '$.C1'.
        }
    }
}

class C1 {
}
class C2 extends M.C2 {
    function initialize() {
        M.C2.initialize();
    }
}

Similar code builds and works as expected with SDK 8.1.1. I've already reported something like that for 8.0.0 beta - https://forums.garmin.com/developer/connect-iq/i/bug-reports/sdk-8-0-0-beta-member-lookup-rules-have-changed, and it was fixed around 8.1.0-8.1.1, but it is back.

8.2.3 assembler with "-w -l 0 -O 3z":

globals/M/C2/f:
    argc 1
    getselfv C1
    getsv CONST
    return
globals/M/C2/f_func_end:

There are no constants inlining as well.

8.1.1 assembler with "-w -l 3 -O 3,disable-constant-folding,disable-lexical-only-constants":

globals/M/C2/f:
    argc 1
    getmv globals/M C1
    getsv CONST
    return
globals/M/C2/f_func_end: