-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dart2wasm] compiler crashes on an inequality operator #53070
Comments
Smaller repro: import 'dart:js_interop';
@JS()
@staticInterop
class DomEventTarget {}
typedef Testing = ({
DomEventTarget a,
int b,
});
Testing f() {
throw '';
}
void main() {
var x = f();
var y = f();
print(x.a == y.a);
} |
I think this is a TFA bug. The class |
I guess analysis is smart enough to see that no instance of Someone then needs to also recognize that code which appears to have an instance of that type, must be unreachable. And not try to create code calling an instance method of the type. |
On a small example, kernel before TFA:
Kernel after TFA:
Indeed, TFA inferred that DomEventTarget is never allocated. Furthermore, dart2wasm replaced DomEventTarget with JSValue in certain types before TFA, so TFA inferred that DomEventTarget is not used in types and removed it entirely. It looks like kernel before TFA is incorrectly typed as DomEventTarget is replaced with JSValue in variable type but not static receiver type of https://dart-review.googlesource.com/c/sdk/+/317142 should fix this bug. |
Repro
cd $FLUTTER_ENGINE_SRC/flutter/lib/web_ui
dev/felt test --verbose --browser=chrome --compiler=dart2wasm --renderer=html test/engine/pointer_binding_test.dart
Expected
The program should compile and the test should pass.
Actual
dart2wasm crashes with the following:
The line of code in question is https://github.com/yjbanov/engine/blob/3ca695f5a1c861b6e1f62a6afddc45cfef2c60ae/lib/web_ui/lib/src/engine/pointer_binding.dart#L352
Workaround
Rewrite this line:
To this (i.e. extract the inner expressions into variables):
This makes the compiler happy and it outputs seemingly correct wasm (the test passes). However, the rewrite shouldn't be necessary.
The text was updated successfully, but these errors were encountered: