Acknowledged
CIQQA-3185

Type checker allows static method to be called without qualifier from other static method in same class, but this fails at runtime with a "symbol not found error"

SDK: 8.1.1

I'm guessing that the runtime behaviour is by design, and the type checker is wrong. (Same behaviour at levels 1, 2, and 3).


import Toybox.Lang;
import Toybox.System;

class A {
    public static function doSomething() as Void {
        System.println("A");
    }
    public static function doMore() as Void {
        doSomething(); // *
        // * This compiles fine but crashes at runtime
        //   "Error: Symbol Not Found Error
        //    Details: Could not find symbol 'doSomething'""
        //
        // Same thing happens with `self.doSomething()`, although
        // type checker doesn't complain about either construct
        //
        // only A.doSomething() or B.doSomething() work at runtime
    }
}

class B extends A {
    function initialize() {
        A.initialize();
    }
    public static function doSomething() as Void {
        System.println("B");
    }
}

class C {
    public function doItAll() as Void {
        B.doMore();
    }
}

function test() as Void {
    new C().doItAll();
}

Related: https://forums.garmin.com/developer/connect-iq/i/bug-reports/if-instance-function-of-one-class-calls-a-static-function-of-another-class-the-2nd-class-can-inadvertently-call-instance-methods-of-the-1st-class