We don't want to check if it is setter, because it never is now.
R=brianwilkerson@google.com
Change-Id: Iab52ff670f12ab56811b850b6518a3b7d4ae7730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167724
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
If this diagnostic needs to be generated, then I can create an issue to
track that work, but I think we handle it by not defining the private
fields in our models, which means the issue is reported as an undefined
getter.
Change-Id: I8d220adf0d11b2c65f8953eec57a87f86f520d74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This adds some technical debt in form of using writeOrReadElement in
clients, which can be paid incrementally by migrating these places to
handling assignment like expressions one by one. Doing it all in one
CL was too much. But now the underlaying AST resolution will be
sound.
In the next breaking change we will remove
setAssignmentBackwardCompatibility(), so stop setting elements/types
for assignment targets.
Change-Id: I11626876cfed25653edb0cc18544aba51cef5965
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This is the _compute function used by the migration tool. It needs to
set the null safety understanding flag in order to ensure that type
comparisons work properly when analyzing code that's already been
migrated.
Fixes#42308.
Bug: https://github.com/dart-lang/sdk/issues/42308
Change-Id: I347b99a3a2cc772bb158b2ba8621ac7bb632653a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The previous approach was reverted.
Change-Id: Ib4b9d09d740511cd2ef76d663412a3358c7f666d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is a reland of 6a1c54ec30
Original change's description:
> Flow analysis: promote to non-nullable on initialization
>
> When flow analysis encounters a variable declaration of the form `T? x
> = expr;`, if the type of `expr` is `T`, then the variable is
> immediately promoted to type `T`.
>
> Fixes#43099.
>
> Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
> Bug: https://github.com/dart-lang/sdk/issues/43099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
> Commit-Queue: Paul Berry <paulberry@google.com>
> Reviewed-by: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Bug: https://github.com/dart-lang/sdk/issues/43099
Change-Id: I7530bb0f7c24674a7b500558b89d50b35e045aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166305
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This reverts commit 706ab39eba.
Reason for revert: Analyzer crash b/170276354
Original change's description:
> Return declared elements for linked AST nodes.
>
> For now only top-level nodes and elements, will do class members later.
>
> These changes would be useful to fix matching elements and nodes, e.g.
> https://github.com/dart-lang/sdk/issues/43153 or https://bit.ly/3jCfhVx
>
> Change-Id: I37861ba60b4e70f637019bf4f8a4d0d007c97965
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166200
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
TBR=scheglov@google.com,brianwilkerson@google.com,srawlins@google.com
Change-Id: I0b13f9e4fbecf9cb0e4d059580837f79bd1cf2b2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166381
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
I'm still not able to reproduce the "Missing library" issue.
But I making several changes that might help.
Change-Id: Ieed6f14351a109565d20019deae6bf6e72e78112
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166306
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This will make it easier for upcoming bug fixes. Calling this verifier
in BestPracticesVerifier means it will only be run when hints are
enabled, perhaps boosting performance.
Also add a few more test cases.
Change-Id: If22ab02313d9f98f067ad4325b2f5ac473f4862c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164580
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Not that we include the promoted bound in the display string,
we can get back to checking these types just as strings.
R=brianwilkerson@google.com
Change-Id: Ie713e18082a3f5080ece039573098c998b8a2b98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165863
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
When flow analysis encounters a variable declaration of the form `T? x
= expr;`, if the type of `expr` is `T`, then the variable is
immediately promoted to type `T`.
Fixes#43099.
Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
Bug: https://github.com/dart-lang/sdk/issues/43099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
The packages 'analyzer' and 'nnbd_migration' tightly depend on each
other via MigrationResolutionHooks. I will publish analyzer 0.40.4
shortly after this CL lands.
Change-Id: I6f5e51f88e0020a1674ffb251712658e896170e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
A late variable with an initializer is very similar to a function
expression, in that it may be evaluated at any time in the future
(possibly more than once, if it throws an exception), so flow analysis
models it that way.
Fixes#42990.
Change-Id: I90ed00c8fd7388145f89011628e31ff7e85a5c43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>