There are clients in google3 that import package:analyzer/src/summary/idl.dart
to use PackageBundle. We cannot make changes to idl.dart, so this
CL introduces a new file that we can change, and in the binary format CL
we will replace the exported PackageBundle class with a new class for
the binary format.
Change-Id: Iee89c784a2812bcdeefaef1c122ac8d8533665fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Expand the range allowed by the dep from `package:analyzer`.
Switch dependencies to `any` for the packages which are `publish_to:
none`. The actual constraints aren't useful in these packages since they
are always pinned exactly by DEPS and so we can't trust they are kept up
to date.
Change-Id: Ibd937e8646574d49105f4dd0de2529e7ab30862a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172380
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
This CL adjusts several visitors to visit `type` rather than
`functionType` of `GenericTypeAlias`. This is needed because
`functionType` is now a view on `type`, and the former will be null
in some cases such that the underlying `type` is incorrectly ignored.
Here are the locations not yet modified in this manner:
Visitors:
ResolvedAstPrinter
AstBinaryWriter
BestPracticesVerifier
Non-visitors:
TypeAliasSelfReferenceFinder._sanitizeGenericTypeAlias, _Finder.genericTypeAlias
VarianceBuilder._genericTypeAlias
NamedTypeBuilder._getRawFunctionType,
LinkedUnitContext.getGeneticTypeAliasFunction
_File._buildFileDeclarations
_LibraryBuilder._addGenericTypeAlias
analysis_server, visitors:
_LocalBestTypeVisitor
analysis_server, non-visitors:
InlineTypedef.compute
DartUnitOutlineComputer._newGenericTypeAliasOutline
Files: completion_metrics (about 3 locations in here).
It would be great if I could get some feedback on these: Which ones
are most urgent? Will we keep any of them unchanged?
Change-Id: Ifd55c19571d84bb7ec004b65c5f1f22f3b22cb5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171586
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This CL unifies the implementations of `verify_tests_test.dart` found
in packages `analysis_server`, `analyzer`, and `analyzer_plugin`. It
also enhances the functionality of the tests by having them detect
both missing and extra imports in `test_all.dart` files.
This should make it easier to re-use this logic in other packages,
such as `nnbd_migration`.
Change-Id: Id344eeb4ad514461cda622495651b1339f379022
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170363
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This CL unifies the implementations of `package_root.dart` found in
packages `analysis_server`, `analysis_server_client`, `analyzer`, and
`analyzer_plugin`.
This should make it easier to re-use this logic in other packages,
such as `nnbd_migration`.
Change-Id: I0da44edb379b8e929dd0b1c16a6989c1e9418acb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Many fields can be late or late final, so adding hints for the migration tool.
In SnippetTester, the fields are all set in the constructor. Added a factory
constructor so the fields can be final. Renamed them to be private.
Change-Id: I559e7ba92c7c6749038630b03f67f8a77bdc704a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170406
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Fields initialized in `setUp` are late.
Variables initialized with implicit casts like:
ClassDeclaration clazz = unit.declarations[0];
would need a cast:
ClassDeclaration clazz = unit.declarations[0] as ClassDeclaration;
so they are updated to use var, which is more idiomatic:
var clazz = unit.declarations[0] as ClassDeclaration;
Change-Id: I4e4ae814a814d3a4200c5078a6904dbac0a8140c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170520
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
As discussed in
https://github.com/dart-lang/sdk/issues/44031#issuecomment-720967259,
we want to encourage users to publish null safe packages with an SDK
min constraint matching the SDK version that was used for the
migration, e.g. `2.12.0-18.0.beta`. However, we also want to make
sure that users doing migration via internal, dev, or bleeding edge
builds publish their null safe packages don't wind up inadvertently
publishing packages that are un-resolvable with the latest beta SDK,
so if the user is on one of those versions, we'll set their SDK min
constraint to `2.12.0-0`.
And of course, once the feature ships to stable, we'll want users to
publish their null safe packages with an SDK min constraint matching
the version in which null safety shipped to stable.
This CL implements all of that functionality, and tests it by
overriding the `version` file in the analyzer's mock SDK.
Change-Id: Ib9ed97e691271da0ed391a6c1a5fe209aa959dce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Previously, when analyzing a call to an iterable method that could
potentially be transformed into an `OrNull` extension, such as:
allMatches(str).firstWhere(..., orElse: () => null);
the migration tool would erroneously identify some subexpressions of
the call target (`str` in this example) as the argument supplied to
`orElse`, resulting in a crash.
This CL fixes the logic so that we use an `identical` check to verify
when we are looking at the argument to `orElse`.
Fixes#43956.
Bug: https://github.com/dart-lang/sdk/issues/43956
Change-Id: I2f4a0e81becf789cab5334d4926e014bda2772f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170162
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>