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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>