Acknowledged

SDK 7.2.0 strict typechecker regression

The following function can no longer be built using SDK 7.2.0 with strict type check level:

function saveValues(values as $.Toybox.Lang.Array<$.Toybox.Lang.String>) as Void {
    $.Toybox.Application.Storage.setValue("key", values);
}

The error is:

Passing '$.Toybox.Lang.Array<$.Toybox.Lang.String>' as parameter 2 of poly type 'PolyType<Null or $.Toybox.Application.PropertyKeyType or $.Toybox.Lang.Array<$.Toybox.Application.PropertyValueType> or $.Toybox.Lang.Dictionary<$.Toybox.Application.PropertyKeyType,$.Toybox.Application.PropertyValueType> or $.Toybox.WatchUi.BitmapResource>'.

This code builds without errors both using 6.4.2 and 7.1.1.

  • Thanks:

    var testError = [1, 2, 3, 4] as Lang.Array<Number>;
    Storage.setValue("key", testError); <-- compiler error with CIQ 7.2.0
    
    var test2 = [1, 2, 3, 4] as Lang.Array<PropertyValueType>;
    Storage.setValue("key", test2); <-- works! :-)

  • This code causes compilation error even with "-l 1"!

    enum SomeEnum {
        SOME_VALUE,
    }
    
    function saveAnotherValues(values as $.Toybox.Lang.Dictionary<$.Toybox.Lang.Number, $.Toybox.Lang.Dictionary<$.Toybox.Lang.Number, $.SomeEnum>>) as Void {
        $.Toybox.Application.Storage.setValue("anotherKey", values);
    }
    

    Invalid '$.Toybox.Lang.Dictionary<$.Toybox.Lang.Number,$.Toybox.Lang.Dictionary<$.Toybox.Lang.Number,$.SomeEnum>>' passed as parameter 2 of type 'PolyType<Null or $.Toybox.Application.PropertyKeyType or $.Toybox.Lang.Array<$.Toybox.Application.PropertyValueType> or $.Toybox.Lang.Dictionary<$.Toybox.Application.PropertyKeyType,$.Toybox.Application.PropertyValueType> or $.Toybox.WatchUi.BitmapResource>'.

  • Yes, this helps, thanks, as well as "-l 2" instead of "-l 3".

  • While you wait for Garmin to fix this you can try to change the values parameter to PropertyValueType