-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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] Getting illegal cast
, only when compiled with -O0
#55341
Comments
Slightly smaller repro: void main() {
final Map<String, Map<String, String>> nestedMap = <String, Map<String, String>>{};
nestedMap?['hello'] ??= <String, String>{};
print('map: $nestedMap');
} Kernel: (simplified) static method main() → void {
final Map<String, Map<String, String>> nestedMap = <String, Map<String, String>>{};
let final Map<String, Map<String, String>> #t1 = nestedMap in
#t1 == null
?{Map<String, String>?} null
: let final String #t2 = "hello" in
#t1.{Map::[]}(#t2){(Object?) → Map<String, String>?} == null
?{Map<String, String>} #t1.{Map::[]=}(#t2, <String, String>{}){(String, Map<String, String>) → void}
: null;
print("map: ${nestedMap}");
} When compiling conditional with the |
I think we set the static type of the last conditional expression wrongly. From the language perspective it is correct that the whole expression is known to return @chloestefantsova What do you think is the best approach? |
Intuitively it feels that adjusting the type of the conditional expression should be an easier route. Let me look into it a bit more close. |
I'm experimenting with a potential solution at https://dart-review.googlesource.com/c/sdk/+/360865. |
Hello. @pragma("wasm:export") but it fails with the following error on the browser. can you suggest me a fix for this please ? |
This is a minimum reproducible case, distilled from some code in the flutter framework that was causing this problem.
Steps to reproduce:
(1) Compile the following code with
dart compile wasm -O0 --extra-compiler-option=--enable-asserts
:(2) Instantiate and run the output in a browser.
Results:
This crashes, with the following appearing in console:
Note: This seems to not occur when running at
-O1
or higher, so something in thewasm-opt
transformations somehow smooths out whatever issue is occurring here.The text was updated successfully, but these errors were encountered: