dart2js: consider emitting known type errors even with omit-implicit-checks #35961
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
P2
A bug or feature request we're likely to work on
web-dart2js
Sometimes we optimize based on the fact that errors would be thrown. For example: we might get rid of the rest of the code in a loop if we know that a statement throws.
If that statement is a type-error and the compiler was given
--omit-implicit-checks
, we end up with a bad combo: errors are not thrown, but the loop now is different. Some users have seen the loop turn into an infinite loop as a result.We are considering to keep around type errors that we know statically that will throw (note: we can't make it a static error, because it might be in a codepath that is not reached dynamically.). To keep those type errors, we should also be careful not to pull in unnecessary RTI data. Since we know already statically that it will fail, we might be able to strip the type details (e.g. if the reason of the failure is on the raw type, then remove the type parameters from the check by using the 'any' type parameter).
The text was updated successfully, but these errors were encountered: