Closed sigmundch closed 4 years ago
Note this is only reproducible after the unfork. The code that triggers this is this assertion:
assert(length % 3 == 0);
pre-nnbd, we generate code like: H.assertHelper(($length & 1) === 0);
, while post-nnbd, we instead generate: H.assertHelper(C.JSInt_methods.$mod($length, 3) === 0);
The code to construct types is used before constants are created (since constants refer to types). We will have to take care to ensure that code does not directly or indirectly use constants.
The old code worked only because int.isEven
was inlined.
If inlining is disabled, it would have failed.
There is a similar issue, but requires -O0
: https://github.com/dart-lang/sdk/issues/41484
Will be fixed by: https://dart-review.googlesource.com/c/sdk/+/148006
Fixed by e0257265d34efffc845ea88643e183dc3cc5bb0e
Consider this example:
If you compile it via dart2js with
--enable-asserts
, it produces this error:@rakudrama @fishythefish