Acknowledged

Type checker error for nullable variable inside loop

SDK 7.3.1 or 7.4.3, strict checking is enabled.


import Toybox.Lang;

function test() as Number {
    var value = null;

    for (var i = 0; i < 2; i++) {
        if (value != null) {
            // Object of type 'Null' does not match return type '$.Toybox.Lang.Number'.
            return value;
        } else {
            value = 1;
        }
    }

    return 0;
}

With disabled type check code builds and returns 1 as expected.