Commit Graph

1123 Commits

Author SHA1 Message Date
Paul Berry a5683dfb62 Migration: add a repro for an issue with field formal parameters.
See #38453.

Change-Id: I7ecf1c020437b7e332e7646cc40e947f38a081bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117687
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-18 15:45:22 +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 37016a7397 Migration: use virtual dispatch to compute nullability fix descriptions.
Change-Id: Iffc75fa0f11f4d735f7bc5c46a8853ac1bb6ac45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117580
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-17 20:00:31 +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
Paul Berry 478e3cfe87 Migration: test and fix a few more instrumentation corner cases.
Change-Id: I09f6837cd6c3c64c45887a164a3fffd3bec5f6a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117462
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-17 15:53:02 +00:00
Mike Fairhurst 1222a97e46 [nnbd_migration] principle is check types non-null, component types nullable
Change-Id: Ie02341d0f92ae9f72404b5ffd5b3f81e929f4906
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117213
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-16 22:33:06 +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 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 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
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 f8f7a5a6c1 Migration: add a test case documenting the need for definite assignment integration
See #38344.

Change-Id: Icaef1c645843746fd88f33b910dd940ae893e67e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116884
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-13 14:51:32 +00:00
Paul Berry 366b4056e6 Migration: add a test case documenting a problem with back-propagation of non-nullability
See #38341.

Change-Id: I74cfc40a1db60e3dce10352ac3945a23fe591e95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116882
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-13 14:51:32 +00:00
Paul Berry 29ce9350d3 Migration: add a test case documenting a problem with "is" checks.
See #38340.

Change-Id: If6517cecb9c97796e0ff93ddebfa4afe51b96c0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-12 17:53:26 +00:00
Paul Berry 152fbbb1d9 Migration: add a test case documenting an operator== corner case.
See #38339.

Change-Id: I98bf1f2931d57f5973326abef22f0f3bd3e9f911
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116827
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-12 17:53:26 +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 7e04e051cf Migration: add an option to print just exception nodes rather than full stack traces.
This makes it easier to find a short reproducible test case when
investigating a migration tool exception.

Change-Id: I13adf3e733d5cbbad58c9649420f7fdd072e4bdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115840
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