Commit Graph

1123 Commits

Author SHA1 Message Date
Paul Berry 21bc3980fd Null safety migration: fix non-null intent in the presence of write captures.
After a variable is write captured, references to it should no longer
be considered to express non-null intent, because we can no longer
guarantee that an initially null value of the variable would
definitely lead to an exception.

Change-Id: I44c65350291a4c44cdb4b19529b13149d8170e34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180100
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-20 14:15:15 +00:00
Paul Berry 5df3d0f5f7 Null safety migration: fix non-null intent inference in the presence of local functions.
Previously, code inside of local functions was treated as though it
appeared inline for the purpose of determining non-null intent.  As a
result, a return statement in such a local function would cause any
code references that followed to be incorrectly treated as *not*
expression non-null intent.

Fixes #44703.

Bug: https://github.com/dart-lang/sdk/issues/44703
Change-Id: Ia74da007eb5424c784d41afeb0e2da4771578553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180081
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-20 05:40:26 +00:00
Paul Berry 306eb2fd97 Null safety migration: fix late inference when there is non-null intent
Previously, the nullability graph propagation algorithm identified
non-null intent prior to inference of `late`.  As a result, late
inference would be skipped for any variable with clear non-null
intent, so late inference was a lot less effective than it should be.

This requires updating several test cases where `late` should have
been inferred.

Change-Id: I0412ee7045e654185af08cc12b6ca1e6866112af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180080
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-01-20 05:40:26 +00:00
Sam Rawlins 3bd63a4d52 dart migrate: add a dart2js_path option to the resource generator
This helps build the web app in google3.

Change-Id: Ia5650836b2df37cff7b76f1cc7877776d6210790
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180086
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-20 01:10:26 +00:00
Sam Rawlins d97be105f8 dart migrate: Do not attempt to edit migration status icons for external files
Fixes https://github.com/dart-lang/sdk/issues/44705

Change-Id: I993726795391a2d5d0e639e5db56d10b6809ee79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179921
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-19 19:11:22 +00:00
Paul Berry 011f98c959 Invoke flow analysis for if-elements during null safety migration.
Fixes #44702.

Bug: https://github.com/dart-lang/sdk/issues/44702
Change-Id: I70e50722572553dca42b21cea9aff010bd978bfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180000
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-19 18:20:32 +00:00
Sam Rawlins 034540336a dart migrate: insert comment between first comment and first directive
Fixes https://github.com/dart-lang/sdk/issues/44704

Change-Id: I07402a958f7940bb603253a60e43709fc07529b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179920
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-19 15:16:12 +00:00
Paul Berry 8c216921ba Remove transitional method MigrationCliRunner.shouldBeMigrated2
Now that `MigrationCliRunner.shouldBeMigrated` has the correct
signature and internal clients no longer use
`MigrationCliRunner.shouldBeMigrated2`, we can remove
`MigrationCliRunner.shouldBeMigrated2`.

Change-Id: I33bdc78a603c859dd8bf1928f2dbc23233ae5e7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178763
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-19 13:41:32 +00:00
Paul Berry 75aea30724 Add an implementation of legacy type promotion to _fe_analyzer_shared.
The new implementation uses the same API as flow analysis.  This
should allow us to significantly simplify the CFE and analyzer, by
dropping their implementations of legacy type promotion in favor of
the shared implementation.

This CL just introduces the new implementation and unit tests for it;
it does not integrate it with the analyzer or CFE.  I will follow up
with a CL that does the integration.

Change-Id: Ie07b3b39604d6a022ad42f3ae6b648a317c8af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179560
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-16 17:07:23 +00:00
Paul Berry 9de69a94e0 Eliminate context arg from MigrationCliRunner.shouldBeMigrated
This is non-breaking since `shouldBeMigrated` is unreferenced outside
the nnbd_migration package).  Once this lands, we can switch clients
from overriding/calling `shouldBeMigrated2` back to `shouldBeMigrated`
and then eliminate `shouldBeMigrated2`.

Change-Id: I1235113bda6f7609de17ec05e7120b312f201536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178762
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-16 16:58:43 +00:00
Sam Rawlins bdb60329e9 dart migrate: handle an SDK constraint with no min
Fixed https://github.com/dart-lang/sdk/issues/43989

Change-Id: Iddc5e5f0b53a5ec0540b002654bc46b40dc8a46a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179421
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-15 18:03:07 +00:00
Devon Carew 70a88e9c4f update the documentation url for the nnbd migration tool
Change-Id: Idb898c0b4c831d7304db7b7a5251b9c8e7e66589
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179402
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-01-15 16:35:02 +00:00
Nate Bosch 58e7e7eb26 Prepare for breaking change in package:http
The `url` argument is changing from `Object`, accepting either `String`
or `Uri` at runtime, to `Uri` for better static help.
https://github.com/dart-lang/http/pull/507

- Switch to using `Uri` for requests. Where sensible push this type into
  the signature of the surrounding method.
- Make some updated method private where they were unnecessarily public
  which makes it harder to have confidence when looking for usages.
  Rename a method with an unnecessary `get` name.

Change-Id: Ibf075741d6b9d292349b15f1dc84004981729aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179368
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2021-01-15 16:35:01 +00:00
Sam Rawlins 6735d3c693 dart migrate: shutdown the process after applying a migration
Change-Id: Ifdb42cffa703912d541d61ba4386d7df96fda718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179240
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2021-01-15 03:32:52 +00:00
Sam Rawlins c5e0e73df5 dart migrate: Fix rendering overlay offset issue in Firefox
Fixes https://github.com/dart-lang/sdk/issues/44635

Change-Id: Id6e0518b86859605c5cfacb9091f7e1ed612b71c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178724
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-12 23:17:33 +00:00
Paul Berry 9370651773 Prepare to eliminate context arg from MigrationCliRunner.shouldBeMigrated
This change changes `MigrationCliRunner.shouldBeMigrated` to forward
to a transitional method `MigrationCliRunner.shouldBeMigrated2`, which
lacks the now-unused `context` argument.  After this lands, internal
clients will be switched to overriding/calling `shouldBeMigrated2`
instead of `shouldBeMigrated`.

Once no clients remain that refer to `shouldBeMigrated`, the `context`
argument will be removed from it (this will be non-breaking since
`shouldBeMigrated` will at that point be unreferenced outside the
nnbd_migration package).  After that, we will switch clients back to
overriding/calling `shouldBeMigrated` and eliminate
`shouldBeMigrated2`.

Change-Id: If9b476878260a5777f3346486d44c805dc361691
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178761
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-12 16:11:21 +00:00
Sam Rawlins 9488ea4c7e dart migrate: support files-to-be-migrated initial state in google3
* Rename isPreviewServerRunnning to isPreviewServerRunning
* Fix top "Migrating" checkbox upon navigation.

This change does not completely solve google3-compatibility, just the
web preview UI portion.

Work to improve any opt-out `// @dart=2.9` comments will follow.

Change-Id: Iee38650ab732179d82060b14bc7b657e3c560543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178160
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-01-12 05:54:50 +00:00
Brian Wilkerson 6143fb5668 Improve some diagnostic messages
Change-Id: Ic351c2addff76dea8fe49c7e2ce68b46043f0814
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-01-04 16:43:08 +00:00
Paul Berry 5c19c9f5e4 Flow analysis: store ExpressionInfo in SSA nodes.
This CL modifies flow analysis API so that when a variable is written
or initialized, if the written expression has non-trivial flow
analysis information, it is captured in the SsaNode associated with
the variable.

The stored information is not yet used; in a follow-up CL, I will add
the ability to retrieve it on a read and use it for promotions.

Bug: https://github.com/dart-lang/language/issues/1274
Change-Id: I1e2590205d4a0c59f4400a119f3d6b380a11414c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-17 15:16:04 +00:00
Sam Rawlins 6eddd878c0 dart migrate: Fix preview_site_test on windows
Change-Id: Ib0fc934eb1620017da20a444ced58a8d9e63f540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-12-15 23:45:01 +00:00
Sam Rawlins fe2205ebde dart migrate: Simplify final output code
Change-Id: Ib472bf14d8dd06efeeb17b2c81fdb97bb886b214
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176340
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-12-15 22:01:11 +00:00
Sam Rawlins 56fb42cb62 dart migrate: enable incremental migration workflow
Also:
* Print out details when applying migration
* Also fix title text position to not scroll out of view.

Change-Id: Idc4b703535400956f78d76ab7959f40cf77a0bc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175860
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-12-15 17:59:41 +00:00
Konstantin Shcheglov c11039702c Replace FindElement.functionTypeAlias() with typeAlias().
Change-Id: I88a5b889310df8a39b54318907ba8bbd68b26b9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176183
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-12-15 07:13:41 +00:00
Devon Carew b782d5815f [pkg/nnbd_migration] add types to public API
Change-Id: Ie4a7bbe75dd8045b20361c3fa1e08784b990e951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176142
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-12-15 01:34:29 +00:00
Konstantin Shcheglov 9717c775e4 Deprecate FunctionTypeAliasElement.function
Change-Id: Id629afa92c6681ba796aed75b24c4251fd86810f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176140
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-12-14 22:26:29 +00:00
Sam Rawlins 451bd1183b dart migrate: Support Windows newlines in opt out
Also sort test file.

Change-Id: Id8133d699ae1a71d1852ef29ce1f843c7ede98cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175561
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-12-10 00:34:50 +00:00
Sam Rawlins 88de6b438e dart migrate: Implement incremental migration in backend
This is still hiding behind a flag pending final review.

Bug: https://github.com/dart-lang/sdk/issues/44101 and
Change-Id: I01b7cb07b3fde7ac67105034b0c4057cb8a69771
     https://github.com/dart-lang/sdk/issues/44124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175402
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-12-09 15:21:50 +00:00
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
Devon Carew 8cba879f46 Add additional validations to the pkg/ package pubspecs.
TEST=these are additional validations that we run on the bots

Redux of https://dart-review.googlesource.com/c/sdk/+/161040

Change-Id: Ia32ced5d48fbfeafacfa9e51dc4774d2e9425091
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-12-02 17:27:18 +00:00
Paul Berry 1bfcc2d8da Migration: handle for-each loops where the loop variable is not local.
Fixes #44071.

Bug: https://github.com/dart-lang/sdk/issues/44071
Change-Id: I6a1a9df22f70086860c36108e529f189d3d24875
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174565
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-12-02 15:00:53 +00:00
Sam Rawlins 89811d9a92 Reland "dart migrate: Move title bar and add 'Migrate' check box next to title"
This is a reland of 17226bbbff

Remove generated files

Original change's description:
> dart migrate: Move title bar and add 'Migrate' check box next to title
>
> This check box displays whether a file is migrating, opting out, or
> already migrated. The check box can be clicked to toggle between
> migrating and opting out. Clicking the check box updates status in the
> navigation tree. Clicking on check boxes updates the status in the
> title bar.
>
> Screenshot here: https://screenshot.googleplex.com/9z9v9L5DHhBXzEU.png
>
> In terms of the HTML, a new parent above '.content' div was added:
> the '.file' div, which includes a '.title-bar' div above the '.content'
> div.
>
> Bug: https://github.com/dart-lang/sdk/issues/44101 and
> Change-Id: I021f0dd873119ae801e29faa92e97fe48d03ef3c
> https://github.com/dart-lang/sdk/issues/44124
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174440
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>

Bug: https://github.com/dart-lang/sdk/issues/44101 and
Change-Id: Iefada3e2fc8cbbc767cfc539204dc51b369888a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174720
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-12-02 14:40:07 +00:00
Paul Berry 52acf2e8ac Migration: fixes to exception handling.
Since the EdgeBuilder overrides VisitNode, it wasn't getting the
benefit of the error recovery behavior provided by the
PermissiveModeVisitor mixin.  This CL replicates some of the
functionality of PermissiveModeVisitor in the EdgeBuilder._dispatch
method so that it applies throughout the EdgeBuilder's visiting
process.

This uncovered a second bug: when an exception is reported, and the
user hasn't passed in the `--ignore-exceptions` flag, the migration
tool tries to exit immediately by throwing an error of type
MigrationExit, but this was being caught by the error recovery logic,
so the tool wouldn't actually stop reliably.  This CL changes the
exception reporting code so that it re-throws MigrationExit when
necessary to ensure quick termination.

Change-Id: Ifd2faf8edb7cd0087c45e20a747ab7f1790ef1c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174420
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-12-01 16:08:55 +00:00
Konstantin Shcheglov 7c5df72b27 Revert "dart migrate: Move title bar and add 'Migrate' check box next to title"
This reverts commit 17226bbbff.

Reason for revert: has unrelated tools/abiversions changes

Original change's description:
> dart migrate: Move title bar and add 'Migrate' check box next to title
>
> This check box displays whether a file is migrating, opting out, or
> already migrated. The check box can be clicked to toggle between
> migrating and opting out. Clicking the check box updates status in the
> navigation tree. Clicking on check boxes updates the status in the
> title bar.
>
> Screenshot here: https://screenshot.googleplex.com/9z9v9L5DHhBXzEU.png
>
> In terms of the HTML, a new parent above '.content' div was added:
> the '.file' div, which includes a '.title-bar' div above the '.content'
> div.
>
> Bug: https://github.com/dart-lang/sdk/issues/44101 and
> Change-Id: I021f0dd873119ae801e29faa92e97fe48d03ef3c
> https://github.com/dart-lang/sdk/issues/44124
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174440
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>

TBR=paulberry@google.com,srawlins@google.com

Change-Id: I8b8433d47390df91201a365f5aa54c7fb835d997
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/44101 and
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174385
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-12-01 03:30:32 +00:00
Sam Rawlins 17226bbbff dart migrate: Move title bar and add 'Migrate' check box next to title
This check box displays whether a file is migrating, opting out, or
already migrated. The check box can be clicked to toggle between
migrating and opting out. Clicking the check box updates status in the
navigation tree. Clicking on check boxes updates the status in the
title bar.

Screenshot here: https://screenshot.googleplex.com/9z9v9L5DHhBXzEU.png

In terms of the HTML, a new parent above '.content' div was added:
the '.file' div, which includes a '.title-bar' div above the '.content'
div.

Bug: https://github.com/dart-lang/sdk/issues/44101 and
Change-Id: I021f0dd873119ae801e29faa92e97fe48d03ef3c
https://github.com/dart-lang/sdk/issues/44124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174440
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-12-01 01:36:25 +00:00
Devon Carew 81986f4a36 [dartdev] add a --format option to dart analyze
Change-Id: Iad7d14b12892ce2121430f0cd94a2b0cd0d8e978
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174384
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-01 01:32:34 +00:00
Paul Berry 4185e7ccd2 Migration: disable code highlighting for very large files.
This avoids an apparent hang when visiting the SDK file
`html_dart2js.dart` (which happens anytime the user clicks on a link
like `HtmlElement`).

Bug: https://buganizer.corp.google.com/issues/168936042
Change-Id: I52bb535b6a2ca1a74071e272b1276520048a67bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174441
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-30 21:30:04 +00:00
Paul Berry e047dd60d6 Ensure that function elements inside local variable elements have unique locations.
Fixes #44216.

Bug: https://github.com/dart-lang/sdk/issues/44216
Change-Id: I5ccf8bb5f90396eabfec470a289a193d2aef16ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173881
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-25 13:39:04 +00:00
Sam Rawlins 1b07887853 Migrator: Implement check boxes on directories
Checking and unchecking a directory toggles the status of all child files which
are 'migrating' or 'opting out.' Files which are already migrated do not
change.

Checking and unchecking a file updates the status of all parent directories.
Directories with both 'migrating' and 'opting out' files are 'indeterminate'.

The difference between 'file' and 'directory' NavigationTreeNodes was
getting too hairy so I split into two subclasses.

Removed the keepingOptedOut status and added the indeterminate status.

Bug: https://github.com/dart-lang/sdk/issues/44101
Change-Id: Iea1a8c07b08c3d7956db51ca372437093457fe7f
     https://github.com/dart-lang/sdk/issues/44124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173600
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-11-25 02:32:59 +00:00
Paul Berry f0d56055b6 Migration: handle is expressions where the type is a function type.
Change-Id: Ibdcb4a49bd51e218e58a52a3e2f32bef55bce61e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173020
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-20 12:26:36 +00:00
Sam Rawlins db0a23faa0 Migrator: Land front-end support for 'migration status' check boxes
These check boxes are hidden behind a parameter that must be changed during
development; it is not wired to a public-facing flag.

