-
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
[CP] Handle object literal constructors with no library @JS annotation in dart2js #55057
Comments
Should I create a second commit targeting 3.4 beta 1, or is that handled when I submit the fix to the 3.3 stable release? edit: Ignore, this goes into beta 2 anyways, so the cherry-pick to beta 1 isn't needed. |
@sigmundch could you take a look at this cherry-pick request? |
👍 I support this cherry-pick. Exactly for the same reasons presented above: we have encouraged people to start migrating to use |
@srujzs please merge to stable, we are approved! |
annotation Fixes #54801 Object literal constructors need to be explicitly handled when determining a member is JS interop or not in dart2js as it does not require any @js annotations. Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/349840 Cherry-pick-request: #55057 Change-Id: Ie178e29f8c4f5b032440b58c08eb81cf896bad70 Bug: #54801 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355060 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Srujan Gaddam <srujzs@google.com>
Done! Marking as closed now that it's merged. |
@srujzs I am going to keep this open until it lands in a release, it helps me keep things together without holding the context in my head. |
Commit(s) to merge
https://dart-review.googlesource.com/c/sdk/+/349840
Target
stable
Prepared changelist for beta/stable
https://dart-review.googlesource.com/c/sdk/+/355060
Issue Description
JS interop allows users to declare interop extension types with object literal constructors that create objects with a given set of properties. These constructors are lowered in the backends. However, in dart2js, the code to determine whether an
external
constructor is an object literal constructor relied on the library having an@JS
annotation. Therefore, code that did not have this annotation would fail to compile as dart2js can not determine what that member is supposed to be. The workaround is to declare the library with an@JS
annotation.This occurs only on web and in dart2js. DDC and dart2wasm do not have this issue.
What is the fix
The fix is to align with DDC and assume
external
extension type constructors with named arguments are object literal constructors in dart2js, regardless of whether the library contains an@JS
annotation.Why cherry-pick
This results in confusing crashes, and affects any users using interop extension types. As we encourage more Flutter packages to migrate to Wasm-compatible interop, I expect more users to be affected. This has already resulted in two bugs since 3.3 released:
#54958
#55039
The second one resulted in a broken package version accidentally being released due to the discrepancy between DDC and dart2js here.
Risk
low
Issue link(s)
#54801
Extra Info
No response
The text was updated successfully, but these errors were encountered: