Commit Graph

53 Commits

Author SHA1 Message Date
Paul Berry 0e8a84173e Migration: fix futures using .then rather than as
Previously, if the migration tool encountered a Future expression with
a bad type (e.g. a Future<String?> where a Future<String> was needed),
it would "fix" the problem by introducing a cast.  That is nearly
always the wrong thing to do; what we want to do is null check the
value that the future *completes* with.

This CL changes the migration tool so that it fixes this case by
appending `.then((value) => value!)` to the future expression.

Fixes #45472.

Bug: https://github.com/dart-lang/sdk/issues/45472
Change-Id: I7a35b54f673936e2e4b0f8f3a077ba8bf684b4eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193700
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-31 17:48:19 +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
Paul Berry 02b2e5398d Migration: permanently enable "transform where or null" feature.
This feature is now working reliably enough that we no longer need the
option of turning it off.

Change-Id: I2bbeb114ca1bd4e0dc8e94ac6775ec5e2fa8718e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171705
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-12 21:12:20 +00:00
Paul Berry 80ac9c999b Migration: update pubspec when adding import of package:collection.
Change-Id: Ia9e5090bafa7f67be87aa01367bec16f4fd80ee9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171701
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-12 21:12:20 +00:00
Paul Berry 95940f8963 Sort declarations in migration_cli.dart and nnbd_migration.dart
Change-Id: I4e2904a40dcc0f7ece94ee6aa823743455f46b4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171633
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-12 18:07:09 +00:00
Paul Berry 7322bc027e Migration: replace pub outdated check with a check on transitive imports.
Instead of running `pub outdated` to see if the user's dependencies
have been migrated yet, the migration tool now examines all of the
transitive import dependencies of the user's code to see if they are
opted in to null safety.  This produces a more accurate result than
`pub outdated`, because it is able to ignore files in transitive
package dependencies that aren't reachable via imports
(e.g. references to `package:analyzer` brought in by `package:test`).

Fixes #44061.

Bug: https://github.com/dart-lang/sdk/issues/44061
Change-Id: I38465bcbf35e8552f0060b5d51c0f1cfc5d18c7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170561
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-11-05 23:05:51 +00:00
Paul Berry 65eb643181 Migration: don't produce null!.
Instead, produce `null /*no valid migration*/`.  This should lead to
less user confusion (`null!` seems crazy, since obviously a null
literal will fail a `!` check).  Note that this will be a static
error, which will give the user a better chance of noticing and fixing
the problem.

Fixes #43972.

Bug: https://github.com/dart-lang/sdk/issues/43972
Change-Id: Ibf83b786dc486b14c001c17ca2ba902dafcb8a18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169600
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-29 18:34:36 +00:00
Paul Berry a666ac7ffa Migration: add preview info when changing iterable method calls.
With this change, the functionality of changing iterable method calls
such as `.firstWhere` into extension method calls such as
`.firstWhereOrNull` is working well enough that I think we can switch
it on.

We don't update the pubspec properly yet; that will be addressed in
follow-up CLs.

Change-Id: I758332e9752b12d399ecb5c70cf37bbc8da77d6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168988
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-10-25 18:57:35 +00:00
Paul Berry 3ff14f19d3 Migration: include unimportant edits in UnitInfo.regions.
Previously UnitInfo.regions contained just information about edits
that we wanted to alert the user about; it didn't contain information
about unimportant edits like adjusting whitespace.

This caused problems when trying to make complex edits (like those
necessary to transform a `.firstWhere` call into a `.firstWhereOrNull`
call) because it interfered with UnitRenderer._computeRegionContent's
ability to properly compute file offsets.

So we now include all edits in UnitInfo.regions, and we distinguish
the unimportant ones by seeing that their `kind` and `explanation`
fields are `null`.

To ensure that important edits never wind up with `null` values for
these fields, we add assertions to the `NullabilityFixDescription`
constructor.

Change-Id: I89928150eb507524222d03acfae0b4770363443c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168985
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-10-25 18:57:35 +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
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
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
Paul Berry 2e261f9386 Migration: add locations to trace entries that refer to elements.
Bug: https://github.com/dart-lang/sdk/issues/41402
Change-Id: I0dc59ae9d64c6e8ab470b2ddcb5fd42557ba5704
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148742
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-05-27 21:52:14 +00:00
Paul Berry 11e5a05a70 Migration: when removing dead code, remove unnecessay ??=s
Fixes #38676.

Change-Id: Icc24c6f070d7f3e8a74fc9494aef3e4c2583fac4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146320
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-05-05 02:18:13 +00:00
Paul Berry bf56b2ca2c Migration: produce diagnostic information for assignments.
We produce a diagnostic under the following conditions:

- For compound assignments, if the type read from the LHS is nullable
  (this is illegal after NNBD, and requires user intervention to fix).

- For compound assignments, if the type returned from the combiner is
  not assignable to the LHS (this was required prior to NNBD, but it
  is a stricter condition after migration, both because the LHS might
  have a non-nullable type, and because implicit downcasts are not
  allowed).

- For null-aware assignments, if the type read from the LHS is
  non-nullable (this indicates that once strong mode is enabled, the
  assignment will be dead code).

Bug: https://github.com/dart-lang/sdk/issues/38676
Change-Id: Icb242ba36437e38364ada069880831eb05e3a513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145664
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-05-01 22:54:25 +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
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 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 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 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
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
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 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
Paul Berry 3edfab164f Migration: remove redundancy from NullabilityFixKind enum.
The values discardCondition, discardElse, discardIf, discardThen, and
removeNullAwareness are all variants of dead code removal and there's
no reason to distinguish them.

Change-Id: Id55035486e07f52e6ef7b5a2485dcb0cadb153e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142060
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-03 16:18:51 +00:00
Mike Fairhurst 799560bff7 [nnbd_migration] Remove language version comments during migrate
Bug: 41095
Change-Id: I3262d6da485d78fee1e2dfe4ac22692c5e4b6daf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140369
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-03-24 16:44:05 +00:00
Paul Berry 41b67a9b52 Migration: add grayed-out spaces to indicate types not being made nullable.
Change-Id: I4fa076693c25cf9466d33332030df3983043ffd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139940
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-18 21:18:22 +00:00
Devon Carew fc1d2a82f4 [dartfix] remove the 'dartfix upgrade sdk' command (prefer 'dartdev migrate')
Change-Id: I981e2b1805a81210cfb0ed7af809a07eb3eabb5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137221
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-03-04 17:55:06 +00:00
Mike Fairhurst ca3ad264a6 [nnbd_migration] Report info building exceptions to server adapter
Change-Id: I4e3eef0d3e404bd090f36f8b2516abb97cc6c311
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137520
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-03-02 23:33:06 +00:00
Paul Berry 2edd8d17c0 Migration: replace ?. with . where appropriate.
Change-Id: Id32f60caec0c25099704652c03fafc8b184bf4d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133241
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-01-24 19:58:43 +00:00
Paul Berry e0f97cda30 Migration: switch to using the FixBuilder.
Change-Id: I41e978439d36a26e55be71071a931390eb3dbf57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-01-23 16:06:57 +00:00
Brian Wilkerson 500822341e First steps to allow migration to be incrementally rerun
Change-Id: Ib4e682739a732ad9b8863ecb780ad88e5cbd9c6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132921
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-01-22 20:23:38 +00:00
Paul Berry ce5a0f5e32 Migration: fix instrumentation when dropping the condition and else parts of an "if"
When migrating an unnecessary "if" test like this one:

  if (x != null) {
    Do something;
  } else {
    Do something else;
  }

We make two modifications to the user's file:
- Drop "if (x != null) {"
- Drop "} else { Do something else; }"

With this change, the first modification has a description of
NullabilityFixDescription.discardCondition and the second has a
description of NullabilityFixDescription.discardElse.  Previously,
both modifications had a description of
NullabilityFixDescription.discardElse, which was confusing.

Change-Id: I6407d7616b7a2d2c8af853ab48c3480959c4fdb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-01-22 15:29:37 +00:00
Paul Berry 47950b5153 Migration: add logic to remove unnecessary "as" expressions.
Only works when the FixBuilder is enabled.

Change-Id: I9f2ee95603f9b6b247eae1ba00e817a71fc299d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132681
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-22 00:05:34 +00:00
Paul Berry 48aa6470ca Migration: plumb more fix reasons through FixBuilder to instrumentation.
Now there are only two circumstances in which an AtomicEdit won't have
information about the reason for the change:

- The AtomicEdit object was associated with adding or removing parens,
  in which case we don't compute information about the reason for the
  change because it's not straightforward to compute, and it should be
  clear to the user anyway.

- Information about the reason for the change hasn't been plumbed
  through properly (this should be addressed in follow-up CLs).

Since we are rapidly approaching a situation where nearly all
AtomicEdits will have reason information, the separation between
AtomicEdit and AtomicEditWithInfo now seems silly, so I just moved the
`info` object into AtomicEdit and removed AtomicEditWithInfo entirely.

Change-Id: I61afd9cd58b71d4695685e65d0142a2693b8e6b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132451
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-21 15:58:02 +00:00
Paul Berry 31bfacfda4 Migration: change API to make use of FixBuilder's "changes" data structure.
The new FixBuilder component of the migration engine communicates the
changes it produces using a "changes" data structure of type Map<int,
List<AtomicEdit>>, and is not compatible with the old
SingleNullabilityFix class (which made the incorrect assumption that
each SourceEdit was associated with a single fix).  This CL changes
the migration engine's instrumentation API to use this data structure,
and changes its listener API to avoid reference to the
SingleNullabilityFix class.  This allows SingleNullabilityFix to be
deleted.

This required changing AtomicEditWithReason so that it can hold
multiple fix reasons, and a NullabilityFixDescription.  It does so
using a new object, AtomicEditInfo, and AtomicEditWithReason is
renamed to AtomicEditWithInfo.

In addition, the old FixInfo class is removed, since it carries the
same information as the new AtomicEditWithInfo class.

This required deleting the "incremental workflow" functionality from
UnitRenderer.  This functionality was disabled, and I believe it
wouldn't have worked anyway (since it, too, made the incorrect
assumption that each SourceEdit was associated with a single fix).

Change-Id: Id965cfd803b408c66f15436017b87fc3e46521c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132306
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-19 16:50:01 +00:00
Paul Berry 38453843fb Migration: annotate API tests that assume dead code is commented out.
In later CL's, I will make it possible for dead code to be deleted
instead of commented out.  This change prepares for that, by
explicitly noting which API tests assume that dead code is commented
out.

Change-Id: I4e0ff6f1de4c0ab5fda050956944725b2d23dc5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130931
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-10 20:42:32 +00:00
Paul Berry 2199e94d37 Migration: begin integrating FixBuilder.
Since the FixBuilder-based implementation is not yet fully baked, we
only enable the integration in api_test.dart for now.  The remaining
failing test cases are marked with a `@FailingTest` annotation
pointing to https://github.com/dart-lang/sdk/issues/38472, which is
the tracking bug for the FixBuilder implementation.

Change-Id: I761350fff125cec8067a96fdfc593b381e5feb3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130882
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-01-09 20:01:16 +00:00
Sam Rawlins ed971fd0c7 NNBD migrator: Add Locations for each edit made in an NN fix
Change-Id: I53342cb43910deea2f59f37d5795ddbb70cb6b0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125480
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-18 20:40:25 +00:00
Sam Rawlins 15e5c23167 nnbd preview tool: Better text when inserting 'required'
Helps with #39247

Change-Id: I3bb7b25c73d58fc49260d6e3019b58b2f3f6b80a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125440
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-15 22:20:16 +00:00
Sam Rawlins 7115687beb NNBD i13n: Add a description for discarding just the condition
Change-Id: Ia12f9e350c8a9ace456591db6c48553111e3c533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120624
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-10-07 21:10:09 +00:00
Brian Wilkerson 07db94d454 Add support for details and implement some initial details for regions
Details provide a way for clients to provide navigation support. I'm
imagining that the description could be used as link text.

The deatils are currently more of a data dump than information. I need
to see more migration results in order to figure out when and how to
pare down the data into actionable information.

We might want to capture all of the navigation targets as we build the
info so that we can create anchors in the HTML.

Change-Id: Ie48622ce7d935d3c028ea42e51cfc8da590db149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118908
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-09-26 18:03:40 +00:00
Paul Berry f7b6169e18 Migration: add required keyword instead of @required annotation.
Fixes #38461.

Bug: https://github.com/dart-lang/sdk/issues/38461
Change-Id: Ibe3ba234fce9d1293ef862fad6f785e9abed964e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-25 19:14:53 +00:00
Paul Berry 4ae145e173 Migration: Introduce an instrumentation interface.
This interface is a callback interface that allows the client to
receive detailed information about the decisions made by the migration
tool, and the source code locations associated with those decisions.
The idea is that a client of this interface can put together a report
to the user to help them understand the behavior of the migration
tool.

The instrumentation interface mostly exposes internals of the
migration engine through some safe, non-destructive interfaces.  The
interface itself is documented in the new file
pkg/nnbd_migration/lib/instrumentation.dart.  For examples of what
information the client can expect to receive through the
instrumentation interface, see the new file
pkg/nnbd_migration/test/instrumentation_test.dart.

Change-Id: I079551922bff75e0e8d290819f31533c29d7b62f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-16 20:57:41 +00:00
Paul Berry c6e2497569 Migration: capture more exception information and make it easier to examine stack traces.
Change-Id: If509121fcf2b1f9b9e0a7bf722945241b90c647b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-20 15:20:00 +00:00
Brian Wilkerson c565fbf9d6 Fix a couple of hints in the nnbd migrator
Change-Id: Iaa2442432fe300fd116224a2c2d75e9d76d4e1e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112260
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-07 19:27:54 +00:00
Mike Fairhurst c0f23ce8bc [nnbd_migration] fix kind -> description, drop empty, tests
Change-Id: I7224167ae26344336f665827b145c57319076d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111382
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-08-02 07:35:41 +00:00
Devon Carew ddc9b9d492 [analyzer] tweaks to the dartfix UI
Change-Id: I32b61f1331b6c3c4fe37ced3dd1a5d68ebcb9d4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109547
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2019-07-18 20:47:00 +00:00
Paul Berry 0a0927de9c Migration: Separate the implementation from the NNBD migration engine's public API.
Change-Id: I0ea000b9068661d4e9122414320202ebd4f8563b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105413
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-10 17:10:45 +00:00