When I tried the new compiler 4.1.4 Compiler 2 Beta (with no -O param added, and with -l 3), some of the new errors I see make no sense:
Object of type 'PolyType< or >' does not match return type 'PolyType<$.Toybox.Lang.Number or $.Toybox.Lang.String>'.
Note the: "PolyType< or >"
The code that generates this:
const MOCK = true; const INT_HR_MOCK = 128; const NO_VALUE = "--"; // note that even when I add "as" like: const INT_HR_MOCK as Number = 128; (to all 3 of them Boolean/Number/String respectively) it doesn't help. typedef AlphaNumeric as String or Number; hidden function computeIntHR(info as Activity.Info) as AlphaNumeric { return (info != null && info has :currentHeartRate && info.currentHeartRate != null) ? info.currentHeartRate : (MOCK ? INT_HR_MOCK : NO_VALUE); }
I have a zipfile with the --debug-log-level=3 output, I can send it to you if you contact me by email.
BTW: I think you should add a new feature to the forum (at least to this bug report part): to be able to attach a file that is not public, only seen by me and Garmin.