-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Converting JSBoolean
to bool
fails in dart2js
#55024
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
cc @srujzs I can repro locally, but oddly it doesn't cause an issue in dartpad, not sure why. What's strange is that the public API is declared to return |
(thanks @simolus3 for the nice short repro, BTW) |
Thanks for filing! Yeah, it looks like the patch files use I'll upload a change. Not sure if this would be considered a breaking change, but we can discuss in the CL.
I'm seeing a separate error in dartpad in the console:
|
Related issues: #55024 #55267 These operators were initially broken in 3.3 and were exposed as returning JSBoolean but implemented as returning bool. They were fixed to return bool in the public API, but we should prefer to have them return JS types as they're likely to be used in cases where implicit conversions are not useful. CoreLibraryReviewExempt: Fixing type mismatch in backend-specific library. Change-Id: I3b0e60550dcac78918f8399d11238dcfa34982cd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359180 Commit-Queue: Srujan Gaddam <srujzs@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
Dart 3.3 had the problem of some JS-interop methods declared to return a `JSBoolean` actually returning a Dart `bool`, causing compilation errors. Now that dart-lang/sdk#55024 has been fixed in Dart 3.4, the workarounds introduced to fix the issue can be reverted.
Consider this simple snippet:
As
.equals
is declared to return aJSBoolean
, it needs to be converted to Dart withtoDart
. dart2js seems to disagree on that though, and pretendsequals
returns abool
directly:Happens on 3.3.0 stable and I've also tested this on
3.4.0-160.0.dev
. Casting tobool
works, but all the documentation very strongly discourages that.The text was updated successfully, but these errors were encountered: