Ticket Created
over 3 years ago

CIQQA-423

Compiler Bug: Background.exit() cannot be Array

When trying to pass an Array of Numbers to Background.exit()

Background.exit([1,2,3] as Array<Number>);

I get the following error:

Invalid 'Array<Number>' passed as parameter 1 of type
'PolyType<Null or Array<Application.PropertyValueType> or Boolean or Char or Dictionary<Boolean or Char or Double or Float or Long or Number or String,Application.PropertyValueType> or Double or Float or Long or Number or String or WatchUi.BitmapResource>'

But, the PolyType allows Array<Application.PropertyValueType> and PropertyValueType can be a Number.

Sample code here:

forums.garmin.com/.../a-very-simple-wf-with-a-background-that-talks-ble-to-the-thingy52

Parents
  • I have the same problem, in one of my apps I pass a Dictionary in Background.exit.
    Using a primitive like boolean or String works, using an Array or Dictionary gives the error:


    Invalid '$.Toybox.Lang.Dictionary' passed as parameter 1 of type 'PolyType<Null or $.Toybox.Lang.Array<$.Toybox.Application.PropertyValueType> or $.Toybox.Lang.Boolean or $.Toybox.Lang.Char or $.Toybox.Lang.Dictionary<$.Toybox.Lang.Boolean or $.Toybox.Lang.Char or $.Toybox.Lang.Double or $.Toybox.Lang.Float or $.Toybox.Lang.Long or $.Toybox.Lang.Number or $.Toybox.Lang.String,$.Toybox.Application.PropertyValueType> or $.Toybox.Lang.Double or $.Toybox.Lang.Float or $.Toybox.Lang.Long or $.Toybox.Lang.Number or $.Toybox.Lang.String or $.Toybox.WatchUi.BitmapResource>'.

    I'm using SDK 4.0.3 and compile option "-l 1"

Comment
  • I have the same problem, in one of my apps I pass a Dictionary in Background.exit.
    Using a primitive like boolean or String works, using an Array or Dictionary gives the error:


    Invalid '$.Toybox.Lang.Dictionary' passed as parameter 1 of type 'PolyType<Null or $.Toybox.Lang.Array<$.Toybox.Application.PropertyValueType> or $.Toybox.Lang.Boolean or $.Toybox.Lang.Char or $.Toybox.Lang.Dictionary<$.Toybox.Lang.Boolean or $.Toybox.Lang.Char or $.Toybox.Lang.Double or $.Toybox.Lang.Float or $.Toybox.Lang.Long or $.Toybox.Lang.Number or $.Toybox.Lang.String,$.Toybox.Application.PropertyValueType> or $.Toybox.Lang.Double or $.Toybox.Lang.Float or $.Toybox.Lang.Long or $.Toybox.Lang.Number or $.Toybox.Lang.String or $.Toybox.WatchUi.BitmapResource>'.

    I'm using SDK 4.0.3 and compile option "-l 1"

Children