`FutureOr<T?>` is already nullable, because `FutureOr<T?>` ==
`FutureOr<T | Null>` == `Future<T | Null> | T | Null`. So the second
`?` is redundant.
Also fix a bug where we were treating a `Null` type as `Never` if we
couldn't find a reason to require it to be nullable; this was
inconsistent with how the FixBuilder was handling `Null` (which is to
leave it unchanged).
Change-Id: I5e0e4b7fb449988d8ff0dd87a2b4c3da4a6ecebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155506
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Fixes https://github.com/dart-lang/sdk/issues/29731
This change produces UNUSED_ELEMENT hints for optional parameters
for which no arguments are ever explicitly given, under the following
circumstances:
* parameter is for a constructor, method, or top-level function which
is not accessible outside the library,
* function is never torn-off (all bets are off once its been torn off),
* method does not override a method in which the matching parameter is
required,
* method does not override a method with a matching paramter, in which
an argument is given for the matching parameter.
Change-Id: Idabf051f55140b62a440dc63ca0234f22598a5e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152730
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Previously this class was marked `@visibleForTesting`, but we need
clients to be able to create instances of this class in order to drive
the migration process.
Change-Id: Ibb8a4cda342942dcb15e6fd7625387d246b41f84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153800
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The current output indirectly advertizes premature out-of-order migration,
which would be bad if it happened widely.
We can keep the flag, but should not advertize it.
Change-Id: I8bde10489cef8e1104e2e5216e03aed61bc95ba0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153612
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
So, we can use package:analyzer/src/dart/element/type_system.dart
instead of src/generated/... library.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: Ic804cd29429bf8a85d25e21f77292a6816a3ede7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153363
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
We cannot remove them completely just yet, there are users in google3.
But this CL will allow experimenting internally to track these users
and update them similarly.
R=brianwilkerson@google.com, devoncarew@google.com
Change-Id: Ic588b2873f9d5202783c8991f58e86bab28bd47e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This is necessary for some Google internal testing environments that
are ipv6-only.
Change-Id: I1385786bd0f9614fabcf5730d96a0d6018c6401e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153063
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
There were two problems:
- EdgeBuilder wasn't handling the extension override syntax at all,
causing a crash.
- FixBuilder wasn't overriding the behavior of
ExtensionElement.extendedType, causing a star type to be used as a
context for the target expression; this prevented the fix builder
from realizing when it needed to insert `!` after the target
expression.
Fixes#42455.
Bug: https://github.com/dart-lang/sdk/issues/42455
Change-Id: I5a9f66f83db73a796e72708022faefd527667e32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
These height changes caused the overlay containing highlighted regions
to lose alignment with the underlying text, making the preview output
nearly unreadable for files with a lot of informative regions.
Change-Id: Ie6d0e9e58d28bc63dea5ae1e0a6a630f00c814ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152729
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Fixes https://github.com/dart-lang/sdk/issues/42375
EdgeBuilder wishes to do its own GLB type-joining, as does FlowAnalysis.
When FlowAnalysis pushes a promotion in ifNullExpression_rightBegin,
and then in write, and then pops those two promotions to join them in
ifNullExpression_end, EdgeBuilder is not given a chance to make its
own GLB node. Instead promotion never happens: the DecoratedType which
is the variable's type is promoted to non-nullable, for the left side.
The DecoratedType for the right side expression is not considered
non-nullable, so the FlowAnalysis.join will always fail to promote.
TypeOperations.adjustPromotedTypes solves this. It is a no-op in all
implementations except in EdgeBuilder.
Additionally FlowAnalysis.write's promotion fails for the same reason:
the only type of interest is the declared type made non-nullable, and
no matter what, the writtenType is not a subtype of this.
TypeOperations.forcePromotion solves this. It is a no-op in all
implementations except EdgeBuilder.
Change-Id: Iba6b9a69583af8fe1aa23124c7d66047acfff495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152104
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Text is now white on a light-blue background.
Change-Id: Iac613c49fc8db6241ba013341fb29045f89048e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152042
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: John Ryan <ryjohn@google.com>
- Update header text and buttons
- Add Roboto font
- Add Roboto Mono font
- Add Material icons font
- Update color scheme
- Move help button to header
- Change "Report a problem" button to "Send Feedback"
- Update button colors
Change-Id: Ia4d8b71ae8ec7a7c04ab8c238ffb0499becc9620
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151663
Commit-Queue: John Ryan <ryjohn@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Fixing the test that's causing the Windows bot to fail required updating
the MockSdk, which cause a lot of other changes. I would have done this
in two separate CLs if I'd known how big this was going to get, but I'm
hoping it isn't too big.
Change-Id: Idee56bab5e73a78ab7857e81177090493aa08b40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151874
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Change-Id: Ie9cd580fad0e596f1653e3a87cde75e133d1fe2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151360
Commit-Queue: John Ryan <ryjohn@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Move the nnbd core libraries from sdk_nnbd to sdk, and updates
references in build files and elsewhere accordingly.
Change-Id: I09760fe1e006657aacdfe80f3b22fdf6f7e30a9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151121
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
We now store both environmentVariables and injectArtificialException
in the _MigrationCliTestBase class, and refer to them wherever they
are needed, so we reduce the amount of plumbing we need to do.
In a follow up CL I'll be adding more behavior injection using the
same technique.
Change-Id: Ib736373f7a92a46922964d3c5c59d35bf72d618a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151300
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Fixes#42343
This also prevents a crash if the binary-to-execute could not be found.
Change-Id: I19dd9f6dcbb41a5c8b4ef2a04a87c1fc83429120
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151327
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
There is logic to navigate to the top of a newly-loaded page. It
broke with a visual redesign, in which the title of a page is always
sitting at the top of the screen. The new logic will scroll the page
to the first line of source text.
Change-Id: I685d1fb96c6ca1789f114871acd2bb8148e6ae7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151032
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Previously the API was general, exposing a `numPhases` integer, and
providing a generic processing function with a `phase` argument. This
was necessary back when migration was built into DartFix (because
different kinds of fixes had different numbers of phases), but now
that migration is a separate tool, it gets in the way because it makes
it difficult for the caller to have different behaviors in different
phases.
This is a prerequisite for making it possible to have some files
analyzed but not finalized (which is in turn necessary for handling
generated files).
Change-Id: I5993808eb3dace21d8b6cb9c5308f94a3b1f898e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151081
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This API can be used by tools that wish to perform migration but want
to provide their own command-line argument parsing.
Change-Id: Ic54e993139c803ded5ac39229ae84980db12184e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151080
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Previously, MigrationCli.run() would always return, but it would set
MigrationCli.exitCode to indicate whether an error occurred. This
made it necessary to thread a lot of tricky logic around to ensure
that we would exit quickly if an error occurred. This CL switches to
using an exception, so we get the same effect automatically.
Change-Id: I2b885092dec551700900b118ec3d9acd2f3649d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150760
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Also clean up sanity checking code a little bit.
Change-Id: I4274dad42687a4dc419090d656ec56168c982c29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150661
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
* Use title case on all headings.
* Link to https://dart.dev/null-safety and
https://dart.dev/tools/pub/cmd/pub-outdated
* Remove any text which suggests to publish. Official docs warn
strongly against using in production.
* Mention `pub outdated --mode=null-safety`.
* Mention migrating a clean code repository.
* Add more text about committing along the way.
* Make clear that the tool provides no revert capability.
Change-Id: I7914dc904a93046ce2508c51cae158ac39e889af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150822
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
This reverts commit ebcc6dc2a2.
Reason for revert: Broke golem. I think there are more implementations of Logger than I realized.
Original change's description:
> Bump cli_util to 0.2.0; implement new methods
>
> This fixes the issue of progress indicators being shown during tests.
>
> Change-Id: I39fd68cfeca70a63d088aceb4325b42c53766afd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150669
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>
TBR=paulberry@google.com,jcollins@google.com,mfairhurst@google.com,srawlins@google.com
Change-Id: I52ac0f5d96a161534c28cc160c2a2b3b364ad511
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150693
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This fixes the issue of progress indicators being shown during tests.
Change-Id: I39fd68cfeca70a63d088aceb4325b42c53766afd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150669
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>