In order to implement "why not promoted" functionality index
expressions, we need to call checkIndexExpressionIndex from the
resolver, so that we can pass it failed promotion information. So
move it into the ErrorDetectionHelpers mixin.
Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: Idc70e3421142da1d3100c288c912b6483a91b28c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193087
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Moves the Array forwarding constructors and _ArraySize class out of
the patch files so that the analyzer can reason about them.
(The analyzer does not include patch files, because it does not know
whether it's analyzing for VM or JS backend.)
Closes: https://github.com/dart-lang/sdk/issues/45507
Change-Id: Ia0eb4bbca40b906a1e636714f53c5c73dcfc3cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193403
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Test covers both analyzer and CFE throwing an error. (But does not
test what error.)
Closes: https://github.com/dart-lang/sdk/issues/45100
Change-Id: I8b820347945d88304d3f03d7d03f156b7111db42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193405
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
We used to have some variables called `whyNotPromoted` and others
called `whyNotPromotedInfo`, with no obvious distinction between the
two names. Now we use `whyNotPromoted` for variables holding the map
returned by `FlowAnalysis.whyNotPromoted`, and `whyNotPromotedList`
for variables holding a list of such maps.
Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I3823d16ef908a833e4d4526ae1c3576c73ecf1fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193083
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
When trying to update to analyzer 1.3.0 dartdoc started crashing
occasionally in CI with the following exception:
https://github.com/dart-lang/dartdoc/pull/2589/checks?check_run_id=2195215917#step:6:3411
Reading the code suggests that returning a null here should be an
OK thing to do, but if this is intended to enforce that an invalid
key should never be passed to this method, some other solution
will need to be found.
Change-Id: Id210a0f8feb6197e7a65569bfaed4d599be4b3c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
Previously, the ErrorVerifier was checking assignability for any `=`
or `??=` assignment whose LHS was not a simple identifier. But this
case is unnecessary; it's already handled by the resolver.
Change-Id: Icc44ab3d13b0a8300fe2ebb7ca134086291a29cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192733
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Context messages are already displayed in a way that makes it easy for
the user to locate the line of code in question; it's unnecessary to
include the line number in the context message itself.
See discussion at
https://buganizer.corp.google.com/issues/179782591#comment9.
Change-Id: I2d1383c4cee0ece0d302449302d1f1902fbf136c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
In order to implement "why not promoted" functionality for constructor
field initializers, we will need to call
checkForFieldInitializerNotAssignable from the resolver, so that we can pass it
failed promotion information. So move it into the
ErrorDetectionHelpers mixin.
Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I95094e198a97608bf27f84cfb3cac40824a30ba4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192723
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
In order to implement "why not promoted" functionality for variable
declaration initializers, we will need to call
checkForInvalidAssignment from the resolver, so that we can pass it
failed promotion information. So move it into the
ErrorDetectionHelpers mixin, along with _checkForAssignableExpression
(which it calls).
_checkForAssignableExpressionAtType can now be private, since all of
its callers are now in ErrorDetectionHelpers.
Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I6655e3a655d330d61459692804854c89c0dcff70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192612
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Change-Id: Ic0983c724e01ca11d1eb72cd9e5424a74874dcc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192862
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
I considered doing the bigger refactor I described in the first CL, then
I realized that I can't because the constructors for `ErrorCode` are
`const`. We should still have some kind of tests, but they won't be as
complete as we might hope.
Change-Id: I02f397642a367af2823f67b90ffdca2113fdb8e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192725
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
* error codes are static and final; no need for a public getter
* lint codes are `late final` because they may be registered up until the
options are validated; the field is lazily calculated at such time.
Change-Id: I8d9c1e9ab4d69be77be49b44f62e605c3f06fd2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
`null` is already a valid value of `dynamic` and `Null`, so adding a question
mark to make `dynamic?` or `Null?` is unnecessary, and could lead to confusion.
Fixes https://github.com/dart-lang/sdk/issues/45165
Change-Id: I710ff12935767dd635edfdb026033aa8e27e7804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190041
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
* Invalid section (not a Map) under `analyzer: errors:`
* Invalid value (not a Scalar) under `analyzer: errors:`
* Invalid section (not a Map) under `analyzer: strong-mode:`
* Invalid section (not a Map) under `analyzer: optional-checks:`
Change-Id: Iad0b33d312f65af8a995677fe4e57389fea520c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Also refactor these tests, in order to get the right experiment. Factor out
common test cases into a mixin, leave two test classes, one of which opts out
of null safety.
Existing tests are left alone except that two which were failing are no longer
failing (simple change in span or diagnostic code).
Change-Id: I2b0dfb4c1df38c6fbd76e5490bbbbd41653edc1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192502
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>