Without this fix, the tool inserts an enable-experiment
section indented at the wrong spot:
analyzer:
exclude:
foo:
bar: 1
enable-experiment:
- non-nullable
Change-Id: Ib6601733221e77a4028f3c0ac87b36c258db6ec0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168120
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
I'm looking into enabling NullSafetyUnderstandingFlag in the next
analyzer breaking change.
test_function_void_to_function_object() fails, and it seems that
the test class should use legacy TypeProvider, because `Object` is not
assignable to `void`, but `Object*` is.
Change-Id: Ib867e0eec7a387ed3ed1379a7ef34a58b16e54ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168125
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
The file might be edited in one of a few ways, depending on what it contains.
Previously we read and edited pubspec, which is also YAML, so this
implementation borrows a lot of that, and renames several "pubspec" elements to
be "yaml" elements.
I try to cover in tests various odd existing analysis_options.yaml situations,
so that we try to never crash, or corrupt on weird input here.
Fixes https://github.com/dart-lang/sdk/issues/43806
Change-Id: Ifc57d583e98d798fd7bca748bbe4afef272edab5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167862
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
The internal code that was using this method has been updated to use
MigrationCli.options instead.
Change-Id: I46941b3a2b8dc65a66a3235052bc5c2110a9ab99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167820
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This adds some technical debt in form of using writeOrReadElement in
clients, which can be paid incrementally by migrating these places to
handling assignment like expressions one by one. Doing it all in one
CL was too much. But now the underlaying AST resolution will be
sound.
In the next breaking change we will remove
setAssignmentBackwardCompatibility(), so stop setting elements/types
for assignment targets.
Change-Id: I11626876cfed25653edb0cc18544aba51cef5965
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This CL unblocks the internal SDK roll by restoring the migration
tool's `MigrationCli.addCoreOptions` method (which is currently used
internally). It also adds a replacement, `MigrationCli.options`,
which is more robust because it allows the client to choose which
options to include and which options to exclude.
Once this CL has rolled in, I'll update the internal code base to use
the new `MigrationCli.options` method and then remove the deprecated
`addCoreOptions` method.
Change-Id: I3ddbd935c3858c3302a2ad2b825b97df96249043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167443
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This will be the last published version, and is only being published
so that we can include a README entry indicating why the package is
not to be used. After publishing, I will mark the package as
discontinued.
Change-Id: I95cb6d8d6ec41415edd2c8da300c165a0c4cfb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167444
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
`late final` is not functionally different from `late`, as far
as the migrator is concerned; it is just an indication of late
in the face of missing initialization.
Fixes https://github.com/dart-lang/sdk/issues/41655
Change-Id: I1b0efd3de3b5c7064784ebd1e86c7d12436b1319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167203
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
I plan to publish this on pub, and then mark the package as
discontinued. Customers should invoke NNBD migration using the `dart
migrate` command.
Change-Id: Ia871e71258e3951ac7fd866e46ae97043a6fa93c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167364
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The fix is just to capture the scroll position when the button was clicked,
then rescroll to that pixel after reloading the file.
I also sorted migration.dart.
I also added comments while investigating migration.dart.
Fixes https://github.com/dart-lang/sdk/issues/43546
Change-Id: Iac0a7bf10a671fd6e6b5f02ee0609b7e36fc985a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167360
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Rather than produce an error immediately upon encountering an
alredy-migrated library, we simply skip processing it; this causes its
elements to be added to the nullability graph on demand, just like for
already-migrated dependencies.
We still check for the possibility that *every* file in the user's
package has already been migrated, and issue an error if so (rather
than just doing nothing); this should help avoid user confusion if the
user tries to re-migrate an already-migrated package.
Bug: https://github.com/dart-lang/sdk/issues/42308
Change-Id: I8dd81a9c6ff2bb23ede91e89d1152bd7726dec32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167202
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is a reland of 6a1c54ec30
Original change's description:
> Flow analysis: promote to non-nullable on initialization
>
> When flow analysis encounters a variable declaration of the form `T? x
> = expr;`, if the type of `expr` is `T`, then the variable is
> immediately promoted to type `T`.
>
> Fixes#43099.
>
> Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
> Bug: https://github.com/dart-lang/sdk/issues/43099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
> Commit-Queue: Paul Berry <paulberry@google.com>
> Reviewed-by: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Bug: https://github.com/dart-lang/sdk/issues/43099
Change-Id: I7530bb0f7c24674a7b500558b89d50b35e045aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166305
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When flow analysis encounters a variable declaration of the form `T? x
= expr;`, if the type of `expr` is `T`, then the variable is
immediately promoted to type `T`.
Fixes#43099.
Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
Bug: https://github.com/dart-lang/sdk/issues/43099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
The packages 'analyzer' and 'nnbd_migration' tightly depend on each
other via MigrationResolutionHooks. I will publish analyzer 0.40.4
shortly after this CL lands.
Change-Id: I6f5e51f88e0020a1674ffb251712658e896170e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This logic was removed from the spec in
b70bb3f906.
Only a few places in the SDK itself were relying on this promotion
logic; I've fixed those places by adding explicit types.
Change-Id: Iaeaebe8dd5ab3e848699bc8ebc64a1ae80c1027a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163681
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Uses the existing dart_192.png image.
Alternatively this could have been done using a favicon.ico file but
that would have required more boilerplate, so I went with a simpler
approach.
fixes#43438https://github.com/dart-lang/sdk/issues/43438
Change-Id: I91e0c28a2c0a28db58dbf5189aae4d099c19b23c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163500
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: John Ryan <ryjohn@google.com>
There are certain rare conditions involving generated code in a bazel
workspace that can cause a source file to get processed more than once
by the migration tool (sometimes with a correct URI, sometimes with an
incorrect URI that corresponds to a file path in the `bazel-out`
directory). For the most part the migration tool is tolerant of this
situation, but it can cause InfoBuilder._explainUnit to get called
twice for the same unit. To avoid this creating user-visible
problems, we need to ensure that any regions left over from the
previous invocation of InfoBuilder._explainUnit are cleared out before
we re-populate the region list.
Bug: https://b.corp.google.com/issues/168295421
Change-Id: I18936b03261c30b8c9062b4a568e1a1e094ec867
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162800
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
* Refactor MigrationCliRunner, mostly simplification.
* Add AnalysisResult class to track analysis errors.
* MigrationState now contains an AnalysisResult, and the previewUrls.
* Add logic in the UI to display analysis results.
* Add logic to the backend to display analysis results.
Fixes https://github.com/dart-lang/sdk/issues/41712
Fixes https://github.com/dart-lang/sdk/issues/43138
Change-Id: I3304467955cfa81820f0010d32e17931b3c68b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162400
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This is a reland of d833f2f65c
Original change's description:
> Flow analysis changes to fix mixed-mode unsoundness loophole.
>
> This is the flow analysis portion of the fix to
> https://github.com/dart-lang/language/issues/1143. Follow-up changes
> will be needed in the CFE and/or backends to ensure that exceptions
> are thrown under appropriate circumstances.
>
> This CL also makes some improvements to flow analysis's reachability
> analysis so that it accounts for nullability of the target when
> analyzing the reachability of `??=` and `?.`. Hopefully these
> improvements should make the fix to
> https://github.com/dart-lang/language/issues/1143 clearer and more
> consistent.
>
> Change-Id: I5fa5c070f13fd57ac4c2fb87f2d67588861594b0
> Bug: https://github.com/dart-lang/language/issues/1143
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160440
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>
Bug: https://github.com/dart-lang/language/issues/1143
Change-Id: If9c45649c1e9f4b19f7c282e7a1c4c956a7bc17f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161622
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This is the flow analysis portion of the fix to
https://github.com/dart-lang/language/issues/1143. Follow-up changes
will be needed in the CFE and/or backends to ensure that exceptions
are thrown under appropriate circumstances.
This CL also makes some improvements to flow analysis's reachability
analysis so that it accounts for nullability of the target when
analyzing the reachability of `??=` and `?.`. Hopefully these
improvements should make the fix to
https://github.com/dart-lang/language/issues/1143 clearer and more
consistent.
Change-Id: I5fa5c070f13fd57ac4c2fb87f2d67588861594b0
Bug: https://github.com/dart-lang/language/issues/1143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This allows the core options to be re-used by other tools.
Change-Id: Iea9c18bf4568280dbf2a93ba43656b266226bcf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160341
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is partially in support of the new numeric typing rules for null
safety, however it turned out that the anaylzer wasn't setting the
context type properly even in legacy code. I've fixed both legacy and
null safe behaviors and included tests to cover both.
Fixes#39642.
Bug: https://github.com/dart-lang/sdk/issues/39642
Change-Id: Ie4d0936d335b1f750eae4febe76f2b8879c228b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159965
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Future CLs will hook up the static typing rules for method calls
(`clamp` and `remainder`) and will implement the rules for contexts.
Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: Iccfb1fa1ac9aff6c0832d65e4835b5b9bd51a804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is necessary because whatever type is returned by the getter must
be accepted by the setter.
Bug: https://github.com/dart-lang/sdk/issues/43119
Change-Id: I5a43ec3750328081c39c26ba6fb937a9be068eb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159644
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
I see no reason why this would be useful.
But it might be harmful.
When we create file1 that imports file2, and call getFileSync(file1),
the analyzer will read both file1 and file2 while building the
file graph. So, when we then create file2, it will not be read unless
we call changeFile(file2). And we don't.
Actually, if we want to simulate how migration works, we should first
create all files, and then migrate them.
R=paulberry@google.com
Change-Id: I22ff994d346c4ad985e5d06a34e9fd854d451757
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
The new rules for null-safe number promotion apply to both operators
and ordinary method calls, so I'll be implementing them in terms of
MethodElement.name rather than an operator TokenType. To make this
possible, we need to pass the method element to
TypeSystem.refineBinaryExpressionType.
I'm doing this as a separate CL from the main implementation so that I
can verify that it doesn't introduce backward compatibility issues.
Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: I6be9086553ee0ea9994994c903880fe9bb4477fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The new logic classifies the LHS and RHS of the equality check as
either null, non-nullable, or potentially nullable, and then either
promotes, treats the expression as equivalent to a boolean, or does
nothing, as appropriate.
This means, for example, that a comparison between a non-nullable
value and `null` is now known to evaluate to `true` for reachability
analysis.
Note: as part of this change, it was tempting to trigger promotion
whenever a varialbe is equality compared to an expression of type
`Null`, but this would be unsound (consider `(int? x) => x == (x =
null) ? true : x.isEven`). So we still only promote when the variable
is compared to a literal `null`.
Fixes#41985.
There's a corresponding spec change out for review:
https://github.com/dart-lang/language/pull/1134
Change-Id: Id7f1d4eaa3b0fa57124445bb8352eef32c304feb
Bug: https://github.com/dart-lang/sdk/issues/41985
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155926
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
`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>
This should allow users to work around bugs while waiting for fixes
from the migration team.
Change-Id: I04fe08b4753ee1377a60ec60728a16560847536f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150542
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Both John and I have hit this in our own projects, seemed worth fixing.
Change-Id: Ic053287d365b92cbfd72448fe401ca627891f802
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150663
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
When running the FixBuilder we need to override the behavior of
ClassElement.interfaces so that it returns the post-migration
interface types. We also need to override the behavior of
LibraryElement.isNonNullableByDefault so that the library being
migrated is considered opted in during FixBuilder analysis. This
required adding hooks to the analyzer to allow those overrides.
Additionally, since the analyzer caches the InheritanceManager, we
need to clear that cache out just prior to running the FixBuilder, so
that no pre-migration interface types leak into the FixBuilder.
Fixes#40475.
Fixes#42139.
Change-Id: I45e2c30ebe8c12e4a599e2458d77a3731bad0f98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150260
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When tests are run internally under bazel, there's no `version` file
we can look for to verify that we are looking at an SDK directory.
Looking for a `bin` directory works equally well.
Change-Id: Ib19350eaf90d105ebaa3d197fb45b5a41a10179d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150285
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Permissive mode in the analyzer currently is broken, leading to a
useless stacktrace if an exception occurs. As a quick fix, turn
permissive mode off, so the exception just bubbles up normally and
shows on the console. In follow-up CLs I'll actually fix permissive
mode and add a user option to enable it.
Fixes#42138.
Change-Id: I59322ca9dd90b856c56a6ec335762b94ec6935b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149863
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The previous deps had never been validated and were wrong in many ways
(for some deps the constraint was too narrow or too wide; other deps
were missing or extraneous). I did some experimenting with `pub get`
and `pub run test` to find the earliest version of each package for
which the version solve succeeds and the tests pass.
Note, however, that nnbd_migration currently depends on unpublished
functionality from the _fe_analyzer_shared and analyzer packges. So
before publishing nnbd_migration we'll need to publish
_fe_analyzer_shared and analyzer and then update the pubspec one last
time.
Change-Id: If8453226bfcc5e94ac84f1a3fdc0d2f4ee150f54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149661
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Setting exitCode (rather than calling exit) allows Observatory to keep
running, which makes for easier debugging.
Change-Id: If9812ead72ac04808030cd62467ba2f09b92b947
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149609
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
* Prevent cast exception crash when pubspec.yaml is not a map
* Prevent cast exception crash when pubspec sdk is not a string
* Test error cases for parsing pubspec.
Change-Id: Id392815207dc52719cfec5038d6fa2d09f952f08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149602
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
* Change the "Migrating a package" to be an ordered list of steps.
* Spell 'url' as 'URL'.
* Be consistent about capitalization and hyphenating "null-safe" and not
hyphenating "null safety".
* Add text that the tool will edit pubspec.yaml.
Change-Id: Ief5eac682af2813d267568695f920445b0b79615
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149484
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This is only an issue for the old style (not in stacktrace) buttons.
I did not add a test for this; there are many tests for this code in the
new workflow, inside UnitInfo.handleSourceEdit, etc, and this code path
will be removed soon hopefully.
I *did* test manually and saw that it works.
Change-Id: Iac8ba4cb775b9b15c8db1c1cadd4701da81452be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149382
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
We're not currently working on this, and it has some dependencies that
interfere with publishing the migration tool. If we wind up needing
it again, we can always revert.
Change-Id: Ia6219ac376cef77bda7470777eaf2bebf38769b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149343
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
Relands https://dart-review.googlesource.com/c/sdk/+/148642
Due to a z-index bug, regions are showing up on top of the popup. Fixed.
A regression during a previous a.button/.button change that meant that
the close button wasn't rendered as a button.
Previous change from `a.button/.button` reduced the specificity which
caused incorrect font color in edit link buttons. This has been fixed by
using `.button, a.button` so that we keep the desired specificity but
also keep applying the style to all elements with the `button` class.
Change-Id: Idb5eb154904430d946a80b7574537564b7c71bd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148646
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
I noticed that failed GET requests did not show the error popup. At the
time it seemed like uncommon enough to not be a priority, but this is
occurring frequently for windows users, so it's not reasonable to rule
this out and should be handled.
I also have seen that if the preview server is killed, we get an
unhandled `ProgressEvent` error which is just "instance of minified:ew",
handle that case more gracefully as well.
Change-Id: I4f1f307dc33cd7bf0d76a9702df6728dda09926e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148601
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Change-Id: Id35ae2332520c96265b92abd31c8ec3a92521c8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148569
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Ensure that the preview server responds with full paths so that the
front end does not need to do path magic on relative links, and test
that those full paths are correct on both windows and linux.
Remove [UnitLink.uri], as it is no longer correct, and it does not have
access to a [PathMapper] which is necessary to build a correct URI.
Change-Id: I7ef764d84c0859d72a21134dc042f837767e91b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148565
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Previously, the backend was returning a relative URI, but that doesn't
work when you have stack traces across root directories. So the front
end used path logic to turn the relative path into an absolute one, but
it didn't do this correctly on windows.
Instead just send an absolute path (still a relative URI, though) from
the backend.
Change-Id: Ied06a9d948851fcf6dc1d4aa007961d3d2a000fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148564
Reviewed-by: Paul Berry <paulberry@google.com>
We want to continue to show windows users the windows path, but on click
we want to take load based on the uri path.
Change-Id: Idb1bff3cac1a7b9830c3a4458fc79fbf76551b4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148561
Reviewed-by: Paul Berry <paulberry@google.com>
This reverts commit 480e34ce99.
Reason for revert: `button, .button` is not specific enough, has too low of precedence, resulting in edit link buttons getting the wrong color. Will reland as `button, .button, a.button`. Thanks CSS :)
Original change's description:
> [nnbd_migration] Fix two popup style bugs
>
> Due to a z-index bug, regions are showing up on top of the popup. Fixed.
>
> A regression during a previous a.button/.button change that meant that
> the close button wasn't rendered as a button.
>
> Change-Id: I2c8b84655bd8afdbc0163f5dd810bca84c3db8b2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148642
> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>
> Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>
TBR=paulberry@google.com,mfairhurst@google.com,srawlins@google.com
Change-Id: I29f92aaa79c6285e2822866660e1b5f77b1f43ae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148644
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
These interfaces acted as a temporary bridge to allow analysis server
core classes to provide services needed by nnbd_migration without
forcing analysis_server to depend on nnbd_migration; that in turn
allowed the analysis server to provide migration services to dartfix.
Now that we no longer use the analysis server nor dartfix for
migration, these interface classes are no longer needed.
As of this commit, the nnbd_migration package no longer depends on
analysis_server.
Change-Id: Ia923d91dd59c9a612000da8b0c9ead8a68686d89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148560
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Previously we re-used pages.dart from the analysis server. This paves
the way for making nnbd_migration independent of the analysis server,
which will allow it to be published on pub.
Note that only the portions of pages.dart that are actually used by
nnbd_migration are retained.
Change-Id: I48db228a3bf372cf918f2d2719f8f5415ddfc193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148511
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Due to a z-index bug, regions are showing up on top of the popup. Fixed.
A regression during a previous a.button/.button change that meant that
the close button wasn't rendered as a button.
Change-Id: I2c8b84655bd8afdbc0163f5dd810bca84c3db8b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148642
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This is necessary for the included test case, and also for an upcoming
change to MigrationResolutionHooksImpl to support changing parameter
types in general.
Bug: https://github.com/dart-lang/sdk/issues/38453
Change-Id: I587ae86943d0fa349b03037a76dee91fb0298dcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148583
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This code was necessary when the NNBD migration engine was part of the
analysis server, to allow migration to be run in-process. Now that
it's been separated to its own library, it always runs in process, so
this code is not needed anymore.
Change-Id: Id9e497dca6700ad804f2410cb3b20107be3a4bd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148503
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
These tests were initially based on analysis server tests, so they
shared a lot of analysis server infrastructure. However, none of that
infrastructure was really needed; we can test equally well just using
analyzer infrastructure. This helps pave the way for removing the
dependency from nnbd_migration on analysis_server, which will in turn
allow nnbd_migration to be published as its own package.
Change-Id: Icccb73a6248a0b766db5cfe66f42a6dceac0d944
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148540
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
This will enable these classes to be re-used in unit tests.
Change-Id: Icb5e7ede94603577de44a7d53c30bb4e76a92b96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148465
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Change `handleInsertion` to use a `SourceEdit` instead, and update
`PreviewSite` to use it, but otherwise do not change `PreviewSite`. That
can be tested later when we have new `HintAction`s that allow us to
exercise this new code.
Change-Id: Idd6d782e003d4d643abb5770daa9055685f2e76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148186
Reviewed-by: Paul Berry <paulberry@google.com>
Previous windows-incompatible implementation of hint action mapped the
path unnecessarily. The path for the new hint action comes from the AST
node and not a web URL and therefore should not be (and cannot be)
mapped for it to work on windows.
In the process of fixing this on cli_test, I missed this place where an
extra map was added in the preview_site test code which causes the test
to fail on windows.
Change-Id: If8d175379f0cb9fe864ab1f588af514a17b4758b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148229
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
This existed solely to have a centralized location for the analysis
server's dependencies on nnbd_migration. Now that nnbd_migration
doesn't depend on the analysis server, there's no need for it anymore.
Change-Id: I24b231337b1f724840b4533afef1672241b0af4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148181
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
We no longer use the analysis server or dartfix for migration.
This should unblock removing migration integration from dartfix, which
will unblock publishing dartfix.
It should also pave the way for future changes that will allow us to
publish the NNBD migration tool on pub, which in turn will allow us to
provide updates and bug fixes to the migration tool without having to
publish a new Dart or Flutter SDK.
Change-Id: I9f128b61a2983befc5ef686867dab3db87fd6855
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148020
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is a step toward integrating the new migration CLI with dartdev.
It's necessary because dartdev handles arg parsing.
Change-Id: Ie50a69c434fd4d8873616e72b8274545cf0277d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148007
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
While working on #38453, I encountered these issues.
Change-Id: I6abbfca19d9f6de771181e7f5515681cbbc39a4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148080
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Still not rendered by the front end or handled by the server, but now
sent over to the front end via json encode/decode.
Change-Id: I3f93dc78d9981bf08fddf03bcf484a0fc324b66a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147809
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
In the future this could change to simply be a `Set<HintActionKind>`, so
that the `AtomicEdit`s can be calculated lazily. However, for the first
pass, they are calculated eagerly. This model lets us do that.
Change-Id: I07108ae0876d5e0efe7b35559cedb4cbd1c13605
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147624
Reviewed-by: Paul Berry <paulberry@google.com>
This is to differentiate it from the edit links that appear inside the
stack trace in later CLs for #41077.
Change-Id: I018518cb16ef09a4959895bb4becd10cbabbea23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147622
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
The progress bar fills the width of the user's terminal, and computes
progress strictly based on files and phases, not weighing any file or
phase as greater than another.
Change-Id: Ic9840b3b66789512e0973160b3e0f069b714a4f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147421
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
Based on suggestions from
https://dart-review.googlesource.com/c/sdk/+/146442. Specifically,
the `_Output` class hierarchy has been moved to a new file so that the
classes in it are together, and the remaining classes (in the
DiffStyle hierarchy) are together in source_edit_diff_formatter.dart.
This required making a bunch of things public, so I split `DiffStyle`
into an interface and and impl class to make it easier to see which
method is intended to be used (DiffStyle.formatDiff). Also, moved the
logic that was previously in _Output._processEdits to
DiffStyleImpl.formatDiff.
Change-Id: Iad448f16233e6752e7b20d1e0cee4eb5c033f498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146821
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This should help ensure that descriptions of nullabilities that show
up in the stack trace refer to parts of the program the user is
familiar with, rather than simply saying "explicit type".
Change-Id: If53198cc45077a664e44859c7c0770ec9831c765
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146964
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
This was the original behavior, and it persists in some tests because
it's more trouble than it's worth to rewrite them. But it's not the
behavior we want to ship to users.
Change-Id: Ibf1df628f62b01e934d05336bfe43a5a61268f93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147042
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Commenting out the @ (producing `/* @*/ required`) does no one good. It
does not help weak-mode or strong-mode testing.
Fixes https://github.com/dart-lang/sdk/issues/41181
Change-Id: I9de2775e2a17bacdd30cbfb34dc095cf2b5c603f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147040
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
The expectation in test_expression_bang_hint_in_as_wrapped looks weird,
but without https://github.com/dart-lang/sdk/issues/41397 fixed, this
is the expectation I have; if the migrator starts producing that output,
then #41788 is being fixed. If #41397 is being fixed, the dev can change
the expectation in this test.
Change-Id: I0cfc0c5da8cd12ea12ae74b1909155a0b9a2b043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146822
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
In the dartfix-based implementation, the only significant effect of
supplying `--debug` was to enable the analysis server's
instrumentation log. Since we don't have an analysis server layer in
the new CLI, there's no need for this command line option right now.
If we decide we need a `--debug` flag later we can always add it.
Change-Id: Ib729c5793044456ef460cfa7f823c48f5af9e898
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146445
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
We no longer need a clumsy workaround using an extension method.
Change-Id: If443cbe7138f59e66cce0ca613940b67307b637e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146502
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The previous implementation of the tool (based on dartfix) used
diffing code that was pretty deeply tied into dartfix, and didn't
produce good quality output for migration, so I've replaced it with a
new implementation.
Change-Id: Id3679435bf59c73145eacb6eaee1b6ce16dd61f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146442
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
If an external customer reports an issue with the migration tool using
the links we provide, they won't have the necessary github privileges
to apply labels to the issue, so we want to make sure the default bug
title clarifies that this is a customer-reported issue with NNBD
migration.
Change-Id: I55bf8c16062b1b9e8c25415addc99dd1c378b724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146621
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
We produce a diagnostic under the following conditions:
- For compound assignments, if the type read from the LHS is nullable
(this is illegal after NNBD, and requires user intervention to fix).
- For compound assignments, if the type returned from the combiner is
not assignable to the LHS (this was required prior to NNBD, but it
is a stricter condition after migration, both because the LHS might
have a non-nullable type, and because implicit downcasts are not
allowed).
- For null-aware assignments, if the type read from the LHS is
non-nullable (this indicates that once strong mode is enabled, the
assignment will be dead code).
Bug: https://github.com/dart-lang/sdk/issues/38676
Change-Id: Icb242ba36437e38364ada069880831eb05e3a513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145664
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
This should make it easier to debug failures in FixBuilder unit tests.
Change-Id: I785e939648f10753ae9ac1e18530248c728a7157
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145564
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Fixes https://github.com/dart-lang/sdk/issues/38291
This change also involves moving the "package" where test sources are
written and analyzed; It used to be /home/test (or /project in some
places); and a pubspec.yaml was written (or a .packages file) which
specified the package's name was "test". However, this conflicts with
adding an entry for a mock copy of the actual _test_ package. A
.packages file cannot have two entries for a package named "test", so
the package where all test sources are written is changed to "tests"
(located at /home/tests).
Change-Id: I462b88a814931dc2d4f1e72d07e3daf64768a399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144994
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Without this, it's possible for a unit test failure to result in a
preview server remaining open, which can prevent test execution from
terminating.
Change-Id: I8a11056da5bea003dfa46e3871a241e8f5ce8cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145440
Reviewed-by: Janice Collins <jcollins@google.com>
We really should switch this, if possible, to use the edit kind APIs
that the preview tool uses, so that we can categorize this without
guesswork.
However this will keep it as a rough list, and I don't know if we need
anything fancier that currently -- and it will no longer produce noise
if new changes are added.
(currently produces "and 0 other changes" when running on flutter, so
it's probably mostly comprehensive currently).
Change-Id: I9cb2662995af340346a61d38eba3469927a0f4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145160
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>