Commit Graph

1123 Commits

Author SHA1 Message Date
Sam Rawlins 9598c7b108 Migrator: Prepare migration_cli_test for the flip CL.
This is a weird CL because it strives to keep tests passing before and after
the CL, when they include a lot of error-path tests with weird pubspec files
and package config files.

Bug: https://github.com/dart-lang/sdk/issues/43883
Change-Id: I55dd4b398f3b1b53b8f2df95b2dcf880104ec7b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168901
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-23 21:07:12 +00:00
Sam Rawlins 360363efc1 Migrator: opt all test files _out_ of null safety.
Well not quite all; migration_cli_test tests are a bit of a different
beast so I am going to tackle them separately. But this fixes over
1000 test failures, and should clean up test output for further
debugging of the flip CL.

Each test file needs to be in a package with a package config file
which spells out that it is _opted out_ of null safety.

Bug: https://github.com/dart-lang/sdk/issues/43883
Change-Id: I583f66119df57031fd80824111923e15e0f91782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168900
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-23 21:07:04 +00:00
Paul Berry d751681647 Sort declarations in info_builder_test.dart
Change-Id: I00caa1860f93f2fb8cfcdf9fa571f9cd0cc880b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168980
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-23 20:01:22 +00:00
Paul Berry 7fde117f83 Sort declarations in migration_info.dart
Change-Id: I449c55bd570f60f4190be25a42e36d8c2b22a29e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168781
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-22 11:19:00 +00:00
Paul Berry f1843b0abe Add special case migration logic for iterator methods.
This logic allows us to migrate code like this:

    int firstEven(Iterable<int> values)
        => values.firstWhere((i) => i.isEven, orElse: () => null);

Into:

    import 'package:collection/collection.dart' show IterableExtension;

    int? firstEven(Iterable<int> values)
        => values.firstWhereOrNull((i) => i.isEven);

Rather than the default behavior, which would migrate it to:

    int? firsteven(Iterable<int?> values)
        => values.firstWhere((i) => i!.isEven, orElse: () => null);

(The new migration is far superior because it doesn't require the
input iterable to accept null).

This functionality is disabled at the moment, because:
- The changes it makes don't show up properly in the web preview.
- The pubspec is not yet properly updated.

I will address these issues in follow-up CLs and then enable the
feature.

Change-Id: I96f3b12d682c586631920b38406bad6aa3f4789e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168500
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-20 17:45:04 +00:00
Paul Berry 265ecc7488 Make test tolerant of changes to mock sdk
Change-Id: I5c2e6c964b666157977c66d8ad8a19ea41b09e58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-10-20 17:45:04 +00:00
Paul Berry 5898fefb92 Add missing invocation to test_all.dart
Change-Id: Ibcbe7f50555a66360b563ae3915d2567567dd025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168462
Reviewed-by: Janice Collins <jcollins@google.com>
2020-10-20 17:45:04 +00:00
Paul Berry 43166018a9 Nomenclature fix: migration diff output is not a summary.
The output the migration tool generates when the web preview is
disabled shows a complete diff of all changes the tool will make, so
it's really a misnomer to call it a "summary".

Change-Id: I8c7d9f9870bf8beffb62f1d10d36a65b66c32657
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168381
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-20 16:16:03 +00:00
Lasse Reichstein Holst Nielsen 92e52a1874 Remove direct dependencies on package:charcode from SDK.
Change-Id: I9ef36e8a6890a70baac6c18f0be2252dcf5453df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163941
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-10-20 13:07:53 +00:00
Paul Berry 98ccfc33df Sort declarations in pkg/nnbd_migration/test/api_test.dart
Change-Id: Ic4990bbb40fe571a5fcba3a9b03366266cd565db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167725
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-17 01:11:43 +00:00
Sam Rawlins 7c01226470 Fix navigation scrolling with big projects
Change-Id: Ie5fb3f79225354aef956e71467c0fe34b5e4cbc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168122
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-16 21:56:52 +00:00
Sam Rawlins 33e7bae759 Migrator: Fix issue with map node under 'analyzer:'
Without this fix, the tool inserts an enable-experiment
section indented at the wrong spot:

analyzer:
  exclude:
    foo:
      bar: 1
    enable-experiment:
      - non-nullable

Change-Id: Ib6601733221e77a4028f3c0ac87b36c258db6ec0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168120
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-16 21:37:02 +00:00
Konstantin Shcheglov 3a97c9f602 Use legacy TypeProvider in AssignmentCheckerTest.
I'm looking into enabling NullSafetyUnderstandingFlag in the next
analyzer breaking change.

test_function_void_to_function_object() fails, and it seems that
the test class should use legacy TypeProvider, because `Object` is not
assignable to `void`, but `Object*` is.

Change-Id: Ib867e0eec7a387ed3ed1379a7ef34a58b16e54ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168125
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-16 21:10:03 +00:00
Sam Rawlins a23dbf7417 Migration: do not wrap navigation items
Change-Id: I6b3a2c41d4df9cc0f789d04f74cdddf79f7759d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168060
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-16 15:29:22 +00:00
Sam Rawlins 3191b45998 Edit analysis_options.yaml to enable the non-nullable experiment.
The file might be edited in one of a few ways, depending on what it contains.

Previously we read and edited pubspec, which is also YAML, so this
implementation borrows a lot of that, and renames several "pubspec" elements to
be "yaml" elements.

I try to cover in tests various odd existing analysis_options.yaml situations,
so that we try to never crash, or corrupt on weird input here.

Fixes https://github.com/dart-lang/sdk/issues/43806

Change-Id: Ifc57d583e98d798fd7bca748bbe4afef272edab5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167862
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-16 12:58:32 +00:00
Paul Berry 6282572479 Remove deprecated method MigrationCli.addCoreOptions.
The internal code that was using this method has been updated to use
MigrationCli.options instead.

Change-Id: I46941b3a2b8dc65a66a3235052bc5c2110a9ab99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167820
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-15 16:09:56 +00:00
Konstantin Shcheglov aad1a677c0 Deprecate GenericTypeAliasElement
See also https://dart-review.googlesource.com/c/sdk/+/166680

Change-Id: I6018f3bf5796dcc8ab059aab5b29d01e7336581b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167727
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-10-15 16:03:26 +00:00
Paul Berry acef33fd08 Avoid using http: URIs with relative paths in the migration tool.
Such URIs fail when the connection between the migration tool and the
user's web browser is proxied over https.

Fixes #43545.

Bug: https://github.com/dart-lang/sdk/issues/43545
Change-Id: Id457851d5c074ff707a2829c928401a766e15ece
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167660
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-14 18:52:48 +00:00
Konstantin Shcheglov fbfc723de7 Use CompoundAssignmentExpression instead of LHS element/type.
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>
2020-10-14 18:45:08 +00:00
Devon Carew 7d994c106a Add a migration tool notice for TP2.
Change-Id: I3f882bc47c372e196186d6c9c539cc572d406f43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167620
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-10-14 17:30:17 +00:00
Paul Berry 63a406d78b Restore addCoreOptions functionality and create more robust replacement.
This CL unblocks the internal SDK roll by restoring the migration
tool's `MigrationCli.addCoreOptions` method (which is currently used
internally).  It also adds a replacement, `MigrationCli.options`,
which is more robust because it allows the client to choose which
options to include and which options to exclude.

Once this CL has rolled in, I'll update the internal code base to use
the new `MigrationCli.options` method and then remove the deprecated
`addCoreOptions` method.

Change-Id: I3ddbd935c3858c3302a2ad2b825b97df96249043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167443
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-14 00:27:47 +00:00
Paul Berry acf440fe42 Sort declarations in migration_cli.dart
Change-Id: I14c4b9b77eec3fef5a23f76877a8d291ca217198
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167423
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-10-14 00:27:47 +00:00
Paul Berry ad82b437f4 Prepare to publish package nnbd_migration version 0.1.1.
This will be the last published version, and is only being published
so that we can include a README entry indicating why the package is
not to be used.  After publishing, I will mark the package as
discontinued.

Change-Id: I95cb6d8d6ec41415edd2c8da300c165a0c4cfb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167444
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-13 22:53:04 +00:00
Sam Rawlins cddea627a7 Migrator: Accept 'late final' hint; same as 'late' hint
`late final` is not functionally different from `late`, as far
as the migrator is concerned; it is just an indication of late
in the face of missing initialization.

Fixes https://github.com/dart-lang/sdk/issues/41655

Change-Id: I1b0efd3de3b5c7064784ebd1e86c7d12436b1319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167203
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-13 19:41:58 +00:00
Sam Rawlins b9e8f6f09c Migrator: Use 2.10 as a lower bound for null safety to allow 2.11 dev versions
Fixes https://github.com/dart-lang/sdk/issues/43757

Change-Id: I989b1542d2c6746513cc88dcfeff995873536ac5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167400
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-13 19:41:18 +00:00
Sam Rawlins f2b94295d3 Migrator: Disable 'pub outdated' check temporarily
Bug: https://github.com/dart-lang/sdk/issues/43774
Change-Id: I128d0e24aa6b8c972f393d3e91aae418a44ed8ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167380
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-13 18:29:58 +00:00
Sam Rawlins 5c17af0843 Migrator: Refactor currentScrollPosition to be a function
Bug: https://github.com/dart-lang/sdk/issues/43546
Change-Id: Ie79b00b6471f4d5416e78fb6ca04e4c7f46d7231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167381
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-10-13 17:54:08 +00:00
Paul Berry d6292f99c2 Add a notice to the nnbd_migration package README.
I plan to publish this on pub, and then mark the package as
discontinued.  Customers should invoke NNBD migration using the `dart
migrate` command.

Change-Id: Ia871e71258e3951ac7fd866e46ae97043a6fa93c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167364
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-13 16:29:08 +00:00
Sam Rawlins 284c78d338 Fix scrolling when clicking the "Add hint" buttons.
The fix is just to capture the scroll position when the button was clicked,
then rescroll to that pixel after reloading the file.

I also sorted migration.dart.

I also added comments while investigating migration.dart.

Fixes https://github.com/dart-lang/sdk/issues/43546

Change-Id: Iac0a7bf10a671fd6e6b5f02ee0609b7e36fc985a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167360
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-13 15:24:18 +00:00
Paul Berry 626c865a3e Support migration of partially migrated packages.
Rather than produce an error immediately upon encountering an
alredy-migrated library, we simply skip processing it; this causes its
elements to be added to the nullability graph on demand, just like for
already-migrated dependencies.

We still check for the possibility that *every* file in the user's
package has already been migrated, and issue an error if so (rather
than just doing nothing); this should help avoid user confusion if the
user tries to re-migrate an already-migrated package.

Bug: https://github.com/dart-lang/sdk/issues/42308
Change-Id: I8dd81a9c6ff2bb23ede91e89d1152bd7726dec32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167202
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-12 23:58:32 +00:00
Sam Rawlins ef30beda17 Migrator: Print less output in tests
Change-Id: I8add1a75de71a4b979399be821a4baa803bc0165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167180
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-10-12 17:48:32 +00:00
Sam Rawlins a5455694d5 migrator: Bump opt-in null safety version
Fixes: https://github.com/dart-lang/sdk/issues/43757

Change-Id: Iabcb0ef088d94b29cad4663763a1a842a8c49dcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167160
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-10-12 17:23:22 +00:00
Devon Carew 07e2973f60 [pkg/nnbd_migration] some updates to the command line messaging for dart migrate
Change-Id: I780f7d6ec1e6985179f69ceb105519d5be838e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167120
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-10-12 15:53:32 +00:00
Paul Berry 2601fa6d78 Ensure that && and || expressions promote properly in unreachable code.
Bug: https://github.com/dart-lang/sdk/issues/40009
Change-Id: Ib06449624de9320f5229957511ebaaee92c75ec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166606
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-10-08 21:42:14 +00:00
Paul Berry 57932cfb4f Ensure that conditional expressions promote properly in unreachable code
Change-Id: I8680b81b44be789a047238b1e2d008ff240e59c2
Bug: https://github.com/dart-lang/sdk/issues/40009
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165405
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-07 18:16:52 +00:00
Paul Berry ed2f45d56d Ensure that if statements promote properly in unreachable code
Bug: https://github.com/dart-lang/sdk/issues/40009
Change-Id: I04a5af558bb70b861d92b5379a8fb84489d5c9f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165402
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-07 15:32:25 +00:00
Paul Berry e933e91aaa Reland "Flow analysis: promote to non-nullable on initialization"
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>
2020-10-07 13:14:55 +00:00
Clement Skau b4f49dc255 Revert "Flow analysis: promote to non-nullable on initialization"
This reverts commit 6a1c54ec30.

Reason for revert: Triggers test failure:
https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-linux-debug-x64/8247

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>

TBR=paulberry@google.com,scheglov@google.com,rnystrom@google.com,johnniwinther@google.com

Change-Id: I8549b48a734f527194ce11d82235b9d5c6e58185
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/43099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165564
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-10-01 08:41:15 +00:00
Paul Berry 6a1c54ec30 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>
2020-10-01 01:15:31 +00:00
Konstantin Shcheglov 8de1bc0a07 Stop using getReadType() in nnbd_migration.
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>
2020-09-29 17:18:25 +00:00
Konstantin Shcheglov e3fcb1a646 Remove unnecessary convertPath() invocations.
Change-Id: I57d0d2204df02bd9a5fc97986347ac0218442d39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-26 18:25:00 +00:00
Konstantin Shcheglov f9e6e38b21 Straighten up invocation of an Object method on dynamic.
Fixes https://github.com/dart-lang/sdk/issues/39609

Change-Id: I9b98d9bff8d4e9b75ab7625323f62eb6b6701a94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164256
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-25 16:46:04 +00:00
Konstantin Shcheglov d219bde703 Enforce await_only_futures and fix violations (in more packages).
Change-Id: I1812f7721915178e42956f988b9276bf8db0bfaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164281
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-24 16:58:50 +00:00
Paul Berry f860868740 Flow analysis: remove old "promotable via initialization" logic.
This logic was removed from the spec in
https://github.com/dart-lang/language/commit/b70bb3f90679eb1c67b7ee852e1322046b2e4777.

Only a few places in the SDK itself were relying on this promotion
logic; I've fixed those places by adding explicit types.

Change-Id: Iaeaebe8dd5ab3e848699bc8ebc64a1ae80c1027a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163681
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-09-22 12:22:13 +00:00
John Ryan 90ff5d0af6 Add favicon to nnbd_migration tool
Uses the existing dart_192.png image.

Alternatively this could have been done using a favicon.ico file but
that would have required more boilerplate, so I went with a simpler
approach.

fixes #43438
https://github.com/dart-lang/sdk/issues/43438

Change-Id: I91e0c28a2c0a28db58dbf5189aae4d099c19b23c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163500
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: John Ryan <ryjohn@google.com>
2020-09-21 17:51:47 +00:00
Konstantin Shcheglov 9ef060886e Fix lints in nnbd_migration.
Change-Id: I57a8de216709beb1c65877bb228e1a0365ac6976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-09-18 18:32:06 +00:00
Sam Rawlins 475ffb96c0 Migrator: Use pedantic 1.9.0
Change-Id: Ia53e84ac6b2f3ab0679710c14453fd65c8f9c00d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163161
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-09-17 20:52:43 +00:00
Paul Berry a3c10e3653 Migration: clear regions at the top of InfoBuilder._explainUnit.
There are certain rare conditions involving generated code in a bazel
workspace that can cause a source file to get processed more than once
by the migration tool (sometimes with a correct URI, sometimes with an
incorrect URI that corresponds to a file path in the `bazel-out`
directory).  For the most part the migration tool is tolerant of this
situation, but it can cause InfoBuilder._explainUnit to get called
twice for the same unit.  To avoid this creating user-visible
problems, we need to ensure that any regions left over from the
previous invocation of InfoBuilder._explainUnit are cleared out before
we re-populate the region list.

Bug: https://b.corp.google.com/issues/168295421
Change-Id: I18936b03261c30b8c9062b4a568e1a1e094ec867
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162800
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-09-14 23:58:58 +00:00
Sam Rawlins 151292572c Migrator: Check analysis results before re-running.
* Refactor MigrationCliRunner, mostly simplification.
* Add AnalysisResult class to track analysis errors.
* MigrationState now contains an AnalysisResult, and the previewUrls.
* Add logic in the UI to display analysis results.
* Add logic to the backend to display analysis results.


Fixes https://github.com/dart-lang/sdk/issues/41712
Fixes https://github.com/dart-lang/sdk/issues/43138

Change-Id: I3304467955cfa81820f0010d32e17931b3c68b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162400
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-09-10 20:55:14 +00:00
Sam Rawlins 8035d5a0a7 Migrator: Switch styles for un-changed NN type and inserted "?", "!", etc.
Fixes https://github.com/dart-lang/sdk/issues/43125

Some screens:

Old: https://screenshot.googleplex.com/6dqJeWEvX2pYSi4
New w/o position change: https://screenshot.googleplex.com/8HorAjqMw2tMshk
New + bold font (not included in CL; just for reference): https://screenshot.googleplex.com/3N9cMr4RijXv5sM
New w/ position change (included in CL): https://screenshot.googleplex.com/9TfLKpHCCZkzLXX

Change-Id: Ib8aaf3ae56e645beaa01b2cf9e78db68544441b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162242
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-09-10 18:57:58 +00:00