Acknowledged

Regression - arrays are totally broken (SDK 4.1.2)

var arr = ["A", "B"];
arr.toString();

Gives

Error: Unhandled Exception
Exception: UnexpectedTypeException: Expected Number/Float/Long/Double/Char, given Number/Array

var arr = ["A", "B"];
for (var i = 0; i < arr.size(); i++) {
    arr[i];
}

Gives

Error: Unhandled Exception
Exception: UnexpectedTypeException: Expected Number/Float/Boolean/Long/Double, given Object

var arr = new Lang.Array();
arr.add("A");

Gives

Error: Unhandled Exception
Exception: UnexpectedTypeException: Expected Array, given String

SDK version 4.1.2.

  • Any progress on this? I would like to compile my app against 4.1.2 since it originally worked that way and updating the SDK only introduces more bugs than it fixes.

  • This should be titled "simulator regression". Seems like a lot of things have been broken in the simulator lately.

  • > It looks to me like maybe Monkey Types weren't implemented properly before and now they are?

    If you're implying that the problems in the OP are related to Monkey Types, I don't think so. Monkey Types provides compile-time type checking, and these errors are all run-time type errors.

    I will say that Monkey Types has a lot of room for improvement imo.

  • > And I can't build against 4.1.7 because of all the regressions with the type system.

    You can turn off type checking in the Monkey C extension preferences (either globally or per-workspace). You can also disable type checking on a per-project basis by adding the following line to monkey.jungle:

    project.typecheck=0

  • So I tried the following code...

            var a = ["a", "b"];
            System.println("a.toString() = " + a.toString());
    ...with the following SDKs:
    - 4.0.10: works
    - 4.1.1: crashes
    - 4.1.2: crashes
    - 4.1.5: crashes
    - 4.1.6: works
    - 4.1.7: works
    The simulated device was Fenix 6 Pro.
    I also tried fr235, which actually worked for all of above SDKs.
    Pretty weird stuff since Array.toString() has been around since 1.0.0.
    I have a feeling Garmin won't do anything about this since it's already been fixed in newer SDKs. (I doubt they'll release a 4.1.5.1, for example.)