Commit Graph

52 Commits

Author SHA1 Message Date
Konstantin Shcheglov 19e0673582 Revert "Return List<XyzElementImpl> from ElementImpl getters."
This reverts commit 645035bbb9.

Reason for revert: b/182098851

Original change's description:
> Return List<XyzElementImpl> from ElementImpl getters.
>
> Change-Id: Ice8a0feb6a0bd2599fcfd5ccc35c0b4242ed9530
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189620
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

Change-Id: I33eff159d62813c35e7e00eee5b7d9dd4fb4e563
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189781
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-08 19:09:44 +00:00
Konstantin Shcheglov 645035bbb9 Return List<XyzElementImpl> from ElementImpl getters.
Change-Id: Ice8a0feb6a0bd2599fcfd5ccc35c0b4242ed9530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-08 07:00:40 +00:00
Konstantin Shcheglov 875af7c991 Deprecated TypeProvider.futureType2/listType2/etc
Change-Id: Ia994be1e29b4d96b89d714beafcb9256a0cb4de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184641
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-12 17:26:07 +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 9d3b932640 Migration: fix handling of .call tearoff on a function-typed expression.
Change-Id: I18b102ae83afdb051decfc26762619fb5746f73f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170364
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-11-05 19:18:54 +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 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
Konstantin Shcheglov a1f510080d Use analyzer 0.39.12 in nnbd_migration.
So, we can use package:analyzer/src/dart/element/type_system.dart
instead of src/generated/... library.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ic804cd29429bf8a85d25e21f77292a6816a3ede7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153363
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-07-07 20:59:50 +00:00
Konstantin Shcheglov 9cfdc02e58 Stop depending on exports from generated/resolver.dart
We cannot remove them completely just yet, there are users in google3.
But this CL will allow experimenting internally to track these users
and update them similarly.

R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: Ic588b2873f9d5202783c8991f58e86bab28bd47e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-07-03 15:55:41 +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
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 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 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 2ec127a305 Migration: give nullability nodes human-readable names.
Change-Id: I86b510c6cc9afacb7d720af214c8f4e5a311c9ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138885
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-11 15:20:59 +00:00
Paul Berry 043af430c1 Migraiton: Add function names to trace output.
This makes them look a lot more like real stacktraces.

Change-Id: I0c060f72f8676ab6d5c0272532b90931b815fddf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138607
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-03-09 22:00:59 +00:00
Paul Berry 4df17ee697 Migration: clean up how decorated type parameter bounds are tracked.
We now track decorated type parameter bounds similarly to how we track
ordinary type parameter bounds in the FixBuilder, by having a single
static instance of a DecoratedTypeParameterBounds class that keeps
track of the mapping.

Change-Id: I49196e8a506ca8765857b3d47a355b7aaaa1918e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134411
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-02-05 20:51:49 +00:00
Paul Berry 9b6394c484 Migration: Fix toFinalType for top bounds.
To avoid inserting unnecessarily complex casts, we want to normalize a
type like `void Function<T extends Object?>()` to the equivalent `void
Function<T>()`.

Change-Id: Ied10e7735511b732eaeca027e621b4ef6997df59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133820
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-01-30 04:06:10 +00:00
Paul Berry e2e1993b94 Migartion: consider edges introduced by parameter overrides to be uncheckable.
This prevents a non-null assertion in an override from marking a base
class parameter as non-nullable.

Addresses one manifestation of https://github.com/dart-lang/sdk/issues/38699.

Change-Id: I8abc6829bb8de7a34a7e2c117a0c45a74e417771
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133422
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-01-28 13:26:47 +00:00
Paul Berry 2084137a7f Migration: fix warning in edge_builder.dart.
The visitSimpleIdentifier method was failing to return a DecoratedType
for the case where the identifier was `void`.

