Commit Graph

1123 Commits

Author SHA1 Message Date
Mike Fairhurst e9df1ee07a [nnbd_migration] Add an edge origin for inferred parameter substitution
Change-Id: I37ce933e05a6b7ad7b8fdcc26f44968ae92516be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137658
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst 42d0c8245d [nnbd_migration] Add edge origin for explicit instantiation params
Change-Id: I9feebb693d8e97027019b5ff2e936ce0fd69bd3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137655
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst 18814410a4 [nnbd_migration] Record edge origin for explicit call parameters
Change-Id: I33ccf611d1998478c84c4b3e0576ab2e3db906bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137651
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst 734ad9c00c [nnbd_migration] Add an edge origin for type name parameters.
Change-Id: Ifad0a0ae6e641360ac5be5eea5c61e667be33cbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137432
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Konstantin Shcheglov c9884ccf52 Analyze SDK with non-nullable experiment enabled, update MockSdk.
Initial:  https://dart-review.googlesource.com/c/sdk/+/134401
Reverted: https://dart-review.googlesource.com/c/sdk/+/134802

Internal presubmit is green.
https://test.corp.google.com/ui#id=OCL:294345942:BASE:297377939:1582738004318:fb4ae9fe

Change-Id: I25e6445bd0241a89850dff3d88ece0edd768053a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-26 21:08:21 +00:00
Janice Collins 31053a8c01 Add analyzer run support to steamroller and minor QOL improvements.
Change-Id: I4ffadba54e5d1485307c9b98858d80f5bdbcccf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136854
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-26 16:57:46 +00:00
Paul Berry 85f6d51c3f Migration: infer nullability for uninitialized toplevel vars and static fields.
Fixes https://github.com/dart-lang/sdk/issues/40700.

Change-Id: I4b33b65961bf9c06c6ae68691f9e337dcee2af66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136901
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-25 16:21:21 +00:00
Paul Berry 6a165950f5 Migration: do not allow RHS of a typedef to be marked as nullable.
We should consider the nullability of the right hand side of a typedef
to be "never", since a `?` is not allowed on there.  Instead, we
should allow each use of a typedef to have its own independent
nullability.

Fixes a bug wherein we would erroneously migrate code like this:

  typedef F<T> = int Function(T);
  F<String> f = null;

Into the following:

  typedef F<T> = int Function(T)?;
  F<String>? f = null;

(Note the bogus `?` after `int Function(T)`).

Change-Id: I8535645303fc644c73617684b8bb3488462589ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136900
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-25 16:21:21 +00:00
Paul Berry da22aa9910 Migration: additional postmortem support.
This CL adds the following functionality to the migration postmortem
utility:

- The "steps" subcommand now prints both upstream and downstream
  migration steps (previously it only printed downstream steps).

- The "files" subcommand lists all input files for which at least one
  decorated type was stored.

- The "decorations" subcommand lists all the decorated types for a
  given input file.

- The "node" subcommand shows details about a single node, including
  any edges connected to it.

Change-Id: I034f13ffd7efa340e1cc50bf9039372f78da5027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136840
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-25 16:21:21 +00:00
Paul Berry 430f56b5bf Migration: test that hard edges aren't created for assigned variables (currently failing).
Bug: https://github.com/dart-lang/sdk/issues/40728
Change-Id: I965395ccce11f1114f7498cc5f9d88313b089e9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136800
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-25 16:14:51 +00:00
Janice Collins 4c93115390 Upgrade steamroll_ecosystem to handle all hacks and run dartfix
end to end.

Change-Id: Idef5a99483abc79469c543435ea44289c000080a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135720
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-24 22:44:19 +00:00
Paul Berry 7911b6a989 Migration: fix handling of part files.
This CL fixes several minor bugs:

- In info_builder.dart, we were trying to apply SourceInformation from
  the defining library to all its parts.

- In NnbdMigrationTestBase, we were trying to fully migrate each file
  before processing any other files.  We need to prepare each input,
  then process each input, then finalize each input.

- In NodeBuilder, we were failing to send part file sources to
  NullabilityGraph.migrating().  As a result, methods declared in part
  files were being treated as already migrated, so they were getting
  the wrong kinds of nullability nodes.

- In _ProvisionalApiTestBase, we were sometimes visiting parts before
  discovering what libraries they were part of, causing inconsistent
  resolution results.

I'm hoping this will be sufficient to address
https://github.com/dart-lang/sdk/issues/40670.

Change-Id: I07d693b31b6cf64bc6f72126f5ef4792b29e5029
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136521
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-20 19:55:18 +00:00
Paul Berry fa38644450 Migration: handle dead code removal in awkward places.
Usually when migration removes dead code it can just delete it
(e.g. because it's removing a statement from a block and blocks can
contain any number of statements).  However, in certain contexts dead
code must be replaced with something else, such as an empty statement.

Change-Id: I65faf017897215d750395dc78a2bf8a157d8dce0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136441
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-19 17:39:44 +00:00
Paul Berry 2fa27b5d57 Introduce a "postmortem output" for nullability migration.
The postmortem output is currently only generated if the static
constant NullabilityMigrationImpl._postmortemPath is non-null.  The
generated file can be analyzed using
pkg/nnbd_migration/tool/postmortem.dart.

Change-Id: Ic5bf7aecc4176306839c00237eed668c2cd42571
Bug: https://github.com/dart-lang/sdk/issues/40624
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136003
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-19 16:44:40 +00:00
Mike Fairhurst c11c0ae3fd [nnbd_migration] Remove personal test file
Change-Id: If9f43600567793e5203dc3a5dd6be0d4172daf8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136303
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-02-18 23:12:49 +00:00
Konstantin Shcheglov cef02fff52 Merge Dart2TypeSystem into TypeSystemImpl.
Just mechanical movement of methods.

Change-Id: Ieb62190d2d531652b50cd233145f3dea22c00d97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136302
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-18 22:37:35 +00:00
Mike Fairhurst 5e341835bc [nnbd_migration] Fix stack overflow on missing element decorated type.
This was causing 9k exceptions and slowing the flutter migration from
2:40 to 14:40.

There are 52 elements that don't get a decorated type in flutter due to
the abnormal usage of part files for the animated icons test.

The re-resolution stage of fixbuilder would then try to get the
finalType of these elements, but no decorated type for them exists, so
it would throw this exception. However, since the throw expression
stringifys the element, the element would go back to the hooks that try
to turn it into a finalType, which results in the same failure, until a
stack overflow.

Change-Id: Ib4c4746728e8bc6e583e133e91dcc0ba83e1b911
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136040
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-02-15 00:34:10 +00:00
Mike Fairhurst 9fbfe31f7c [nnbd_migration] Add tests for important real-world exact nullable case
Add tests verifying #40590 so that we don't regress it.

Change-Id: I74105cc1e6a33b75d7ff67dc07b7cc913040dc8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135840
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-02-14 21:48:22 +00:00
Mike Fairhurst f825e7aa11 [nnbd_migration] Add tests for uncheckable+functions, #40625
Tests currently pass, so we can close that bug. However, if for some
reason it becomes an issue such that these tests fail, they will link to
a bug with detailed info on a potential cause.

Bug: 40625
Change-Id: I212eb5401622a189de4998247b0ff521077e30e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135763
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-14 21:48:22 +00:00
Mike Fairhurst 0216ac8558 [nnbd_migration] Fix crash aggregating fixes on cascade property target
The target of a property access can be null if it is a cascade. If that
access is then modified, fix aggregator gets a NPE. This issue is not
true for index & method calls, same fix applies.

Change-Id: I98eac3c8f7eba5300b30ff366ee227430726440c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135963
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-02-14 21:45:47 +00:00
Paul Berry d5e6ab4195 Migration: propagate non-null intent through compound nodes.
A compound node represents a logical OR ("this node is nullable if and
only if one or more of its components is nullable").  Therefore, if
*all* of the components of a compound node have non-null intent, we
should consider the compound node itself to have non-null intent.
This fixes a problem that was preventing the migration tool from
respecting a "/*!*/" hint applied to the type parameter of a typedef.

Change-Id: Iec2f9d6968378707ba692be7b97f750cf53a8b85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135786
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-14 21:25:01 +00:00
Konstantin Shcheglov 6ae2a011d5 Use named parameters in TypeParameterTypeImpl.
Change-Id: I643acc61f53dfaf2e0c9bec7970fa6c33ff26850
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135964
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-14 21:19:26 +00:00
Mike Fairhurst 89db9ec241 [nnbd_migration] Only propagate exact nullability over uncheckable edges
Bug: 40551, 40552
Change-Id: Ib62dd2d9d1685956e3bf6f63a318888f3cd43904
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135762
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-02-14 18:57:47 +00:00
Mike Fairhurst ffc3cd6e29 [nnbd_migration] Type arguments should get uncheckable edges
Change-Id: I5940fc80e8e7f1af5e1febf7ca4f95dd6178f149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135629
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-14 18:57:47 +00:00
Paul Berry 4bde1f1851 Migration: test to make sure exact nullability isn't applied too much.
This is a regression test that would have caught the mistake in
https://dart-review.googlesource.com/c/sdk/+/135351 (see that CL for
additional details).

Change-Id: Ideaf83df6deae3f6688fc89cfd8b3568344c5d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135660
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-13 20:23:18 +00:00
Janice Collins e0e438bf8b Implement analysis options modification.
Change-Id: I899067652bf00b3273559b59969d6b7c30883900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135343
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-11 20:14:06 +00:00
Janice Collins 96794c5aae Fix windows bot failure due to missing path conversion.
Change-Id: I1bf12360ee3e45b89ccc4f045151f037450df093
Bug: https://github.com/dart-lang/sdk/issues/40570
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135180
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
2020-02-10 21:17:36 +00:00
Paul Berry 63b5d2b053 Migration: Allow null info when introducing as.
Usually we have good information from the nullability graph about why
we need to insert a cast, but sometimes we don't.  For example, when a
cast needs to be inserted because NNBD doesn't allow implicit
downcasts, we often can't give any additional information beyond "a
cast is needed here now".

We allow info to be null in these cases to avoid an assertion failure.

Fixes https://github.com/dart-lang/sdk/issues/40533.

Change-Id: I7639374f92820faf04bda2aeda96d0e38f07e8d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135161
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-10 20:19:54 +00:00
Paul Berry a017944035 Migration: fix hard crash in trial_migration when migrating package:async.
There were two problems:

1. An info object isn't being properly passed to
   NodeChangeForExpression, causing an assertion failure during the
   FixAggregator stage.  I've modified the assertion check so that it
   happens earlier, during the FixBuilder, so that the exception is
   caught by permissive mode logic and doesn't cause a hard crash.
   I'll work on fixing the assertion in a follow-up CL.

2. The hack described in https://github.com/dart-lang/sdk/issues/40536
   was causing a bogus assertion failure in
   _PassThroughBuilderImpl._checkParenLogic.  I've weakened the
   assertion slightly so that for now, the hack won't cause trouble.
   See the issue for more information about what's happening--this
   should be cleaned up eventually but it's probably not high
   priority.

Bug: https://github.com/dart-lang/sdk/issues/40533
Change-Id: Iee832fbd07e54b02d2c52f79a097ff9d973cda9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134980
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-02-10 20:19:54 +00:00
Paul Berry 1554a119ed Migration: add explicit parameter types to function literals when necessary.
Under NNBD rules, certain function literals have their types inferred
as `Object?` instead of `dynamic`.  We need to add explicit `dynamic`
to prevent follow-on errors if those parameters are used in a dynamic
fashion.

Change-Id: I12bfd3a3da2bda1ae11b01a5d029dbea3d512cb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134567
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-07 23:07:27 +00:00
Konstantin Shcheglov 6f6797e745 Add NullSafetyUnderstandingFlag, update APIs to use it.
DartType.== implementations ignore nullability if the flag is not true.

TypeSystem APIs eliminate nullability from types before doing anything.

Internally analyzer continues using actual nullability for types.

Package nnbd_migration opted into NullSafetyUnderstandingFlag.

Bug: https://github.com/dart-lang/sdk/issues/40500
Change-Id: Ifeea28c01adf1dc59ed2da675b4a62c6334d529a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134865
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-07 21:38:06 +00:00
Janice Collins 7869bc39c6 Steel thread through fantasyland.
This includes a mostly feature-identical version of tool/migrate_ecosystem.sh, written in Dart.


Bug: https://github.com/dart-lang/sdk/issues/40280

Change-Id: Ib3fe2f353208038ac6c3f035fcdb17f638c68e49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134786
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2020-02-07 20:27:16 +00:00
Konstantin Shcheglov 1f47e5b23d Revert "Analyze SDK with non-nullable experiment enabled, update MockSdk."
This reverts commit 545b80ef0e.

Reason for revert: this is a breaking change for MockSdk users, actually much more serious issue for un-forking SDK. https://github.com/dart-lang/sdk/issues/40500

Original change's description:
> Analyze SDK with non-nullable experiment enabled, update MockSdk.
> 
> Change-Id: I80264a6533045c33ed794a5938f6719f3b5a6d0b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134401
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

TBR=paulberry@google.com,scheglov@google.com,brianwilkerson@google.com

Change-Id: If8c3d8322986b01012fa76f9c928f35309c00e3e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-06 22:55:29 +00:00
Konstantin Shcheglov 545b80ef0e Analyze SDK with non-nullable experiment enabled, update MockSdk.
Change-Id: I80264a6533045c33ed794a5938f6719f3b5a6d0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-06 18:04:02 +00:00
Janice Collins eba2741166 Use analyzer filesystem implementation.
Change-Id: I071945c0f04c14474758b94f3ca560a2fbf7d2a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134543
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-02-05 22:33:19 +00:00
Paul Berry c9b66b222e Migration: propagate non-null intent into function literals.
Previously, if a function literal was used in a context where a
function returning non-null was expected, but the function literal
might return null, the migration tool inserted a cast that was
guaranteed to fail.  Now it propagates non-null intent into the
function literal, so that the appropriate null checks happen inside
the function literal.

Change-Id: Ia62d18bc3b9955e84b09b846ea913607b305677d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134504
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-05 21:35:19 +00:00
Paul Berry fecab44f59 Migration: Improve the tracking of type parameter bounds.
This CL extends ElementTypeProvider so that it also tracks type
parameter bounds.  This allows the FixBuilder to reason correctly
about the what generic function types will look like after migration,
and that in turn prevents it from trying to add unnecessary casts.

Change-Id: I3c909a3b5ba14bf9f2aad4e58d0981c1b7b5bdd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134412
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-05 20:51:49 +00:00
Paul Berry 4df17ee697 Migration: clean up how decorated type parameter bounds are tracked.
We now track decorated type parameter bounds similarly to how we track
ordinary type parameter bounds in the FixBuilder, by having a single
static instance of a DecoratedTypeParameterBounds class that keeps
track of the mapping.

Change-Id: I49196e8a506ca8765857b3d47a355b7aaaa1918e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134411
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-02-05 20:51:49 +00:00
Janice Collins b59d3974d1 Consolidate dependency injection and set up FantasyWorkspace tests.
Change-Id: I25a3d6a3a0b94c2918cf77f41f1ceece903506e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134400
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2020-02-05 16:24:54 +00:00
Konstantin Shcheglov d025cd9378 Use DartType.getDisplayString() instead of toString().
Change-Id: Ibe5aa728058778bee42a1d87f4788da573a87d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134462
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-05 07:33:19 +00:00
Paul Berry 655fcda015 Migration: rework how ElementTypeProvider overrides element types.
Previously, each piece of analyzer code needed during the FixBuilder
stage of migration needed to use the ElementTypeProvider interface to
access element types (rather than reading the types from the elements
directly), in order to ensure that the proper post-migration types
were used when building fixes.  This required a lot of plumbing, and
there was a high risk that we would accidentally fail to use the
indirection mechanism in a key location and access the elements
directly.

This CL changes the approach so that the ElementImpl classes
themselves are responsible for indirecting through
ElementTypeProvider.  This means that we can back out all the
plumbing, and there is no risk of accidentally failing to use the
indirection mechanism.

Change-Id: Ic1a0acc37f0350fc13b487f73fc1ad5225d7a090
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-04 22:29:20 +00:00
Janice Collins e402fc4a22 Do not require --enable-asserts for test_assertOnPathOutsidePackage.
There is a handy annotation designed just for this purpose.

Change-Id: I4a1e5e6320f6f3dd940ad43fc698a6ee41e6b44b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134249
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
2020-02-04 21:32:28 +00:00
Konstantin Shcheglov 05dcf371e7 Remove 'withNullability' from TypeImpl.toString()
Bug: https://github.com/dart-lang/sdk/issues/40460
Change-Id: Icd967df0252a9fd7ff9941ca7158b7df0190c961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134384
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-04 21:19:06 +00:00
Janice Collins 1d932f7450 Add a 'run' feature to MultiFutureTracker.
This makes a certain idiom using MultiFutureTracker more compact,
namely blocking on the completion of the closure.

Change-Id: I8872ce882da0b20775c416895047cc18abd2801a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134248
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2020-02-04 18:57:18 +00:00
Paul Berry b01eb17669 Migration: remove test file containing no tests
Change-Id: Ib15940732ccd9e4f36de12cbe10a2ce631a4a24c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134145
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-03 23:10:21 +00:00
Paul Berry a97c23b939 Migration: plumb ElementTypeProvider through FlowAnalysisVisitor.
This ensures that when type promotion happens while running the fix
builder, the promoted types are the correct post-migration types.

Change-Id: I15fe2cd8a6399527ded782dbbf252f9aeb530827
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134083
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-03 19:59:38 +00:00
Paul Berry e989e90346 Migration: avoid ambiguities when adding a cast after a function expression.
When adding a cast to a function expression like `() => null`, we need
to add parentheses, so that we produce `(() => null) as Type`, rather
than `() => null as Type`, which makes the cast appear to apply to the
function body expression.

Change-Id: Ib5ae93df5b840a832c10941e47fa092a4f764eea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134044
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-03 19:59:38 +00:00
Paul Berry 763ce812ea Migration: properly handle type parameter types with nullable bounds.
This required adding logic to the `TypeParameterType` case of the
`toFinalType` function, so that we look up the decorated type of the
type parameter bound, and convert it to a final type as well.
(Previously we were just using the bound stored in the element model,
which was in many cases the bounds from prior to migration, and hence
it was a `*` type so it behaved as though it was non-nullable).

This required moving `toFinalType` into the `Variables` class so that
it could look up the decorated types of type parameter bounds.

Fixes #40355.

Change-Id: I53c2636aef6954500589e924b9755a297c2b30f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134061
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-02-03 19:59:38 +00:00
Janice Collins bd2e6adb74 Implement FantasySubPackage.
Also splits FantasyRepo into FantasyRepoImpl and an abstract class,
and unifies some of the filesystem mocking in a helper class.

Change-Id: Idb9ac7bf13238116448a46f551236e41cda83471
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134121
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-03 16:55:25 +00:00
Paul Berry aa5a5ff5a8 Migration: Improvements to graph debug output.
Two minor fixes:

- Ensure that the immutable nodes `always` and `never` are always
  drawn with the `shape=none` attribute.  (Previously, the first time
  we encountered an immutable node we would draw it in the style of a
  mutable node, which made things very confusing).

- Add a space before `style=filled` in the graphviz output.
  Previously we would output things like
  `n21 [label="type(13) (ordinary nullable)"style=filled]`,
  which graphviz seems to do ok with but seems inadvisable.

Change-Id: Iefcb4005c9bb2e24ae8d80552e5e4a23ec062c56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133868
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-01-30 21:33:12 +00:00