Acknowledged

bug: vscode extension warns about possible nulls where it's not possible

Why I get this yellow wave line under the comparsion? I thought this was already fixed long ago (though that might have been in the compiler, not the vsc extension)
both with SDK 7.4.3 and 8.0.0-Beta
Parents
  • This is still not fixed in SDK 8.1.1. Not sure if it's the compiler, the type checker, or what else. strict typecheck is enabled.

    function useLocation(info as Activity.Info) as Void {
        if (info.currentLocation != null && info.currentLocationAccuracy != null && info.currentLocationAccuracy >= Position.QUALITY_POOR) {
            // var pos = (info.currentLocation as Position.Location).toDegrees();
            // fetch(pos[0], pos[1], info.altitude);
        }
    }
    

    ERROR: fr955: Foo.mc:2,8: Attempting to perform operation 'gte' with invalid types 'Null' and '$.Toybox.Lang.Number'.

    Needless to say, that even the "(info.currentLocation as Position.Location)" should not be needed. And yeah, I know I'll have to do the same in the condition, but it's so annoying..

Comment
  • This is still not fixed in SDK 8.1.1. Not sure if it's the compiler, the type checker, or what else. strict typecheck is enabled.

    function useLocation(info as Activity.Info) as Void {
        if (info.currentLocation != null && info.currentLocationAccuracy != null && info.currentLocationAccuracy >= Position.QUALITY_POOR) {
            // var pos = (info.currentLocation as Position.Location).toDegrees();
            // fetch(pos[0], pos[1], info.altitude);
        }
    }
    

    ERROR: fr955: Foo.mc:2,8: Attempting to perform operation 'gte' with invalid types 'Null' and '$.Toybox.Lang.Number'.

    Needless to say, that even the "(info.currentLocation as Position.Location)" should not be needed. And yeah, I know I'll have to do the same in the condition, but it's so annoying..

Children
No Data