The check boxes are styled, and are connected to the starting status of each
compilation unit (already migrated, opted out, migrating).

The check boxes can be toggled, but just for mocking purposes; their status is
not connected to the back end. The directory check boxes are not wired to the
status of their children.

Screenshot of checkboxes w/o colors: https://screenshot.googleplex.com/43XBRWsMPgbQXik

Screenshot of check boxes w/ colors: https://screenshot.googleplex.com/3bhJqcnmeV4sGNm
* dark green - already migrated; file is not being changed.
* light green - file is being migrated now.
* orange un-checked - file is being opted out, initial migration,
  file will gain opt-out comment.
* grey un-checked - staying opted out, file is not being changed.
* indeterminate - folder has multiple states inside.

Bug: https://github.com/dart-lang/sdk/issues/44124 and
Change-Id: I49daf1f52544024ec1c6d8d5cf3c59515c7db3a7
     https://github.com/dart-lang/sdk/issues/44101
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172821
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-11-19 19:32:25 +00:00
Paul Berry d0a23d8106 Add a triage document for the dart migrate tool.
Change-Id: I4ba33889c6171d012fc6a4239f4409c5fe9de005
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172661
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2020-11-17 21:39:48 +00:00
Sam Rawlins 95e4e03f88 Migrator: do not generate edit details twice on rerun
Fixes https://github.com/dart-lang/sdk/issues/44086

Change-Id: I99a23e5922a716bbd0c83e7c0f620686840ccd4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172300
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-17 05:05:00 +00:00
Nate Bosch aaf13b5247 Update to the latest package:yaml
Expand the range allowed by the dep from `package:analyzer`.

Switch dependencies to `any` for the packages which are `publish_to:
none`. The actual constraints aren't useful in these packages since they
are always pinned exactly by DEPS and so we can't trust they are kept up
to date.

Change-Id: Ibd937e8646574d49105f4dd0de2529e7ab30862a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172380
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2020-11-16 22:16:50 +00:00
Paul Berry 4bde77e3c4 Migration: fix test_this_inside_extension.
This functionality is working now, the test was just broken.

Bug: https://github.com/dart-lang/sdk/issues/39387
Change-Id: I088a3bd40ac438d0a9cd2356badfaf9513aa4bbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172280
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-16 21:21:06 +00:00
Paul Berry c0586277d7 Migration: fix handling of extensions on generic and function types
Bug: https://github.com/dart-lang/sdk/issues/39387
Change-Id: I037d29355dc86c071acc8dcc6f417a95e96e9728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172200
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-16 17:11:58 +00:00
Paul Berry 3103e1e0f6 Migration: don't overcount "whereOrNull" fixes.
Fixes #44174.

Bug: https://github.com/dart-lang/sdk/issues/44174
Change-Id: Ida53a11afc2e265cd510b0ac63c50f6b5ac93fdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-13 18:51:30 +00:00
Paul Berry 8abc99d07a Migration: encourage user to include SDK version when filing bugs
Change-Id: Ib8056827595470d8c3c8b2cb8371ab08dcc3e651
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172040
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2020-11-13 18:18:10 +00:00
Paul Berry 7d3bc4862d Rename pkg/analysis_tool to pkg/analyzer_utilities.
It's no longer just for the tools in the `tool` directory; it also
contains test utilities for use by the analyzer and related packages.

Change-Id: I0f8cf57f24ea7aad8e2177e43ee2bcb2ab3030da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171704
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-13 17:46:30 +00:00
Paul Berry b3120a6170 Sort declarations in messages.dart.
Change-Id: I07840b0818f36d6db9e099c69e02083ed3a8845d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171980
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-13 17:38:10 +00:00
Paul Berry cf4d300c0b Migration: handle "already migrated" case more gracefully.
If all the user's code has already been migrated and there are no
errors, instead of crashing, produce a friendly message indicating
that there's nothing to do, and exit cleanly.

Fixes #44193.

Bug: https://github.com/dart-lang/sdk/issues/44193
Change-Id: I9da9ab0221d4e13a61985eaa3fec0e74b86e9072
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-13 17:38:10 +00:00