I came across a weird issue while trying to export an application that worked fine in the simulator and as debug build.
After some digging into the log.zip I came across the function.mir which showed me what was the problem: A boolean operation within an Test.assert statement.
A bit of testing eventually brought me this minimal (not-)working example:
var a = null; var b = null; var c = (a==b); Test.assert(false || c);
an more triivial example of Test.assert(true || false) does work (i'ld expect due to constant propagation). However, as soon as one of the operands to the assert is kind of dynamic, the exportation will fail with:
ERROR: edge1040: A critical error has occurred. Please re-run the Monkey C Compiler with logging enabled and file a report with the Connect IQ support team ([email protected]).
What in fact does not give a problem is the following - albeit the added runtime overhead if the assert is disabled in release builds:
var a = null; var b = null; var c = (a==b); if (!false) Test.assert(c);