-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[dart2wasm] Null assertion in code generator on using extension type type parameter in success function in a Promise #54192
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
Comments
Mmm, it appears this happens because of the import 'dart:js_interop';
void m<T>() {
final f = (T x) {};
f.toJS;
}
void main() { } Note that if we use a static tearoff instead of a closure, we'd get a static error because we don't allow calling .toJS on a function that takes generics: import 'dart:js_interop';
void m3<T extends JSAny?>(T t) {}
void main() { m3.toJS; } This produces the error:
|
I think you discovered two others bugs in our error checker that needs to be fixed :)
That being said, it does look like |
Oh, I'm silly. I already filed a similar bug on this: #53968. |
Since this isn't a dart2wasm bug, what would be the right label for it? |
Let's label this as a JS interop bug for now (but only affects dart2wasm, so I'll keep that label too). |
Addresses some comments in #54192 - With the addition of `nonTypeVariableBound`, we no longer need a recursive checker. - We also should account for `StructuralParameterTypes`. - The current checks did not check type parameters for functions converted via `toJS`, so that is handled as well. - Functions that declare type parameters cannot be called in JS correctly, so an error is added when users try to convert them. - Some errors are reworded/modified. Change-Id: Ic05220883ec4ad8653963acd901d339426cba6c6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339346 Reviewed-by: Sigmund Cherem <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]>
Dart SDK version:
Dart SDK version: 3.3.0-edge.2960e60e24056266f3661bfdb11163a98b3050b1 (main) (Wed Nov 29 13:13:43 2023 -0800) on "macos_x64"
Browser: d8
outputs:
I tried to workaround this by using a
Completer<JSAny?>
in a few different ways but the cast toT
later fails e.g.undefined:0: [object WebAssembly.Exception]
orRuntimeError: illegal cast
, so I'm guessing that might be a consequence of the codegen not handling this type parameter correctly.The text was updated successfully, but these errors were encountered: