Commit Graph

936 Commits

Author SHA1 Message Date
Paul Berry b53b425195 Migration: change EdgeOrigin classes to store AST nodes rather than offsets.
This will allow richer information to be passed back to the client
about how the nullability graph relates to the source code.

Also in this CL: eliminate the _CompoundOperatorInfo class, since
everything it tracked was already available from the
AssignmentExpression AST node.

Change-Id: I3f2a37d7cbef2c69358b5f68667f8ff8afafc517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117283
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-16 18:31:08 +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
Paul Berry 74db01f1c2 Migration: Remove edge origins from GraphEdge data structure.
This will pave the way for a follow-up CL that stores AST nodes in
EdgeOrigin objects without bloating memory usage; that in turn will
prepare for an instrumentation interface that allows the migration
client to gather useful details about how the nullability graph
relates to the source code.

Change-Id: I3689ee68de7c9969776564db4678e8c1e0344519
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-16 18:31:08 +00:00
Paul Berry c5c2c1bcca Migration: Fix assignment of FutureOr<T> to FutureOr<U>.
This should address ~12 exceptions whose stack trace includes the line:

_AssignmentChecker._checkAssignment_recursion (package:nnbd_migration/src/edge_builder.dart:2153:16)

Change-Id: I8375cfcc4e11b5c12c75e465d9de0af060b860dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117160
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-09-16 16:57:50 +00:00
Paul Berry f3b2d770ad Migration: rework assignment handling.
This change separates the handling of upcast assignments (which we
handle precisely) from downcast assignments (which we handle on a
"best effort" basis).

Should address ~2 exceptions whose stack trace includes the line

_AssignmentChecker._checkAssignment_recursion (package:nnbd_migration/src/edge_builder.dart:2087:9)

Change-Id: I0026f470a02c266c43d94ad2f08b84b8b3d7d228
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116687
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-11 00:25:14 +00:00
Paul Berry 1bbee6119d Migration: handle binary expressions whose LHS has type dynamic.
Should address ~21 exceptions whose stack trace includes the line

EdgeBuilder.visitBinaryExpression (package:nnbd_migration/src/edge_builder.dart:374:14)

Change-Id: I884ac0884e4249028219ca7ba374ec95a0849d7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116683
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-11 00:25:14 +00:00
Paul Berry 75fd88cf8c Migration: handle dynamic function expression invocations.
Should address ~17 exceptions whose stack trace contains the line:

EdgeBuilder._handleInvocationArguments (package:nnbd_migration/src/edge_builder.dart:1783:21)

Change-Id: I05eb69ac5a1bbda67bd080f5c9db4fd66ee1f8bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-09-11 00:25:14 +00:00
Paul Berry eeb1716660 Migration: don't forget to visit arguments to dynamic invocations.
Change-Id: Id2a6e09d7d7b5ac68e4a2f15612243c729fa4392
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116557
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-09-11 00:25:14 +00:00
Paul Berry 3cccd7f117 Migration: handle ??= assignments.
This should address ~24 exceptions whose stack trace contains the line:

EdgeBuilder.visitAssignmentExpression (package:nnbd_migration/src/edge_builder.dart:278:7)

Change-Id: I63cbc48422aeb85f49731dc479c8203a9fd6fecf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116554
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-11 00:25:14 +00:00
Paul Berry 79137ed65f Migration: create flow anaylsis before visiting parameters.
This is necessary in case any parameters are found that trigger flow
analysis methods to be called.

Should address ~24 exceptions whose stack trace contains the line:

EdgeBuilder.visitBooleanLiteral (package:nnbd_migration/src/edge_builder.dart:390:19)

Change-Id: I08dc31a8acdaaf0685516aab872905f620602806
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116488
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-10 22:08:02 +00:00
Paul Berry 1100aab88d Migration: handle this or super in generic classes.
This should address ~21 exceptions whose stack trace includes the line:

new DecoratedType.<anonymous closure> (package:nnbd_migration/src/decorated_type.dart:64:16)

Change-Id: Ic7ce9913c74ff468f8099e3b9f10a7a81eb00721
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-09-10 22:08:02 +00:00
Paul Berry f1f709ec11 Migration: add support for metadata on library/import/export/part/part-of directives.
Part-of support needed to be added.

Should address ~12 exceptions whose stack trace contains the line:

AnnotationTracker.visitCompilationUnit.<anonymous closure> (package:nnbd_migration/src/utilities/annotation_tracker.dart:39:16)

Change-Id: Ib25d6dc123ac6134b6b5d25081ad5cebe02fd951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116441
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-09-10 04:04:59 +00:00
Mike Fairhurst 1daf84f0dc [nnbd_migration] support spread elements
Change-Id: I170a820f1049856115e6d7c4302c75038d14f27b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116367
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
2019-09-10 03:20:19 +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
Mike Fairhurst 36648acfcc [nnbd_migration] Pass as casts to _handleAssignment
Change-Id: I5c3c079e5cd0385dc289597f802eb0baae082e44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116400
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-09-09 21:22:48 +00:00
Paul Berry b4614904de Migration: add support for indexing on a dynamic type.
Should address ~30 exceptions whose stack trace contains the line:

EdgeBuilder.visitIndexExpression (package:nnbd_migration/src/edge_builder.dart:758:7)

Change-Id: Idc5e84bf2334f51fdff52c34743b4360d19b7a35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116248
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-09 18:08:25 +00:00
Paul Berry 4a4f7cbde3 Migration: Handle uses of typedef types as expressions.
Addresses ~44 exceptions whose stack trace contains the line:

EdgeBuilder.visitSimpleIdentifier (package:nnbd_migration/src/edge_builder.dart:1123:7)

Change-Id: I5c76b7478d15d2338d7b47cbc6bebcf8c0d2d739
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116245
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-08 14:54:39 +00:00
Paul Berry 0b0c113b52 Migration: rework edge builder prefix handling.
We now use the same code paths for handling a simple identifier and a
prefixed identifier.

Change-Id: I412969c0cb384fd205a791f9aaec4989ce18cf5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116244
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-08 14:54:39 +00:00
Paul Berry 028d97bb1d Migration: handle references to already-migrated fields.
This should address ~54 exceptions having this line in the stack trace:

Variables._createDecoratedElementType (package:nnbd_migration/src/variables.dart:241:7)

Note: this change exposed issue #38257, so it includes a workaround for it.
Change-Id: Id533c070a02d310661a05035679d9476ad2ab240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116220
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-08 14:54:39 +00:00
Paul Berry cbe135255d Migration: add support for most compound assignments.
This should address ~37 exceptions whose stack trace includes the line:

EdgeBuilder.visitAssignmentExpression (package:nnbd_migration/src/edge_builder.dart:274:7)

Still not addressed: compound assignments using `??=`.

Change-Id: Iae97fcc4979c2a98c1dbb7ad57f62ebbfc4bb4b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116084
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-08 14:54:39 +00:00
Paul Berry daaa6657b1 Migration: fix a corner case of post-dominator analysis.
When the variable on the LHS of an assignment expression also appears
in its RHS, we want the RHS to contribute to generation of hard edges,
because the RHS is evaluated prior to the assignment.  To achieve this
we need to remove the LHS variable from post-dominator scopes after
visiting the RHS.

Change-Id: Ifef9d69356e78e43f77ef456101b335ba3238312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116059
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-08 14:54:39 +00:00
Paul Berry e227ffa955 Migration: improve handling of catch clauses.
This should address ~26 exceptions whose stack trace contains the line:

Variables._createDecoratedElementType (package:nnbd_migration/src/variables.dart:230:7)

Change-Id: I69fdf75aaa1e2a9bdbaef3b49c7928812566b131
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116083
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-06 21:58:25 +00:00
Paul Berry d7c96f323d Migration: handle prefixed class references.
Should address ~48 exceptions whose stack trace includes the line:

Variables._createDecoratedElementType (package:nnbd_migration/src/variables.dart:230:7)

Change-Id: I13b89f347fc91fcca23392cf14dfd6c2876704f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116042
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-06 19:22:21 +00:00
Mike Fairhurst e34d71feee [nnbd_migration] Implement if/for in map/set
Change-Id: Ie8dd7dbfdee5a52b8b0e25a6450dc77bf5bd935d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115777
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-09-06 17:36:09 +00:00
Mike Fairhurst da235a57f8 [nnbd_migration] Fix for elements for list literals
Change-Id: I9e8c6fd0e7075dc9fdf6408a16cfd19c6bdd7e66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115770
Reviewed-by: Paul Berry <paulberry@google.com>
2019-09-06 17:36:09 +00:00
Paul Berry 5d4940f968 Migration: remove a bogus comment
Change-Id: I0b185eaa20820fd0c92ce36a1900c39621fadb27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116001
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-06 16:09:04 +00:00
Paul Berry 6043b53af6 Migration: add the ability to dump the graph after propagation.
This is useful in debugging sometimes.

Change-Id: I08b788921d7966fcd9bde32ba41f75e18388be6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-06 16:09:04 +00:00
Paul Berry cdd2f855e1 Migration: handle upcasts from function type to Function or Object.
This should address ~91 exceptions with this line in the stacktrace:

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

Change-Id: Id837ffb3eea207dd1f63010482a69397a8dff9ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115768
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-06 16:09:04 +00:00
Paul Berry 28d16e1172 Migration: implement substitution logic for generic function types.
This should address ~222 exceptions whose stack trace contains the line:

DecoratedType._substitute (package:nnbd_migration/src/decorated_type.dart:386:14)

Change-Id: I53e4a1f41a44fe87aa15344a621a5b665dec1fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115766
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-06 16:09:04 +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 89dde0501d Migration: fix handling of assignments involving FutureOr.
Fixes ~96 exceptions whose stack trace contains the line:

DecoratedClassHierarchy.getDecoratedSupertype (package:nnbd_migration/src/decorated_class_hierarchy.dart:59:10)

Change-Id: I0a4d31f4822107453b2881618817c8a7c20e0e84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-05 18:07:38 +00:00
Mike Fairhurst a931a457f0 [nnbd_migration] support untyped set & map literals
Change-Id: Iaf2c72cfe9415e89e8d9000f473aa364bbcf012a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115267
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-09-04 20:21:03 +00:00
Paul Berry a6ea4037bd Migration: handle static method invocations properly.
Fixes ~22 exceptions with a stacktrace containing the line:

DecoratedClassHierarchy.getDecoratedSupertype (package:nnbd_migration/src/decorated_class_hierarchy.dart:59:10)

Change-Id: I59bfcf19044f2bd985ec9bd4b33f307f9ab5bb24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115121
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-04 18:15:30 +00:00
Paul Berry 8a0b0220e9 Migration: fix two minor bugs in the computation of class hierarchy decorations.
The first bug was that we were assigning an empty map to
`_genericSupertypeDecorations[class_]` prior to computing the supertype
decorations, and then updating the map in place.  This meant that if
an exception occurred while computing the supertype decorations, then
any subsequent requests for supertype decorations on the same class
would lead a partial result.  This led to a lot of weird
counterintuitive behavior.

The second bug was that `Variables.decoratedDirectSupertypes` wasn't
updating the `_decoratedDirectSupertypes` object when an entry wasn't
found; as a result, we were doing a lot of redundant computation.

This should address ~184 exceptions whose stack trace includes the line:

DecoratedClassHierarchy.getDecoratedSupertype (package:nnbd_migration/src/decorated_class_hierarchy.dart:59:10)

Change-Id: I7b7e5191f77c0e1d299923a99d841b6c11ca28c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115075
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-04 18:15:30 +00:00
Konstantin Shcheglov fe3fc9ed15 Don't use FunctionType.typeArguments in EdgeBuilder.
With summary2 FunctionType(s) don't have them.

R=paulberry@google.com

Change-Id: Iecfc3acec7e3c1132ad912b6cf18f630c2d854e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115063
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-09-02 18:15:57 +00:00
Paul Berry c1d887a8c4 Migration: Handle reference to methods and getters defined on Object.
Should address ~100 exceptions whose stack trace contains a line like this:

EdgeBuilder._checkNonObjectMember (package:nnbd_migration/src/edge_builder.dart:1293:12)

Change-Id: I48317502743c9f320fb6fa57ee4420030e309099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115062
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-30 22:19:48 +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 c7f3300448 Flow analysis: begin tracking where variables are written to in closures.
Not yet used.  This will be needed in order to implement the
"writeCaptured" behaviors in the flow analysis spec.

Change-Id: I873f10089a7b93ec5b40d979ddf3a6754e30b181
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-29 17:01:24 +00:00
Paul Berry ce12a2722d Migration: handle named parameters in _substituteFunctionAfterFormals.
Should address ~758 exceptions whose stacktrace includes the line:

new DecoratedType.<anonymous closure> (package:nnbd_migration/src/decorated_type.dart:83:52)

Change-Id: I0c7e64ee54af204bed40f28891274f03d85fdf7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114746
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-28 22:24:26 +00:00
Paul Berry e9fdeb2db8 Migration: add support for creating instances without supplying type arguments.
Should address ~622 exceptions whose stack trace contains the line:

new DecoratedType.<anonymous closure> (package:nnbd_migration/src/decorated_type.dart:64:16)

Change-Id: I01951abf28b7c474ca31eb2d2878caaf3c3b9073
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114744
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-28 22:12:51 +00:00
Paul Berry 66e349da9c Migration: Clean up substitution logic in getOrComputeElementType
This should address ~267 exceptions whose stacktrace contains the line:

EdgeBuilder.getOrComputeElementType (package:nnbd_migration/src/edge_builder.dart:197:16)

Change-Id: If377190e0bdabe85f541af50cb5f896fde5481ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114741
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-28 22:12:51 +00:00
Paul Berry 70a5794760 Migration: Add support for dynamic to DecoratedType._substitute.
Should address 164 migration tool exceptions with this line in their
stacktrace:

DecoratedType._substitute (package:nnbd_migration/src/decorated_type.dart:406:5)

Change-Id: I03ff6a27f94e02f914ca88ae1371affcfb63c101
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114620
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-28 14:36:53 +00:00
Mike Fairhurst fee3fffc59 [nnbd_migration] handle prefixes
Change-Id: I35109993a2356647f24fe8674582dc5cb20f2829
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114590
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-08-27 22:37:12 +00:00
Mike Fairhurst a28fcb59bf [nnbd_migration] handle dynamic property access
Change-Id: I7227a084fdb8754cb43b861ef60f44c363141137
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114625
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-08-27 21:13:42 +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
Mike Fairhurst c7fbf0dc35 [nnbd_migration] Handle method calls with inferred type arguments
Change-Id: I8a20236d8b039c7538e4538a4818905cf7ee06b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114581
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-08-27 20:44:36 +00:00
Paul Berry c604e58a9b Migration: add support for dynamic method dispatches.
Should address 191 migration tool exceptions with this line in their
stacktrace:

EdgeBuilder.visitMethodInvocation (package:nnbd_migration/src/edge_builder.dart:849:7)

Change-Id: I0e29331a11c2078fea353f7511bb8f77765897d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114582
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-27 12:33:54 +00:00
Mike Fairhurst 91de97f7e6 [nnbd_migration] Unwrap handles and remove handle assertion.
Change-Id: I58c5f47ec294a7b49d58147dd3a95759abb79e73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113920
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-26 22:45:40 +00:00
Paul Berry a2c7e7ce3e Migration: implement post-dominator analysis of ?? operations.
Change-Id: I66ed10fba630663e025cec8d805ed6677b2eb6ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114555
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-26 21:47:18 +00:00
Paul Berry 0c3a1a986f Migration: integrate flow analysis of try/catch/finally statements.
Change-Id: I2e826fc28c8acc5abae23e318cc21ec8053251a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114552
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-08-26 21:47:18 +00:00