Open srujzs opened 3 months ago
Summary: Subtype checks using package:js
are inconsistent between compile-time and runtime, and don't always respect transitivity. This is due to SSA optimizations and missing interceptor types in dart2js, leading to incorrect type checks and failing tests.
Similar issue in DDC: https://github.com/dart-lang/sdk/issues/56384. The effect can be seen in tests/web/internal/javascriptobject_extensions_test.dart.
There seems to be two central issues:
is
checks because it knows enough static type information to do so. It, however, misses some cases that we handle properly if we didn't have enough static type information. See the differences between the non-confuse
cases and theconfuse
cases: https://github.com/dart-lang/sdk/blob/0d31c2b8b0aaa183be221b4ab2e9e0c1590435d6/tests/web/internal/javascriptobject_extensions_test.dart#L215package:js
class. See https://github.com/dart-lang/sdk/blob/0d31c2b8b0aaa183be221b4ab2e9e0c1590435d6/tests/web/internal/javascriptobject_extensions_test.dart#L193 for type tests where this results in an issue. This results in subtype transitivity not being respected.We should try and get the expectations aligned across both compiler and all of these tests working with the expected expectation (currently, the expectations are just the current status to make the test pass and avoid regressions).
cc @fishythefish @nshahan