In practice this didn't matter, since the only time the type returned
from visitSimpleIdentifier is used is when the the identifier is used
as an expression, and `void` can't be used an expression (i.e. `var
voidType = void;` is illegal).

Nonetheless, it's nice to silence the warning, and it seems like it
increases safety to return a value from visitSimpleIdentifier in all
cases.

Change-Id: I239b98b9e5932195e6884738728d26d86c6ab519
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133336
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-01-28 13:26:47 +00:00
Paul Berry 1e01274bdf Sort methods in edge_builder_test.dart and migration_visitor_test_base.dart.
Change-Id: I14f9be6fabdd8df07d98f0e15edeebc07b625e30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133335
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-01-28 13:26:47 +00:00
Mike Fairhurst 6e7a900283 [nnbd_migration] Fix ConditionalModification on IfElement
Change-Id: I1e8ec4bead2aaa9147850d27cd5ac4d9c2a700be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130137
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-01-03 23:47:50 +00:00
Konstantin Shcheglov 2fb3f09948 Extract TypeProvider class into lib/dart/element/type_provider.dart file
Change-Id: I96cdfccc33e35a9625c14a89a08826758eac0f2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129601
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-26 21:31:04 +00:00
Mike Fairhurst c260e4e8da [nnbd_migration] Handle downcast from Iterable<T> to List<T>
Change-Id: Iee4a0e2c7bbd8fbc0a09e62d7edd5908c923a787
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129262
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-20 20:29:54 +00:00
Konstantin Shcheglov 615928c514 Stop referencing non-API TypeSystem in analyzer.
Replace it with TypeSystem from lib/dart/element/type_system.dart,
or (internally) with TypeSystemImpl.

We keep the old TypeSystem where its is exposed from API:
- ResolveResult.typeSystem
- AnalysisSession.typeSystem
- AnalysisContext.typeSystem

  We will make changes to these as a breaking change later.

Change-Id: I40ca53ea77e440457c6d0f3832ec3b6286bacdf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125770
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-21 01:09:24 +00:00
Paul Berry c6efc78319 Migration: update edge builder tests to use pointsToNever where possible.
Previously we were using `neverClosure`, which made the tests very
lenient; they accepted any node with an edge pointing to `never`
through a sequence of zero or more hard edges to be non-nullable.
While it is true that any such edges will be migrated to be
non-nullable, in our test cases we nearly always know that we want the
node to point to `never` through exactly one edge.  So it's worth
making the tests verify this.

Change-Id: I2783fd41628961e0cd31b95edd396defd0b26593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125550
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-19 16:43:19 +00:00
Paul Berry 3793a40e6a Migration: stop using always for decorating the type of explicit nulls.
Change-Id: I950c9b8e80bc647c5a42b5cb5c66babd7c4d41e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125008
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-12 22:19:16 +00:00
Konstantin Shcheglov 6cde7ce224 Deprecate synthetic FunctionTypeImpl constructor.
Change-Id: I7c2f834d7e9e532709b3d43b348e7588be659af9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124595
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-11 19:38:53 +00:00
Paul Berry 7e8e66016a Migration: do not use always or never in already-migrated types.
Previously, when the code being migrated referred to a nullable or a
non-nullable type in an already-migrated library, we would use the
`always` or `never` graph node to represent the nullability of the
type.  This was problematic, because it made it difficult for
instrumentation to pinpoint precisely which element in an
already-migrated library was the cause of an expresion being
null-checked, or a type being made non-nullable.

We now create a fresh nullability node for each non-nullable type
coming from already-migrated code, with an edge to `always` or `never`
to ensure that the fresh node has the correct nullability, so that
instrumentation can see precisely which element it came from.

Since the migration tool doesn't traverse the ASTs of already-migrated
code, we can't report an AST node that caused such an edge, so an
`element` getter has been added EdgeOriginInfo to allow us to report
the element that caused the edge.

As before, types associated with already-migrated code are reported to
instrumentation via InstrumentationListener.externalDecoratedType.  As
a new enhancement, bounds of generic parameters in already-migrated
code are reported to instrumentation via
InstrumentationListener.externalDecoratedTypeParameterBound.

Change-Id: Ided4e96e2920f8d9062688f5a6fda29b9b71dd12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-11-08 13:53:17 +00:00
Konstantin Shcheglov bad583a9fc Always provide nullability suffix to FunctionType constructor.
Bug: https://github.com/dart-lang/sdk/issues/39111
Change-Id: Id91a5c3f559446fbbcc02d6f9465780d287deb29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123020
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-25 18:53:46 +00:00
Paul Berry 8e23f76ac7 Flow analysis: properly handle promotion of type parameters.
When promoting a type parameter, we need to create an intersection
type (e.g. "T & int").  Such a type is represented in the analyzer and
the front end as a type parameter type pointing to the same type
variable, but with a different bound.

Change-Id: I1655f9242d913ca958c279cc80c3f6329f6b396d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122581
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-23 15:50:10 +00:00
Paul Berry 200e5b668d Migration: extract decoratedClassHierarchy from EdgeBuilder.
This will allow it to be re-used when we traverse input files for a
third time to generate modifications.

Change-Id: I0984484a90eb2ecb87f848ee70c03280ec69cecf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119124
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-29 12:36:47 +00:00
Paul Berry 430ff6d649 Migration: fix "matching" functionality of edge testing infrastructure.
Change-Id: I6318f89ba962329a1d3f4b0af2b0352981d6c9fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-19 00:26:14 +00:00
Konstantin Shcheglov 4102e63f37 Deprecate TypeProvider.listType/mapType
R=brianwilkerson@google.com

Change-Id: I7cef0b752be4ef6a7e4bc5394e14cd64ecb67ab5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117765
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-18 17:55:03 +00:00
Konstantin Shcheglov d4f1b8f8db Deprecate TypeProvider.futureType/futureOrType
R=paulberry@google.com

Change-Id: Idde7d82b217b5921c0770d9b69f6934a1e1fc493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117682
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-09-18 15:37:21 +00:00
Paul Berry 7f90b562be Migration: clean up nomenclature of graph edge "sources".
Instead of having a set of sources, of which one is the primary
source, we now have a set of upstream nodes, of which one is the
source node.

Change-Id: I580a4d91ee2d242eabe0e614b196951840d7cc7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-17 15:53:02 +00:00
Paul Berry 9bb9c05f92 Rename EdgeInfo.hard to EdgeInfo.isHard
Change-Id: Iff38a9f5fa13b1447cbdbddcd9ef1061a82b6a66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117465
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-09-17 15:53:02 +00:00
Konstantin Shcheglov 6a9d792454 Move NullabilitySuffix to API.
R=brianwilkerson@google.com

Change-Id: I58547075d3472e6708e6b5ff1c6d89f768aba66a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-16 21:14:11 +00:00
Paul Berry 233189e598 Migration: clean up EdgeOrigin class hierarchy.
This CL combines the EdgeOrigin and EdgeOriginWithLocation classes, so
that all EdgeOrigin objects are associated with source locations.  And
it separates the EdgeOrigin and PotentialModification roles of the
ExpressionChecks class into two separate classes.

This will enable a follow-up CL that switches the EdgeOrigin class
over to track source locations via AST nodes rather than offsets,
which will in turn allow rich information to be delivered to the
client about how the nullability graph relates to source code.

Change-Id: I736f60f93681fbbfbd5f9ee9a5589f99f819b9aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117282
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-16 18:31:08 +00:00
Konstantin Shcheglov f470695875 Stop using ClassElement/TypeParameterElement.type in tests.
There are 4 references to `type` left in tests, because it looks
that these tests validate peculiarities of the `type` getter itself.
I will remove them later, when the production code is off `type`.

R=brianwilkerson@google.com

Change-Id: I4b8a590e561fe3d3103500b097c13d989514976e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-16 15:53:29 +00:00
Paul Berry 32848c3a25 Migration: Rework handling of assignments to FutureOr.
This should address ~13 exceptions whose stack trace includes the line:

_AssignmentChecker._checkAssignment_recursion (package:nnbd_migration/src/edge_builder.dart:2089:7)

Change-Id: I74e78885c996b637d73f80ca2dabba0226fa1fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116366
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-09 22:39:12 +00:00
Paul Berry bad1816c21 Migration: add edge builder support for generic method invocations.
This should address ~25 exceptions whose stack trace includes the line:

EdgeBuilder.visitMethodDeclaration (package:nnbd_migration/src/edge_builder.dart:843:7)

Change-Id: I0076592f43f18c68f499fc9a80347a73033f8919
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-06 00:45:05 +00:00
Paul Berry fd9df1adc2 Migration: handle generic functions in already-migrated code.
Should take care of ~152 exceptions having this line in their stacktrace:

AlreadyMigratedCodeDecorator.decorate (package:nnbd_migration/src/already_migrated_code_decorator.dart:40:9)

Change-Id: I5a97470431b36b2c0ef88c15281b1eb51156b05f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114758
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-30 22:07:28 +00:00
Paul Berry 21021651a0 Migration: rework edge builder tests to reduce boilerplate.
Introduce a notion of a "node matcher" which abstacts knowledge of how
to match certain kinds of nullability nodes.  This significantly
simplifies the tests of substitution nodes; instead of digging through
the graph to find the substitution node, asserting that it is a
substitution node, and then asserting that it has the right form, we
can simply use the existing `assertEdge` method to assert that an edge
exists with the appropriate kind of substitution node as either its
source or destination.

Change-Id: I1a483f18669fd0cf8075deb60e61a1930a40c4f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114630
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-27 21:04:16 +00:00
Paul Berry 5f5d44c4dd Migration: sort declarations in migration_visitor_test_base.dart.
No functional change.

Change-Id: I5de50088ae75fcc95fc5bbaef7c041faeeae2336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114628
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-27 21:04:16 +00:00
Paul Berry 3f5f9831d8 Migration: move edge builder flow analysis tests to their own file.
Change-Id: I984cfe6a041753cdefefaa2ad12cfaf00e120b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-15 17:07:40 +00:00
Paul Berry a5772382dc Migration: refactor infrastructure for testing decorated types.
I have a lot more testing of decorated types to land in follow-up CLs;
this CL introduces a mixin containing helper methods that should make
that testing a lot easier.

Change-Id: I29c17ffb4af65498fcd85704dc404343429e09ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112847
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-13 16:49:14 +00:00
Paul Berry bcb9d1582a Migration: Move EdgeBuilder._checkAssignment to a mixin so it can be unit tested.
Change-Id: Iad865fac809b872c8dbd5b40f21e8dde2f3f0aa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-06 22:03:37 +00:00
Paul Berry 79f276e07d Migration: handle field formal parameters.
Change-Id: I15fb64a2cb7ed9bc56593fc8b27170aaa34af8a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107743
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-30 16:39:17 +00:00
Paul Berry ca25f56883 Migration: add support for type inference of function types.
Change-Id: Ic0ebbc4d412e7273127564089431ebe9058ee790
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107516
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-30 16:39:17 +00:00
Paul Berry 559e49aa5e Migration: propagate nullability inference through override relationships: return types.
Parameter types will be handled in a follow-up CL.

Change-Id: I71862fa6cf27aeede24bef60c096f631f6d8f60d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107100
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-06-24 12:51:14 +00:00