Commit Graph

1123 Commits

Author SHA1 Message Date
Paul Berry 22b2a35b9f Add failing test for issue #39376
Change-Id: I3dc72f24824c13a54542602fdf4d10055bfec6f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125122
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-11-13 23:10:15 +00:00
Paul Berry 5767cc1bfd Migration: do not use "always" node for dynamic dispatches in EdgeBuilder.
Change-Id: Ic9b62287d11e4adfe14082834fde8bee01624a28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-11-13 23:10:15 +00:00
Paul Berry 8452d2d188 Migration: change behavior of dynamic.
Previously, when the migration engine found a type that was implicitly
or explicitly dynamic, it assumed the type was meant to be nullable.
This seemed reasonable (since, after migration, `dynamic` indeed
allows null), but it caused unnecessary nullabilities to be
propagated.  With this change, the migration engine tracks whether
dynamic types can be nullable or not, just as it does for all other
types.  This cleans up a number of tricky corner cases in the
migration engine that were getting in the way of fixing up uses of
`always` and `never` nodes.

Note that if a `dynamic` type is determined to be non-nullable, it
will still be `dynamic` after migration; this change merely prevents
nullabilities from being needlessly propagated from that dynamic type
to other types.

Note that we still assume `dynamic` is nullable when it occurs in an
already-migrated library or as the result of a dynamic dispatch.

Change-Id: I380d0907f3489d0b84f3fdd7164113daae24274e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125084
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-11-13 23:10:15 +00:00
Konstantin Shcheglov a8e48405dd Share search methods in FindElement and ImportFindElement.
Change-Id: I511c23440fbd95b3a27a50d7b80c66c9a8a7f558
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125125
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-13 22:22:25 +00:00
Paul Berry 8938a5ed2d Migration: make an edge origin for assignments of dynamic.
Change-Id: I75d037aa7ee890488a92e113f58094b5733a9b8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125004
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-13 00:27:32 +00:00
Konstantin Shcheglov c9ef7cc5e3 Deprecate Member.baseElement, use Element.declaration in analyzer.
Change-Id: I91d23558c7d0bd8ffa2e251e5d615d4e026923b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124940
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-12 22:35:07 +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 7c78ab75a5 Migration: allow already-migrated libraries to be opted in.
A core assumption of the migration tool is that the code being
migrated may have some dependencies that have already been migrated
(e.g. the SDK itself).  Of course these dependencies will need to be
analyzed as "opted in" libraries so that they can have nullability
annotations.

However, when the migration tool was first being developed, we didn't
yet have a migrated SDK, so the SDK was opted out and we just had to
pretend that it was opted in.

This CL prepares to switch over to a truly opted-in SDK by updating
the AlreadyMigratedCodeDecorator to handle opted-in code.

Change-Id: I797752401f8c7bf7cdf8d26d03d00d3d213a5127
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124466
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-08 13:53:17 +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 cb0e5c5a3e Set operator== parameter type to dynamic if directly from Object.
See https://github.com/dart-lang/language/issues/569

See https://github.com/dart-lang/sdk/issues/38339

Change-Id: I8d42135985aa4d55ffcc65cdf849572736cb9198
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124284
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-07 20:07:29 +00:00
Brian Wilkerson b647e327aa Fix an assertion to support migration of part files
I'm not sure where the test for this should go. I found it while
migrating vector_math.dart.

Change-Id: I0c1c5ba91375b2a36540f4c270cef6dc9558a745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124103
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-06 20:18:31 +00:00
Mike Fairhurst 335b85fea1 [nnbd_migration] for tool/trial_migration, accept interest argument.
Change-Id: I1a92d2afd0483bbb156b8b9d82817fde36b821c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124204
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-06 19:25:19 +00:00
Konstantin Shcheglov 8119253f64 Include space after comma in FunctionType.toString().
R=brianwilkerson@google.com

Change-Id: I6a30f98c11bc85d2c1afb0d86ba40160e11e85e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-04 19:00:26 +00:00
Konstantin Shcheglov 2438fe10cb Rename BottomTypeImpl to NeverTypeImpl.
The corresponding element is Never, and the spec says "the type Never".

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

Change-Id: Icb6427ef13fa6ee74bd07d5345e68402a1b90b6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123943
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-03 19:03:02 +00:00
Brian Wilkerson 9bffff6dfc Fix exception in migration of ?? operator when the right hand side is a generic type
Change-Id: Ie372522f9493e2ccea8284f8583b0f43153adbbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123884
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-11-01 21:52:48 +00:00
Brian Wilkerson eab70c2673 Visit annotations on classes in EdgeBuilder
This also makes the annotation tracker an instance field rather than a
static field.

Change-Id: I3f636047b7cbddc98536cd10b209e22546d6019b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123694
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-01 15:45:52 +00:00
Johnni Winther 00c2962db8 [cfe+analyzer] Move messages, scanner and parser to package:_fe_analyzer_shared
Change-Id: I4fa87aee65f30a9868a6cf8f0342591869ece7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123663
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 09:37:57 +00:00
Mike Fairhurst 924ec34e01 Remove analysis logger, replace with calls to InstrumentationService
Change-Id: Ifddd58b731aa0af8f76a91261757997dc52a9fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123328
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-31 21:26:44 +00:00
Paul Berry 499815842c Create a package to hold code shared between front_end and analyzer.
Previously such shared code was in the front_end package, but that
created problems because there is a lot of code in front_end that
isn't intended to be shared with the analyzer (including, notably, the
dependency on kernel).

This CL just moves over the flow_analysis logic to the new shared
package.  Follow-up CLs will move over other shared logic and tests.
The end goal is that the analyzer package will no longer have a
dependency on front_end.

Change-Id: I5642d6565204422d79808ca47648462db85e442a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123624
Reviewed-by: Jens Johansen <jensj@google.com>
2019-10-31 13:05:53 +00:00
Paul Berry d50c158d42 Flow analysis: fix analyzer "desugaring" of try/catch/finally statements.
Flow analysis requies the client to desugar a try/catch/finally
statement into a try/catch statement nested inside a try/finally
statement (or, in the analyzer's case, to make calls to flow analysis
as though such a desugaring has been done).  The analyzer was doing
this incorrectly:

- It was always calling the flow analysis methods for try/catch, even
  if there were no catch clauses present.

- When calling tryFinallyStatement_finallyBegin for a
  try/catch/finally statement, it was passing in the node associated
  with the original try block (prior to "desugaring").  It needs to
  pass in the node associated with the desugared try block (which
  includes the catches).

Includes a similar fix in the migration engine.

Fixes #39178.

Change-Id: I16440e71d4964b9905fc2316380c8c98f14b13f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123506
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-30 16:30:04 +00:00
Konstantin Shcheglov 4a07d80178 Deprecate ParameterizedType.typeParameters, update typeArguments doc.
Change-Id: I76c02e026c6c566def4f33478ef18f7df9d1d96e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123323
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-29 17:39:59 +00:00
Paul Berry 780af0fcfc Flow analysis: promote to "types of interest" on assignment.
This allows so-called "ensure guarded" promotions, e.g.
- `if (x is! int) x = 0;`
- `if (x == null) x = 0;`
- `x ??= 0;`

The latter two are particularly important to prepare for NNBD.

Change-Id: Ib53ca916e6d485945326b19e86f8cfb5b3ee2160
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123280
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-29 13:23:59 +00:00
Konstantin Shcheglov 8a7ffc5b81 Make InterfaceTypeImpl.typeArguments final.
Change-Id: I51af8de355dd994005419ccfc593f3f4fbd988cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-28 15:47:27 +00:00
Paul Berry a9fb6b8812 Use TokenType.isIncrementOperator more often.
This is less error prone (and shorter) than checking separately for
PLUS_PLUS and MINUS_MINUS.

Change-Id: I1234d689620ba05dbd878f704a618d5e2e4dea84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123010
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-27 11:09:49 +00:00
Paul Berry 9f25d0e1d8 Flow analysis: don't necessarily clear promotions on assignment.
If the RHS of an assignment is a subtype of the current promoted type
(or one of the previously promoted types), any relevant promotions are
kept.

So for example:

  if (x is int) {
    x = x + 1; // Still an int!
    print(x.isEVen); // ok
  }

This required two significant changes:

- Clients must now tell the flow analysis engine the type of the RHS
  of the assignment.  This required some refactoring in the analyzer,
  because this information wasn't always easily available at the point
  where we were calling flow analysis.

- The flow analysis engine now has to keep track of a "chain" of the
  currently active promotions, so that it can potentially un-do some
  promotions but not others.  This meant that the algorithms for
  "join" and "restrict" had to be reworked.

In a future CL I'll add the ability for assignments to promote to
types that have been previously checked against ("types of interest"),
e.g.:

  if (x is! int) {
    x = 0; // x is now an int!
  }
  // x is now known to be an int because it's promoted in both branches

Change-Id: I63d6c9a2021b045d391b2d9c674e9a2e5f770e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123003
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-26 20:38:28 +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 0167f91012 Flow analysis: introduce ID tests for AssignedVariables.
This should make it easier to verify that the CFE implementation is
correct.

Note that this effort encountered a few bugs in the analyzer
implementation, which are marked with TODOs.  I will fix them in
follow-up CLs.

Change-Id: Ic164a1cf214b5730f848b17db2838c29d25b00d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122850
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-25 13:44:05 +00:00
Paul Berry 696a374b6f Flow analysis: properly handle the fact that ++ and -- are assignments.
Change-Id: Ie54fbf7c7c750457b2750de90c64e8ea32db15d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122730
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 17:57:27 +00:00
Paul Berry 8f5a45c22d Flow analysis: add support for ??=.
Change-Id: I8c99c42cf3a2560d7af3daf27ee316e22a2eb027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122588
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-24 17:57:27 +00:00
Paul Berry b7911e4490 Flow analysis: add support for asserts.
Fixes #38761.

Change-Id: I6cc4adc0383cc56d99fa73ef75f728db0c56063b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122732
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 17:01:33 +00:00
Paul Berry 1bd6e20d76 Flow analysis: simplify the use of AssignedVariables.
Previously, the client was responsible for querying AssignedVariables
to find the variables assigned and captured during constructs like
loops, and passing that information into FlowAnalysis methods.  With
this CL, the client simply passes AssignedVariables into the
FlowAnalysis constructor, and the lookup happens automatically.

Change-Id: Ifbbf8ba8ea0d0f8a31d41244892c8c816eea56dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122731
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-24 13:00:50 +00:00
Paul Berry 92c69f224b Flow analysis: promote on successful execution of an "as" expression.
Change-Id: I506281ab2dfe23b4b75daf795028fec979006932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122586
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 17:02:37 +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 0887806796 Flow analysis: introduce TypeOperations.tryPromoteToType method.
Previously, any attempt to promote type A to type B produced type B if
B was a subtype of A, and failed otherwise.  But in order to support
promotion of type parameters, we need the ability to produce a fresh
"intersection type" (e.g. `T & int`).  The new
`TypeOperations.tryPromoteToType method` makes this possible by giving
the client the opportunity to synthesize the new type when necessary.

Change-Id: If671d5d865f38469a878329180c3a1c94e25a42c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122582
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-23 11:12:21 +00:00
Paul Berry aeede3c1b0 Flow analysis: pass catch variables to tryCatchStatement_catchBegin.
Previously, it was the caller's responsibility to call initialize()
for any variables declared in a catch block.  Now this is done
automatically.

Change-Id: If9c586e12f7d114517476e56e984d16a570648e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122413
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-22 10:56:54 +00:00
Paul Berry 9579c4bc3c Flow analysis: simplify use of isExpression_end.
Previously, it was the caller's responsibility to determine if the
subexpression of an "is" expression was a read of a promotable
variable.  Now, the caller calls isExpression_end regardless of what
the subexpression is, and flow analysis determines whether promotion
should happen or not.

Change-Id: Ibba689935580d4e9c5ab79e5afb534c173386232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122411
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-22 10:56:54 +00:00
Paul Berry d0cef92f05 Migration: refactor logic to match up type parameters between function types.
This logic will need to be re-used in the EdgeBuilder.

Change-Id: I042560683903408936b5cfd0910c90ec965cd70e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122306
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-21 07:29:34 +00:00
Paul Berry 22dbc7d748 Migration: FixBuilder support for function expression invocations.
Change-Id: Iad5740dbdc15d8b78a30a87031ab22cf1c171c8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-20 23:23:24 +00:00
Paul Berry 00dc546586 Migration: make more use of .isNullAware throughout migration engine.
Change-Id: Iffc3f1291574450847402571c36fa7881c84de03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121961
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-17 16:09:30 +00:00
Paul Berry dce3d0591f Migration: Fix three broken FixBuilder unit tests.
These tests were all broken due to incorrect nullabilities in a
generic class method.  The brokenness was masked by issue #38900,
which was fixed in 1b044eec08.

Change-Id: Ib77c437ae147afd10cc46e0685db25ce844bd99b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-17 16:09:30 +00:00
Paul Berry 8eb28a4817 Migration: add simple MethodInvocation support to FixBuilder.
Change-Id: Ice76583076a3f38d1cc0f9a3aacbac630a9a97c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121763
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-17 16:09:30 +00:00
Paul Berry ca9671f34d Migration: add isUpstreamTriggered getter
It would have been very useful in helping to track down
https://github.com/dart-lang/sdk/issues/38341#issuecomment-542892773
to have this information surfaced through the instrumentation output.

Specifically, it would be nice if the user could hover over a type
annotation that was *not* made nullable due to a propagationStep whose
`reason` was `StateChangeReason.upstream`, and see information about
all the edges for which the `sourceNode` corresponds to that type and
`isUpstreamTriggered` returns `true`.  These are, in effect, the edges
that prevented the type from being marked nullable.

(Note that there's another possible reason a type might not be marked
nullable.  It might be that there are no edges for which the
`destinationNode` corresponds to that type and `isTriggered` returns
`true`.  In this case, the node is indeterminate, so the migration
engine left it as non-nullable because there was no need to make it
nullable).

Change-Id: I9b969201b813496d41f3a373454c2659f683178d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121941
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-17 15:52:11 +00:00
Paul Berry c52ac7b114 Migration: ensure that the target of cascade expressions is visited exactly once.
Fixes #38922.

Change-Id: I451b44055f9039a21e4ab50c473573809bb15c2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121905
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-17 02:58:01 +00:00
Konstantin Shcheglov 1b044eec08 Combine nullabilities during substitution.
Bug: https://github.com/dart-lang/sdk/issues/38900
Change-Id: I1bccb87ba863f3c075eacbf6cca499a12d4cb3b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121921
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-10-17 02:47:31 +00:00
Paul Berry a9d0987476 Migration: generalize FixBuilder's representation of changes to be made to the code.
Change-Id: Id17f70778a4e2c7b5410c02ebee59f1f19e5af9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121760
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-16 23:30:16 +00:00
Paul Berry f2dd0465dc Migration: share code for figuring out when an access is null-aware
Change-Id: Id61ebfe16ce277e30a3059f67c250b3a0d9a6b17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121524
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-14 19:44:10 +00:00
Paul Berry cf7e48bec7 Migration: Handle members of Object properly in FixBuilder.
This code is shared with similar code in EdgeBuilder.

Change-Id: I807269a21472be396e7ba42a89f20efa15eca7fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121523
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 19:44:10 +00:00
Paul Berry 7bdbbc4ec4 Fix "unused variable" warning
Change-Id: I425e82b1eb67b76dc56c7c450c9c20f7c6eb4a00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 19:44:10 +00:00
Paul Berry 878458d7b5 Migration: Add FixBuilder support for property accesses and prefixed identifiers.
Change-Id: I15bbcf6674432c50871aecdd1354c58a2174a6fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-14 19:44:10 +00:00