-
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
Analyzer fails to report an error when key in a constant map overrides operator == #42356
Comments
It appears that the analyzer has failed to provide a required error at
The analyzer should have produced this error, but didn't. But the code that produces the prefer_const_constructors lint correctly suppresses that lint if the constructor invocation is implicitly |
A very similar issue: class Foo {
const Foo(List<int> numbers)
: assert(numbers.length > 0),
assert(numbers.isNotEmpty);
} The first assert results in a warning say:
But following that suggestion (the second assert) is an error:
|
@spkersten That issue is different enough to warrant a new issue, if you'd like to open it. For the record, neither of those assertions are legal. |
@srawlins Created dart-lang/sdk#42354 |
@mraleph This is actually a bug in |
Thanks! @scheglov Looks like analyzer is failing to report an error. |
@bwilkerson I took a liberty to rename the issue to reflect the actual bug - previous title confused me (that's why I moved it to linter). |
…e creations. Bug: #42356 Change-Id: I674878c12b82af229d70e7a6eca5cd662ec29394 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151623 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
In the following code:
I get a warning for the
foo1
:But, with
const
atfoo2
, there is an error:Dart 2.7.0
The text was updated successfully, but these errors were encountered: