-
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
Map value for uninitialized key is different in DDC output vs Dart2js output #36052
Comments
cc @jmesserly |
This is a known issue. This should be addressed in DDC's map implementations, which may or may not have a measurable performance impact on access times (I suspect it will not make much difference). |
I believe the issue is not that map returns |
Would you mind opening another issue about that, if you'd like to discuss further? I'd rather keep this issue focused on the report, and discuss bigger design questions about calling conventions elsewhere. (In general, DDC tries to avoid common pitfalls related to undefined, by using |
@jmesserly Done: #36116 |
Hi There!
We're seeing in issue where the default value for a map lookup with a key that has not been initialized behaves differently in DDC output vs dart2js output. Here's a test which will pass when compiled via dart2js, but will fail when when compiled via DDC:
If you print out the value of
emptyMap['should_be_null']
, it isnull
on both DDC compiled output and dart2js compiled output. However, the return value in DDC fromsomeFunc
is actuallysome_default_value
, and notnull
. One workaround is to pass the expressionemptyMap['should_be_null'] ?? null
tosomeFunc
.Could it be that
emptyMap['should_be_null']
isundefined
in the DDC output, but is explicitly null in the dart2js output?The text was updated successfully, but these errors were encountered: