Commit Graph

1123 Commits

Author SHA1 Message Date
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
Janice Collins e03aeada28 Fix working directory problem shown in demo.
Change-Id: Iddbdc312d297cbd14c5499976a12ed87ca39594a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127982
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-12-10 21:13:26 +00:00
Janice Collins 28b0f18397 Add basic git package management to trial_migration.
- New flag: --clean will throw away the local playground at the beginning of the run
- New flag: --exception_node_only prints only the exception node
- New flag: -g allows fetching git repositories into a local playground
- New flag: -u automatically updates Git repositories with git pull

Change-Id: If8472cb9bb97b42fe649d6ec168850c740f84d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127702
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2019-12-10 17:51:55 +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
Janice Collins 42799b66b6 Add support for unmanaged packages to trial_migration.
Change-Id: I01fbfa251f8b7fdcaec90102b603641bf573c107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127501
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-12-09 17:28:47 +00:00
Janice Collins dfa32032fd Add scaffolding to trial_migration for more package sources.
Imports a subprocess helper with JSON parsing borrowed from Dartdoc,
which will come in handy both for launching pub and for building the
trial migration script out for comparing output between versions.

Also puts some basic structure in to allow for fetching packages for
multiple sources.

Change-Id: I5262b93aa1d60005ee262b7ed00bf534b1c51447
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127446
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-12-06 18:01:51 +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
Janice Collins 7fcff7e87f Allow passing the sdk root for analysis to trial_migration.
Also redirects usage warnings to stderr, adds --help, and verifies that the sdk
you pass in actually supports NNBD.

Change-Id: Ia758f69648f88108b3c0df9de46ab246d3db0c9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127202
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2019-12-05 18:43:19 +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
Mike Fairhurst b19436061d [migration] enable typed data in migration -- fatal exception is gone.
Change-Id: Ic32fb4cc194da01055286dcf6b02d56efb8501e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126121
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-11-25 20:02:35 +00:00
Konstantin Shcheglov 6294c73f3e Deprecate 'typeSystem' parameter for InheritanceManager3.
Change-Id: If14eb8900b0fb5cac5e49cf865f2e6e3a0a0263d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126083
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-22 23:08:41 +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 dcaf959589 Fix several unused elements, and unnecessary casts.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I81559cb241c0ca6918f6730538f44a7411907867
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125986
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-21 21:37:52 +00:00
Sam Rawlins 535cbf5db9 NNBD preview: Text for return type with nullable return type in subclass
Change-Id: Ia829b3f8cb7f09b10180478394608a05cdcdbb6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125984
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-11-21 21:07:25 +00:00
Paul Berry 1fb118f0e7 Migration: do not call FlowAnalysis.finish from inside a finally block
FlowAnalysis.finish checks the proper nesting of begin/end calls to
flow analysis, but such nesting might not hold in the presence of
exceptions.  As a result, if we call FlowAnalysis.finish from inside a
finally block, we may report an error due to the lack of proper
nesting, and lose the original cause of the exception.

In these exceptional circumstances, it is better to allow the original
cause of the exception to propagate to error reporting, since its
stacktrace will be closest to the site of the bug, rather than to have
it replaced by the error from finish().

Change-Id: I58b1bd4882362ff1e23c03dc8ba65e39655fc98f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-11-21 18:59:05 +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 4ce204d16a Migration: remove unused variable
Change-Id: I0c699bc8723a6eda395b5bf787aca91bd9f7004f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125769
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-20 23:04:22 +00:00
Paul Berry 97e432a5bc Migration: refactor _checkExpressionNotNull.
Previously this was based on creating a dummy type pointing to `never`
and then trying to assign to it.  Since we are trying to get rid of
explicit references to `never` outside of the graph logic, that isn't
going to work anymore.  Refactor to just create the correct edge
directly using NullabilityGraph.makeNonNullable.

Change-Id: I18683bfe5e02924d2ccfcb0459047568734f975d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-20 23:04:22 +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
Paul Berry f69935b107 Migration: stop creating union edges for inferred types.
Fixes #38341.

Change-Id: I77e6bebc28ca917a13e5fd9958f5a7b3e0284834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125448
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-18 17:14:23 +00:00
Paul Berry 33c95a8508 Migration: account for definite assignment.
Fixes #38344.

Change-Id: I64d17fe1e571fc708632c0e48b6556e2094a91e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125443
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-15 22:38:36 +00:00
Sam Rawlins 15e5c23167 nnbd preview tool: Better text when inserting 'required'
Helps with #39247

Change-Id: I3bb7b25c73d58fc49260d6e3019b58b2f3f6b80a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125440
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-15 22:20:16 +00:00
Paul Berry 249a9172f7 Migration: don't mark fields as nullable due to factory and redirecting constructors.
Change-Id: I4b60a2bea125089d86e2368b3e674adf5ef402aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-15 21:08:06 +00:00
Mike Fairhurst a6635d006b [nnbd_migration] Show "exact nullability" in output directory.
Change-Id: I29545fe358282aa05dee10ed7ff5e86ea899581e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125222
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-15 18:27:24 +00:00
Paul Berry bd43ef8144 Migration: stop using "never" for the result type of an "is" check
Change-Id: I02b80817e46e0544b38dceb7b8a3f92aebede1d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125229
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-15 02:02:35 +00:00
Paul Berry 9cb0b678ce Migration: remove more explicit uses of never from EdgeBuilder.
With this change, we no longer use the "never" graph node for:

- instance creations

- explicit references to `this` or `super`

- the static type of `throw` and `rethrow` expressions

Change-Id: I995be86ee0f4d8002c70cf98e7e5d2767529d00b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125226
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-15 02:02:35 +00:00
Paul Berry ad4b93da9e Migration: stop using the "never" node for the type of literals.
Change-Id: I4195dd989d295dc9a468ada0e643c9a971f3a9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125223
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-14 18:25:29 +00:00
Paul Berry eeb89b2e5b Migration: ensure that uninitialized fields are nullable.
Change-Id: I1dc0a2c80ea52566aa4eb6b5e9ce745ad635d517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125220
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-14 17:03:07 +00:00
Paul Berry a2894e7864 Migration: make use of _graph.make(Non)?Nullable in EdgeBuilder.
This eliminates a few direct references to `always` and `never` nodes
from the edge builder.  It also fixes a latent bug where we were
failing to create a hard edge when handling "is" expressions.

Change-Id: I4c88432c97932eac3554cfcb75bbd634c0e2e4c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-14 16:56:06 +00:00
Paul Berry fc7f084a00 Migration: stop using always/never for inaccessible getter/setter types.
When migrating a reference to a field or top level variable, we have
to create a temporary type to represent the synthetic getter or setter
that is being referenced.  That requires creating some new nullability
nodes, to represent (a) the `void` return type of the setter, and (b)
the function type of either the setter or the getter.  These nodes
never actually get attached to the nullability graph (because a call
to a getter/setter can't access the function type, or the return type
of the setter), so it doesn't really matter what nodes we use.

This change switches to using fresh nullability nodes rather than
always and never for these inaccessible types.  This takes us one step
closer to eliminating the use of always and never outside of the
implementation of the nullability graph itself.

Change-Id: I33de35ba36bbca42731c5e2d827ccf972cd368dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124911
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-11-14 16:56:06 +00:00
Paul Berry 7735bf3c29 Migration: remove unnecessary recursive calls from _checkDowncast.
These recursive calls had no effect, since downcasting from `dynamic`
to any other type always succeeds.

Change-Id: I44e3c025e98dddd47e9789ab3543a369b5f74565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124908
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2019-11-14 16:56:06 +00:00
Paul Berry 3bd7ed38fb Migration: fix handling of bound -> type param downcast.
I don't recall what I was thinking when I decided to change the
nullability of the type to "always" when doing this downcast--AFAICT
it doesn't make any sense.

Change-Id: I41d1d2a30722010d2b9b93bb53979ce881e24319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124905
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-14 14:03:16 +00:00
Sam Rawlins 06aef10d76 nnbd preview: Remove descriptionPrefix; don't link Details which will link to some bizarre Never node
Bug: https://github.com/dart-lang/sdk/issues/39247
Change-Id: I6f34ecf745e8db75534affdeadc3d47acac079b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125062
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-11-14 01:09:35 +00:00