Commit Graph

788 Commits

Author SHA1 Message Date
Mike Fairhurst 0e0bc8e1a6 [nnbd_migration] Save enum index getter in the node builder
Change-Id: I1714244a18471f0ac489a2bf7a4de2e6b5c0c3cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130102
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-03 20:21:49 +00:00
Mike Fairhurst 44e3627f29 [nnbd_migration] Support mixins, specifically super on a mixin.
Change-Id: Ia0d61b8faebfba22933af8d8f902e272b27d4f6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130060
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-01-03 19:21:49 +00:00
Mike Fairhurst 29e89f512d [nnbd_migration] Fix return Bottom from async function.
Change-Id: I4de22568a5540d9796f4668ad3d69dfb2a15109c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129818
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-01-02 21:58:16 +00:00
Mike Fairhurst c89c373e87 [nnbd_migration] handle enum values getter
Change-Id: I268ced7d3a002ff41dc1e75b6a376acb3af88fa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129541
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-01-02 21:18:11 +00:00
Paul Berry 1317212b22 Migration: teach FixBuilder to add the required keyword when necessary.
Change-Id: Ifb20e60f1ea8578bcdcfe503582902734d56b881
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129326
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-12-28 23:50:56 +00:00
Mike Fairhurst 80f4497da7 [nnbd_migration] Handle invokeType on function invocation expression
It also looks like the old clause detecting method invocations on
variables is no longer relevant. Removing it does not fail any tests,
p1g1 packages, or sdk/third_party/pkg/ packages.

Change-Id: Idcab49f00c6b5b38ba5f2ecf3f2a45787c13376a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129817
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-28 23:36:16 +00:00
Mike Fairhurst 1bdd4f69da [nnbd_migration] Visit annotations in field formal parameters
Change-Id: I6bd3bd98cf3571fe101eb4623c11425915da0613
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129809
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-27 21:26:35 +00:00
Mike Fairhurst 52d568a9ea [nnbd_migration] fix crash by composing non-null/type promotion
There were cases where types that are promoted with current type
promotion were not being promoted with improved type promotion due to
null-checks:

```dart
void f(x) {
  if (x == null) {
    return;
  }

  if (x is ...) ...
}
```

This was causing a bad state when trying to substitute type parameters
on methods if promotion usually succeeded.

Fix the crash by allowing migration to promote a non-null type to a new
type, and make that new type an intersection of the new type and
non-null.

```dart
  if (x == null) {
  } else if (x is List<int/*1*/>/*2*/) { // promote to List<int/*1*/>!
```

Change-Id: Icf9f74eb2b3eef887a29d4bfab7556ac126f49e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129540
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-27 19:53:46 +00:00
Paul Berry f525ddeaf3 Add/fix return types to NNBD migration tests.
This will be necessary in order to pass pedantic lints.  See
discussion in https://dart-review.googlesource.com/c/sdk/+/129325.

Change-Id: I61011a082a5401401fa1b7bb0d0bd7aed87a9d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129800
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-27 18:13:15 +00:00
Paul Berry 0456e99838 Migration: add new test files to test_all.dart
Change-Id: Ibcb7644cfc44d558de022f0579b29c96a35c84cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129327
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-27 14:23:15 +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
Paul Berry 20711a29ef Fix return types in fix_aggregator_test.dart.
The test methods in this test file were declared to return `void`, but
a more accurate return type is actually `Future<void>`.

Change-Id: I31e3ab7e2ad9cb81b07a9f8c7cec84fad9f99f80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129325
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-12-26 15:35:59 +00:00
Mike Fairhurst 0eb4af17a1 [nnbd_migration] fix returning null from async fn
Change-Id: I7f13149b9d486f434f9db174f5ec3e0fcfb79dcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-23 23:13:10 +00:00
Mike Fairhurst a9e91396a7 [nnbd_migration] Support enums
Change-Id: Ib15b821691168359d0b31b185b5c7deb7da3c7e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-23 23:13:02 +00:00
Mike Fairhurst 2df7aaa659 [nnbd_migration] Fix method calls on newly promoted types.
Consider:

```dart
List<num> x;
if (x is! List<int>) return;
x.toSet();
```

In this case, `x.toSet()` gets a `targetType` of `List<int>` due to new
promotion. However, the element of `toSet` is `Set<num> Function()`.

We provide the correct `targetType` in `getOrComputeElementType`, with
the correct substitution T/int. However, the resulting element has the
incorrect member substitutions T/num.

It is therefore no longer worth providing the `undecoratedResult`
argument, because it is not the correct answer. The only way to get the
correct answer is to undo the member substitutions, and reapply the new
substitutions. This is what `.substitute` already does. This plus other
CLs to always provide the implicit `this` type, together mean that this
code does everything it needs to.

In case this was done for performance, I timed it A:B, and both took

1:13s to perform trial_migration.sh
Change-Id: Iecf7e6893d56ec96af735814e5c9acb13854f67d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129329
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-23 18:53:50 +00:00
Paul Berry 7a94decac4 Migration: modify FixBuilder to make use of the NodeChange type from FixAggregator.
This will allow FixBuilder and FixAggregator to be integrated together.
I have a branch in which they are integrated, but it is currently
failing some tests due to missing functionality in FixBuilder, so I'll
work on implementing the missing functionality before completing the
migration.

Change-Id: If3fd64665eef8a8373e5679978e3724eee6689da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129306
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-12-22 15:16:16 +00:00
Paul Berry 8ce84595c5 Introduce a FixAggregator.
FixAggregator will form the last stage of the migration engine, taking
the output of FixBuilder (which is a map from AST nodes to individual
changes) and feeding it into the EditPlan infrastructure to produce
the complete set of edits for any given file.

In a follow-up CL, I will modify FixBuilder to make use of the
NodeChange classes defined here.

Change-Id: I73fd67d7e989194049d91f978a7d9134814d3265
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129304
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-12-22 15:16:16 +00:00
Paul Berry 4c2f3669b2 Introduce EditPlan, a builder class for creating source edits with automatic parenthesis management.
Initially this will be used in the NNBD migration engine to produce
migration output.  Assuming it proves useful, in a future CL I'd like
to consider moving it to the analyzer_plugin package and using it as a
basic for all of the analysis server's refactorings.

Change-Id: I41ffc578ace3945fcfebb8eb824b6b5706dfba6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129302
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-12-20 22:43:54 +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
Mike Fairhurst 43f74824c2 [nnbd_migration] Substitute type parameters for implicit super
Change-Id: Icfe46c4cc0950cafef07e8448f82985c04ce20ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129260
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-20 18:18:51 +00:00
Mike Fairhurst 4681868aaf [nnbd_migration] Fix TypeParameterType asInstanceOf where valid.
Change-Id: I033b378d0e87ead2bacad27d71a0c696904d8e15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128985
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-20 02:05:49 +00:00
Mike Fairhurst 6efbe7f3ce [nnbd_migration] Handle downcasting type arguments.
There are no examples of a downcast involving a nullable type in the
current set of working packages. This tells me that it's rare, and that
this behavior should be good enough.

If we're wrong, this unblocks packages and we can revisit this decision
later.

Change-Id: Ic4e23cc6a848b83b2d1fb6c97ff513c3cc9fdb2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128778
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-18 20:02:56 +00:00
Paul Berry e87c625fbe Migration: Re-architect FixBuilder to use the analyzer resolver.
This CL establishes the scaffolding for the new FixBuilder
architecture, and gets most of the previous tests to pass.

Several TODOs remain, which I plan to address in future CLs, however I
want to get the FixBuilder running end-to-end before doing so, so I
will work on that next.

Change-Id: Ic68b04c70b6cb8c72d04f00f9a027c3498f3acbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128562
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-12-18 19:22:46 +00:00
Mike Fairhurst a4e3bcbe42 [nnbd_migration] Fix assertion failure in _forTypeParameterSubstitution when not fresh
Change-Id: I1f372f5dd4925e58a4803a20680c052c553c4dc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128304
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-16 22:24:33 +00:00
Mike Fairhurst b3194cab7d [nnbd_migration] handle downcast from Function to a function type
Change-Id: I8a574aed910951dcd35ec1d4e74018dcfc2b24c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-12-16 18:58:53 +00:00
Mike Fairhurst 1c07a828e8 [nnbd_migration] Handle downcast from dynamic to function types
Change-Id: Ic47165217778f1ff8c9375cdd40e9daecc0099f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128284
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-16 18:58:53 +00:00
Paul Berry 1befb89903 Migration: Modify FixBuilder tests in preparation for rewrite.
In an upcoming CL, I will be replacing the FixBuilder with an
implementation that re-uses resolution logic from the analyzer.  Due
to complexities with the analyzer's scope management, it won't be as
easy to test individual visit methods in isolation anymore, so this CL
modifies the FixBuilder tests so that they each visit an entire
compilation unit rather than just one or two AST nodes; this will
allow landing the rewritten FixBuilder without making further
significant test changes.

Note that in order to land this CL I had to had some temporary hacks
to the FixBuilder so that it could visit top level constructs
correctly.  These hacks will go away when the rewritten FixBuilder is
landed.

Change-Id: Iffaaaa382070aa87c368e6fcc28034030a34b4ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128484
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-12-16 14:12:01 +00:00
Mike Fairhurst 80467ce51e [nnbd_migration] Return simple LUB node for LUB(T, T) for type parameter type T
Change-Id: I3e70a5a9f5e43210fdc70f91e936014a0ad04fa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128221
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-12-12 21:13:31 +00:00
Mike Fairhurst 9d2ea5a5f6 [nnbd_migration] handle LUB(A<T>, B<T>)
Change-Id: I24dd44537cddc4cb04c9d9f7b198b132b2a44381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128220
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-12 21:13:31 +00:00
Mike Fairhurst 10f7cb4e32 [nnbd_migration] handle LUB(null, T) for type parameters
Change-Id: I6ea65366f5c6003d486d794aaf161ff65adbf04f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-12 21:13:31 +00:00
Mike Fairhurst f4055b59a9 [nnbd_migration] Handle LUB(null, Function)
Change-Id: I5fe091d35cc53dd244f76c911a6a76873298662e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128084
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-12 21:07:01 +00:00
Mike Fairhurst be2df7d600 [nnbd_migration] Assert GLB(null, S) cannot produce C<T>
Change-Id: Ifc213a1761a0d46f2b8eb326c0c8963d1160aa56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128083
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-12 21:07:01 +00:00
Mike Fairhurst def408b24a [nnbd_migration] Handle LUB(null, C<A, B, ..., Z>)
Fixes #39269

Change-Id: I43961b13a2ec4b3409d97123afae5df37af8e137
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128082
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-12 21:07:01 +00:00
Sam Rawlins dbb56e5e10 Connect g/setters which override fields (w/ implicit g/setters)
Change-Id: I4eeb507e23962fbf53f1026e14f4e2ae607aa7e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128105
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-12-12 01:44:43 +00:00
Sam Rawlins 108a80bd0d NNBD: Mark some good tests as passing; add FailingTests for some GitHub issues
Change-Id: Ia5a55b5c6f1e7d7c7bef32c0afecf689952e17eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127761
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-12-09 22:17:44 +00:00
Sam Rawlins 1aeff32c14 NNBD migrator: record type information in TypeName type arguments
This prevents the following crash:

Bad state: Missing declarated type annotation in /home/test/lib/test.dart; for Object
  package:nnbd_migration/src/variables.dart 68:7                      Variables.decoratedTypeAnnotation
  package:nnbd_migration/src/edge_builder.dart 1378:26                EdgeBuilder.visitTypeName
  package:analyzer/src/dart/ast/ast.dart 10012:49                     TypeNameImpl.accept
  package:nnbd_migration/src/edge_builder.dart 844:10                 EdgeBuilder.visitIsExpression
  package:analyzer/src/dart/ast/ast.dart 6372:49                      IsExpressionImpl.accept

Change-Id: I23ed49ccbd3625d9f9fbc7e07a69be3c580896ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127457
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-09 20:50:23 +00:00
Sam Rawlins 991e55f6ad NNBD Migrator: Fix generic super initializers
Change-Id: Icc78a248791881a97f5221ee2b5edf6314266225
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127542
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-12-09 19:53:11 +00:00
Sam Rawlins 41d8b9ee63 NNBD Migrator: Handle super redirecting initializers
Change-Id: I52043caaad81a89fe12cc554c32d1b0943d37b27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127420
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-05 22:59:50 +00:00
Sam Rawlins 7ac3f3e904 NNBD migrator: Visit metadata on top-level functions
Change-Id: I6825f03ca754e05a6a8a7d4a9d3c13d9baa5ddaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127400
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-12-05 22:13:49 +00:00
Paul Berry 18a9b29687 Add a repro for issue #39609
Bug: https://github.com/dart-lang/sdk/issues/39609
Change-Id: I998148779fad6217a85282dbee8a2b9a0eecba80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126902
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-12-02 21:22:26 +00:00
Mike Fairhurst dc3af706e9 [nnbd_migration] assume non-nullability in is check
This fixes the problem with inferring E? in package:typed_data.

Change-Id: I376204e3f82f0d6054a2c78b502fd240db48798d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-11-26 22:37:20 +00:00
Mike Fairhurst 0019bf646b [migration] handle side casts, assume non-null with const guard.
Fixes the only exception package:typed_data!

Change-Id: I130fe63d7e31019ad38a30a681505e88822af443
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126087
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-11-25 21:28:55 +00:00
Paul Berry f2b7af83e7 Migration: eliminate some explicit uses of always/never nodes from node_builder.dart.
Change-Id: I40a23b907016dca537073834e4ec1280c8acaf2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125931
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-22 15:17:54 +00:00
Konstantin Shcheglov f3455278ff Use 'isNonNullableByDefault' flag in TypeProviderImpl.
Instead of giving it the NullabilitySuffix, for consistency with
TypeSystemImpl.

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

Change-Id: I16d1ca32071b8a28a31e207afed604f8d4b24a2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-21 21:43:56 +00:00
Konstantin Shcheglov b370346d60 Add 'isNonNullableByDefault' flag to TypeSystemImpl, make all parameters named required.
R=brianwilkerson@google.com

Change-Id: I262f86ba964f4970ec570dc9fa4c1a802556fa63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125924
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-21 15:37:46 +00:00
Paul Berry 6fa41ae6f9 Migration: remove _notNull* fields from EdgeBuilder.
We want to create a separate nullability node for each non-nullable
node so that instrumentation can explain to the user where it came
from.

Change-Id: Id51a3366284e8c51c466458c1c14de963cd0bd05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125551
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-21 15:19:15 +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
Sam Rawlins ed971fd0c7 NNBD migrator: Add Locations for each edit made in an NN fix
Change-Id: I53342cb43910deea2f59f37d5795ddbb70cb6b0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125480
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-18 20:40:25 +00:00
Mike Fairhurst e34e734b56 [nnbd_migration] track causations for substitution nodes
Change-Id: I7da4f2923d9b99b0bd6c16644a7adeaeda437340
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125463
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-18 18:49:39 +00:00