Commit Graph

1123 Commits

Author SHA1 Message Date
Paul Berry a144fedbba Migration: add support for --ignore-errors to new CLI
Change-Id: I467c3ecfc7e8a7f52a1ba2be887ac2a677d5545c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145543
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-30 16:23:37 +00:00
Paul Berry 136ad8353b In migration CLI tests, verify that preview server only starts when expected
Change-Id: I81555fe4c520761ab14dc1535ad4a9918e226965
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145540
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-30 16:23:37 +00:00
Sam Rawlins 5ab3f3506f migrator: quiver's checkNotNull implies non-null intent
Fixes https://github.com/dart-lang/sdk/issues/39315

Change-Id: I136975064c6aadf9b8548afe9b5928d4ee6775a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145569
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-30 16:15:32 +00:00
Mike Fairhurst cde8098c97 [nnbd_migration] Improve error message quality
Change-Id: I3da17864861dc58df7cde9d1c6b034715f1c88bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144684
Commit-Queue: Janice Collins <jcollins@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-30 00:25:48 +00:00
Sam Rawlins 5506769402 Count variables checked with ArgumentError.checkNotNull as not null
Fixes https://github.com/dart-lang/sdk/issues/39644

Change-Id: I552e87e7c57dd2c5a012b76d9c73c24fefb19785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145025
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-29 22:35:18 +00:00
Sam Rawlins 61755dea19 Migrator: Infer late for test variables
Fixes https://github.com/dart-lang/sdk/issues/38291

This change also involves moving the "package" where test sources are
written and analyzed; It used to be /home/test (or /project in some
places); and a pubspec.yaml was written (or a .packages file) which
specified the package's name was "test". However, this conflicts with
adding an entry for a mock copy of the actual _test_ package. A
.packages file cannot have two entries for a package named "test", so
the package where all test sources are written is changed to "tests"
(located at /home/tests).

Change-Id: I462b88a814931dc2d4f1e72d07e3daf64768a399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144994
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-29 22:09:28 +00:00
Paul Berry 4d1ca6316f Migration: fix mock SDK path for testing CLI on windows.
Bug: https://github.com/dart-lang/sdk/issues/41678
Change-Id: I191699a5b9f39445be1bccad5e1e44d6b568d486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145441
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-29 19:11:54 +00:00
Paul Berry c6f94c3224 Migrtaion: add a hook to allow the preview server to be shut down in unit tests.
Without this, it's possible for a unit test failure to result in a
preview server remaining open, which can prevent test execution from
terminating.

Change-Id: I8a11056da5bea003dfa46e3871a241e8f5ce8cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145440
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-29 19:11:54 +00:00
Mike Fairhurst 2693b80dfd [nnbd_migration] Do basic categorization of edit types to suppress noise.
We really should switch this, if possible, to use the edit kind APIs
that the preview tool uses, so that we can categorize this without
guesswork.

However this will keep it as a rough list, and I don't know if we need
anything fancier that currently -- and it will no longer produce noise
if new changes are added.

(currently produces "and 0 other changes" when running on flutter, so
it's probably mostly comprehensive currently).

Change-Id: I9cb2662995af340346a61d38eba3469927a0f4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145160
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-29 17:22:44 +00:00
Paul Berry 6c1f8a0fb6 Split migration_cli_test.dart into Windows and Posix tests.
Since the tests use a MemoryResourceProvider we can run both kinds of
tests on both platforms.  That should make it easier to track down and
fix issues occurring under Windows (see
https://github.com/dart-lang/sdk/issues/40381).

Change-Id: Ie058f8c08923a3ef4ea12c5f28219e48aa17c28d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145026
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-29 16:20:44 +00:00
Paul Berry 30fcb067e0 Rework how migration_cli_test tests the preview server.
This mechanism is simpler, and it has the advantage that if the
preview server fails to start for some reason, we get a useful failure
message rather than a timeout.

Change-Id: I6ead899b3af02431c2a022fa104c6596ff952917
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145142
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-29 16:20:44 +00:00
Paul Berry 8d79c1f470 Migration: allow assignment to de-promote local variables.
Fixes #41411.

Bug: https://github.com/dart-lang/sdk/issues/41411
Change-Id: Ia88216e3327f42ee1d93143afb2a66839cf05a2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144161
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-28 13:54:28 +00:00
Konstantin Shcheglov eada4d8d65 Implement Factor in flow analysis.
Bug: https://github.com/dart-lang/sdk/issues/40014
Change-Id: I8d21d3c3368495d9d0dbb1cd52317b053657a176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144804
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-27 18:47:08 +00:00
Paul Berry c80ff5f5f7 Migration: nicer text for command-line option errors
Previously we just printed the result of calling Exception.toString(),
so the exception class name appeared in the output.

Change-Id: I789d4e5524cd8614d688252644b80898fd2cda17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144882
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-27 16:33:23 +00:00
Paul Berry cbdfc7f7ba Migration: add --apply-changes support to new CLI
Change-Id: I803747d09501be4cfa982ae6b3449e84d5752e3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144881
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-27 16:33:23 +00:00
Paul Berry b2773e38da Migration: add --no-web-preview support to new CLI
Change-Id: I2fe106ab2a48cdba610990b747ae3b9e1ef1d086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144861
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-27 16:33:23 +00:00
Paul Berry 62d05eb515 Migration: stop stubbing out Ansi class for testing.
Simply constructing `Ansi(false)` is sufficient.

Change-Id: Ie1af719962b4003afee338b274c75e50124c62a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144784
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-27 16:33:23 +00:00
Paul Berry 8d188a1a9f Migration: begin implementing CLI for the migration tool outside analysis server.
This will allow us to publish the migration tool on pub, so that we
can ship improvements to it that aren't coupled to SDK releases.

As of this CL, basic read-only functionality of the preview site is
working.  However, the ability to apply migrations and add hints to
existing code has not yet been tested.

Change-Id: Ib1588e741efa7be7861fa75b962fd1565765e794
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144808
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-27 16:33:23 +00:00
Mike Fairhurst 8236400594 [nnbd_migration] Change edit links to no longer be generic "post links"
Originally, edit links were implemented as generic "post links," that
had no special handling except to fire a post request.

At this point, this is no longer the case. We at least want to
specialize the error message, and we have TODOs to do more
specialization (targeted reloading of the UI).

Note that 'edit-link' is already a class, it refers to the edits the
migration tool suggests as the migration. Therefore I used the class
'add-hint-link' instead of 'edit-link.'

Lastly, post-links were styled like buttons. But they are not the only
links that should be styled as buttons now, so just use that class
instead of having special styling.

Change-Id: I8241a5ec24e6a290b94a75327c06257abdfc011b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144660
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-24 20:14:57 +00:00
Paul Berry 71ade62d09 Fix invalid downcast in pkg/nnbd_migration
Change-Id: Ie2a61f08a57ed741939c63a9ac7e07cf7f19c74f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144780
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-24 17:32:43 +00:00
Paul Berry 319843b6ff Migration: Further decouple NonNullableFix from DartFixListener.
NonNullableFix now communicates with DartFixListener through the
abstract interface DartFixListenerInterface; this will allow us to
build a version of DartFixListenerInterface that doesn't require the
analysis server.

Change-Id: I106d769b0e6ed49a916e2f1665a7e31a9a63be86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144471
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-24 10:06:53 +00:00
Paul Berry 4787fc190b Decouple migration logic from AnalysisDriver.
The migration logic doesn't need to access the AnalysisDriver object;
it just needs access to the AnalysisSession (which the driver holds).
By changing the interface so that it requests the session directly, we
pave the way for making a version of the migration tool that doesn't
require the analysis server.

Change-Id: Ib99725bbb2c1728a4c57b46659e9d94cbfe65ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144470
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-24 10:06:53 +00:00
Paul Berry b0173c1d3e Begin to decouple nnbd_migration tool from analysis_server.
This removes most of the imports from nnbd_migration to
analysis_server by replacing them with abstract interfaces that are in
turn implemented by classes in analysis_server.

Change-Id: I9be9a5bd69b1664f0fea9ff3b6ba4678f134f0e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144468
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-24 10:06:53 +00:00
Paul Berry eab774c255 Move much of migration tool UI code into pkg/nnbd_migration
Change-Id: Ia3b388b274c908dcc6f9cb9ee4bf004b82681c43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144320
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-23 23:43:42 +00:00
Sam Rawlins 29bc716241 Migrator: Add a late inference component
Fixes #38747

Change-Id: I045a6481424c75828eb7ae1e71c890b10e9d402c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144244
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-21 23:54:54 +00:00
Paul Berry dd883c749d Remove inadvertent imports from nnbd_migration to analysis_server
Change-Id: I001d00d5f1a8d4c503523f9ec4b09b38a908d8ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144301
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-21 21:55:19 +00:00
Paul Berry 52b04b3d28 Migration: code inside a switch statement should not imply non-null intent.
Fixes #41407.

Change-Id: Iec9a520bbbab6f55da569ecc863d92674c351207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144160
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-20 19:09:32 +00:00
Paul Berry 4c8da7543e Migration: handle field formal parameters properly in FixBuilder.
Previously, all parameters returned by
MigrationResolutionHooksImpl.getExecutableParameters were synthetic
ones that came from translating the executable element's decorated
function type to its final post-migration type.  Synthetic parameters
can't be field formal parameters, so this meant that when the
FixBuilder was re-resolving a constructor containing field formal
parameters, references to the field in the constructor body would get
incorrectly interpreted as pointing to the parameter rather than the
field, and that would cause them to be subject to promotion.

The fix is to only return synthetic parameters from
MigrationResolutionHooksImpl.getExecutableParameters when the
executable in question is in a library *not* being migrated.  When
it's in a library that *is* being migrated, we can just return all of
the executable's parameters without translating them, because we know
that the parameters themselves have been visited by the NodeBuilder
and EdgeBuilder, hence they all have thier own associated decorated
types.

Fixes #41405.

Change-Id: I5e3c411dc92fe242a959a5670b9253fbccea2b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144122
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-20 19:09:32 +00:00
Paul Berry b471ac55a0 Migration: apply guards to conditional branch expression values.
Consider the following code:

  int f(int i) => i == null ? null : i + 1;

Previously, migration would mark the return type of `f` as nullable
even if `i` was non-nullable.  This happened because the edge
connecting the explicit `null` (in the "then branch" of the
conditional) to the return type of `f` is created after visiting the
conditional expression, so the condition guards are no longer in
scope.

With this CL, we create an extra graph node when needed to ensure that
the guard is applied to the expression type.

Change-Id: Ie00eea0b431905241612c6661d69bdb55c0910d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144121
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-04-20 19:09:32 +00:00
Paul Berry 925e3fe782 Migration: detect weak-only code in conditional expressions.
This change adds the ability to detect when one branch of a
conditional expression is weak-only due to nullability.  For example,
in the following code:

  int f(int/*!*/ i) => i == null ? g(null) : i;
  int g(int j) => ...;

the call to `g` can only happen in weak checking mode.  The migrator
also now understands that j only needs to be nullable if i is
nullable.

Fixes #41555.
Partially addresses #41551.

Bug: https://github.com/dart-lang/sdk/issues/41555
Change-Id: I02c9c3072f0104db0f1a5b432fb1f2f8f06d5282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144120
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-04-20 19:09:32 +00:00
Sam Rawlins a4c49f8fce migration_tool: Dummy edges
Helps with https://github.com/dart-lang/sdk/issues/40509 and
https://github.com/dart-lang/sdk/issues/38747

Change-Id: Iac7208ee38dcc6c0b055f9e46c2d755ad0388488
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143962
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-20 18:14:32 +00:00
Paul Berry 3dff7f31a7 Migration: rename isEliminateDeadIf to isConditionalWithKnownValue
The new name more accurately reflects the purpose, and will make tests
less confusing when we add analysis of weak-only conditional
expressions in a follow-up CL.

Change-Id: I388f68173a1b41456690ebd0082e9c8d0ebe2e06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144003
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-20 17:26:26 +00:00
Paul Berry 5eb399388e Migration: when not removing weak-only code, visit all subexpressions.
In the FixBuilder, when we are discarding one of the branches of an
if-statement or if-element due to it being weak-only, we only visit
the branch we're keeping; this avoids trying to make changes to code
that's being removed.  However, if we are keeping both branches and
simply warning about one of them being weak-only, then we need to
visit both branches so that fixes are applied to both of them.

Change-Id: I26a1bfcb5f2ef4a111b1117637bce74e42d3db07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144000
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-20 17:26:26 +00:00
Paul Berry a2c9dc18d5 Migration: fix EditPlanner.addCommentPostfix when isInformative = true.
Previously, the spaces inserted by EditPlanner.addCommentPostfix
didn't carry the correct isInformative flag, so they would show up in
final migrated output.

Change-Id: I100ba88040ebff9ae5d406c49b242f6fb17ce7b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143887
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-20 12:43:46 +00:00
Mike Fairhurst 3de4d76b4a [nnbd_migration] Use offsets instead of column numbers in traces
Change-Id: I37f44c1a4713106e15b346739354b73592d208d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143721
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-04-17 19:07:44 +00:00
Paul Berry d52dc104d4 Migration: instead of removing weak-only code, warn about it.
Previously we considered such code "dead", but it's not really dead
until Dart 3.0.  Removing it changes weak mode semantics, and we don't
want to do that automatically.

Fixes #41231

Change-Id: I6a88f016b4f3fcba160dcb738558867219715cbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143941
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-17 17:27:59 +00:00
Paul Berry e221b998b7 Add test cases and TODO reference for #41551
Change-Id: I98cb02eca2143df8ed1c836919ee93bd43f366b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143885
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-17 17:27:59 +00:00
Paul Berry 4747672929 Migration: fix preview output when accepting a /*late*/ hint.
Change-Id: I383be37cc86d3c83f5b2b332ae14ce35516f858d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143563
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-17 00:17:15 +00:00
Paul Berry a72e0e3412 Migration: don't double count edits when accepting hints
Technically, accepting a hint requires two edits, one to remove the
`/*` and one to remove the `*/`.  But we only want it to show up as
one edit in the "Proposed Edits" pane.

Fixes #38471

Change-Id: Ica7880a2ffab98715a1c9f3bbe723363fd481086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143484
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-17 00:17:15 +00:00
Paul Berry fdc13e3f43 Migration: remove hints when performing migration.
Previously, if we migrated a code snippet like this:

  void f(int/*?*/ i) {
    /*late*/ int j = i/*!*/;
  }

the migration result would leave the hints and add the hinted text,
resulting in:

  void f(int?/*?*/ i) {
    /*late*/ late int j = i!/*!*/;
  }

We now simply remove the `/*` and `*/` surrounding each hint (with
whitespace corrections as needed), to produce:

  void f(int? i) {
    late int j = i!;
  }

Change-Id: Ic4e1216cb4693d73d71c9ab1a37d5cc15b8ef334
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143460
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-04-17 00:17:15 +00:00
Paul Berry 07ef4dee72 Migration: add offset/end getters to NodeProducingEditPlan.
Currently these are just equal to sourceNode.offset and sourceNode.end
respectively.  In a follow-up CL, I'll introduce situations in they
might differ (in particular, the edit might include changes to a
nullability comment that precedes or follows the sourceNode).

Change-Id: I1c728454bafe9b154662dbb4c21d28fc62415abf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143340
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 23:33:46 +00:00
Paul Berry 1d3105e0b3 Migration: prioritize changes differently if they're due to hints.
Change-Id: I4dfdd0287e488dfac21923c71741d2218a2c070c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143334
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 23:33:46 +00:00
Paul Berry 46b49d23ec Migration: track multiple fix reasons for expressions with complex types.
Change-Id: I1a1f78377ed64504e5315b5096914219dc625e78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143188
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 23:33:46 +00:00
Sam Rawlins e1822e9626 Migrator: Add new fix kinds: replaceVar, addType
Fixes #41410

Change-Id: I127d309e84423c24eb2563063af433187b9bf057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143222
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-13 20:11:32 +00:00
Janice Collins 40b4389891 Add AnalysisServer client implementation for isolates.
Change-Id: I1b4a9394a996cdc9907273689d2c9dc0c900de55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142556
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2020-04-07 20:02:16 +00:00
Paul Berry 49f6a49056 Migration: remove the PotentialModification class and some of its descendants.
This code was part of the old infrastructure that pre-dated FixBuilder
and is not needed anymore.

Change-Id: I697dbfcd325b2f1c38754890cc8f60679004f7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142680
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-07 18:35:56 +00:00
Paul Berry 03c15848d6 Migration: distinguish inserted casts based on whether they are downcasts.
Inserted casts that aren't downcasts are much less likely to be safe
than inserted downcasts.

Change-Id: I21e0ef54b1c4d58c54724a510b25828fc3018142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142552
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-07 18:35:56 +00:00
Paul Berry ab27cd12da Migration: fix listener setup for FixBuilder
We should only set the listener to non-null in permissive mode, since
a non-null listener is the signal to FixBuilder that it should report
expections rather than letting them bubble up the stack.

Change-Id: Ief047a54a5c8d63369420370e0ab891d03ce287f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142551
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-07 18:35:56 +00:00
Paul Berry 8c982a1373 Migration: categorize changes shown in the preview tool.
We now sort changes into the following categories (in order):
- Dead code removals
- Casts added
- Null checks added
- Required keywords added
- Types made nullable
- Casts now unnecessary
- Language version comments removed

The reasoning is that this corresponds roughly to how important it is
for a human to inspect each kind of change to make sure it is safe
(dead code removals, for example, are highly likely to indicate an
incorrect migration, where as dropping of unnecessary casts is benign
and almost certainly correct).

Change-Id: I49e3adac3ac98de1a9298f9caadb76c73a9c67d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142542
Reviewed-by: Janice Collins <jcollins@google.com>
2020-04-07 18:35:56 +00:00
Konstantin Shcheglov bac08fb339 Implement interfaces subtyping check using allSupertypes.
Change-Id: I43a4b98bae913895c7e176dd24a17fc5df7666e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-06 00:20:10 +00:00