-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Implement constant equality as primitive equality #51565
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
|
Right, |
And |
Oops, that's an unintended breaking change. We'll fix the spec update to avoid the breaking change in dart-lang/language#2874. Thanks for the heads up! |
dart-lang/language#2874 has now landed, and the ability to have a |
Out of curiosity, would "fixing" it be "that breaking"? For example, would any test fail? It seems small enough that could be fixed. |
I'm not entirely sure what that means. If we change the rules such that
So we did not want to give In summary, I'm not 100% sure what 'fixing it' would mean. 😄 |
Uh oh!
There was an error while loading. Please reload this page.
Cf. dart-lang/language#1811.
'Having a primitive operator
==
' has now been generalized to 'having primitive equality', cf. #51045. The implementation of this feature is ongoing as of Feb 2023 (and I think it has been completed in the analyzer).As a further regularization of the treatment of equality in constant expressions, this issue is concerned with the implementation of constant equality as primitive equality.
In particular here is the current specification of constant expressions of the form
e1 == e2
:It will be modified to rely on primitive equality instead, approximately:
[Edit: To avoid a breaking change, the spec update will continue to admit
double
even thoughdouble
does not have primitive equality; cf. dart-lang/language#2874.]Note that this change implies that enum values can be used as operands to
==
in a constant expression, cf. dart-lang/language#312. This is a consequence of the fact that no enum declaration can declare or inherit an implementation of operator==
orhashCode
that overrides the declaration inObject
.Subtasks:
The text was updated successfully, but these errors were encountered: