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

  • Is this already fixed in the meantime? It's such a pity to not be able to work with the monkey types for already so long because of this bug.

    If it is fixed, how should I be able to send a dictionary in the Background.exit()?

    I even have this same issue in the SDK 4.1.0 preview. 

  • Unfortunately, 4.0.4 has no mention of fixing this bug and Garmin's bug tracking system is not public facing so there's no way to check on the status. The work-around is to turn off type-checking by removing the compile option or setting it to 0 (see above). Garmin's new typing system is quite ready for prime time but it has some usefulness.

  • Was this been fixed in 4.0.4? I'm also not able to pass a Dictionary in the background.exit(). Just wondering if it's me doing something odd, or if this is related to this. 

  • Thank you for providing additional detail, I'll be sure to update the ticket to reflect this information.

  • 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"