-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Analyzer should warn when using constant-update-2018 features with an SDK constraint that does not guarantee support #36296
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
Initial work done in https://dart-review.googlesource.com/c/sdk/+/97567. |
I believe that we have the functionality required for 2.3, and a little more, so I'm removing the milestone. |
We need to update this warning to refer to version 2.3.2. |
Should this include the |
No, Thanks for taking this on, Brian! |
As of 556c913, the warning now refers to version 2.3.2. The remaining bullet item is a small enough corner case that it's not worth putting effort into. |
The first version of Dart with constant-update-2018 enabled is planned to be 2.2.2, so we should implement a hint based on checking the user's SDK constraint against this version number.
Since the constant-update-2018 feature affects both syntax and semantics, it will be more challenging to detect when the user is inadvertently taking advantage of the feature. We will definitely detect the easy cases. We'll detect the harder cases if time allows.
The easy cases are as follows:
is
oras
in a constant context.>>>
operator.&
,|
, or^
to operands of typebool
.The harder cases are as follows (they require some rework of the analyzer's constant evaluator):
==
in a constant, a non-primitive type is compared tonull
.&&
,||
,??
, or?:
in a constant, an operand fails to be a valid constant, but it's permitted by constant-update-2018 because that operand is skipped due to short-circuiting.Note that constant-update-2018 also makes subtle changes to what is considered a valid "potentially constant" expression. We're not going to try to account for this, because we believe such differences will be extremely rare corner cases.
The text was updated successfully, but these errors were encountered: