Moves the following classes from
`package:analyzer/analysis_rule/analysis_rule.dart` into
`package:analyzer/src/analysis_rule/analysis_rule.dart`:
- `AbstractAnalysisRule`
- `AnalysisRule`
- `MultiAnalysisRule`
- `RemovedAnalysisRule`
These classes are part of the analyzer public API, so the file
`package:analyzer/analysis_rule/analysis_rule.dart` remains, exporting
the declarations so that they can still be used by clients.
This paves the way for a follow-up CL that will use extensions to add
functionality that we *don't* want to include in the analyzer public
API yet.
Change-Id: I6a6a696431f00f69b4b80e0d98b1b8fbb33f020f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Changes the test logic in `analysis_server` and `analyzer_testing` so
that after printing `To accept the current state, expect:`, it prints
diagnostic codes in their proper camelCase format.
Also removes some bogus code from
`pkg/analyzer_testing/lib/analysis_rule/analysis_rule.dart` that
erroneously suggested passing a `name:` parameter to the top level
`error` function. This function does not accept any parameter called
`name`.
Previously, only tests in `pkg/analyzer/test` printed the diagnostic
codes correctly.
Fixes https://github.com/dart-lang/sdk/issues/62651.
Change-Id: I6a6a6964b17cf798c1355e09f9a4633e1fbe388c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
These extensions were previously in `pkg/analyzer_utilities`, which is
not published on `pub`. That meant they could not be used from within
the `lib` directory of any package that *is* published on
`pub`. Specifically, they could not be used from within
`pkg/analyzer_testing/lib`.
In a follow-up CL, I will modify the testing logic so that after
printing `To accept the current state, expect:`, it prints diagnostic
codes in their proper camelCase format.
Change-Id: I6a6a696432d7162906b2c235ea88310dc0aa1fa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480040
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This release is so we can publish a version of analysis_server_plugin,
and then start depending on that published version in DAS.
In addition, we get a highly requested fix out to analyzer_testing
users.
Change-Id: I694f47aeee59367c1fc066bc8f7a865406b09917
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476620
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Fixes https://github.com/dart-lang/sdk/issues/61597
* Remove the old caching mechanism for the old way of sourcing files.
* Remove BlazeMockPackages._addFiles, and rename _addFiles2 to
_addFiles.
A few trailing fixing included:
* Flex.new has a required direction parameter.
* TextOverflow comes from
'package:flutter/src/painting/text_painter.dart'.
* A few stray imports needed to resolve types.
* DiagnosticableTree.debugDescribeChildren is marked external so
that subclasses need not implement it themselves.
* In sort_child_properties_last, RawMaterialButton is in the material
library.
Change-Id: I092bad587ea39bceb7af0951eada3963b1eb48bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Work towards https://github.com/dart-lang/sdk/issues/61597
* DiagnosticsTreeStyle is used just below in DiagnosticsProperty.
* BoxConstraints is used in the `flutter_completion_benchmark`.
* Constraints is the superclass of BoxConstraints.
* The vector_math export is so that a few tests have access to the
Matrix4 class.
* FutureBuilder and StreamBuilder are needed for the
flutter_wrap_builder correction producer.
All of these changes bring the mocks/stubs closer to the real sources
(none are a divergence).
Change-Id: I80d746db3372417d7125aa1f3c2b0604a143f43b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476144
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Work towards https://github.com/dart-lang/sdk/issues/61597
* I found many members of dart:ui were missing, needed generally by
various tests, or members of package:flutter/painting.dart.
* Rename 'package:ui/ui.dart' to 'dart:ui' in a few places.
* `BoxDecoration.color` is nullable.
* `BoxDecoration.backgroundBlendMode` is a `BlendMode?`.
* Add the inherited_theme.dart library, with InheritedTheme, needed by
other text widget classes.
* Add MultiChildRenderObjectWidget as a missing parent class.
* Add concrete implementations to many `State` members. In the real
State class, these are concrete, and we have tests with concrete
subclasses of State, without overrides of these members. So the State
members themselves must be concrete.
* Add new classes: ParentData, ProxyWidget, InheritedWidget,
ParentDataWidget.
* In widgets/text.dart, import dart:ui as ui, and fix many type
signatures. The real widgets/text.dart has this import prefix, and it
makes some signatures more understandable.
* Add some doc comments to various Text members, for the
widget_descriptions code; we have tests that use these doc comments.
Change-Id: I1e38918b4e5381a56ce29440e1181d76e9d56f4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475702
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
With these new exports, we have a lot of "unnecessary import" warnings
in our tests.
As we move to generating these stubs, they will stick closer to their
real counterparts, and include exports like these.
Change-Id: Id63eec30f3a33c8c9751cbf1f213f8d4bf3c41d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This requires some changes to tests, where fields should be final. In
tests where it seemed like the mutability of a field was important, I
just ignored the warning. Otherwise, I made fields final.
I do like keeping this stub in-line with the real Widget class. If
anything, it keeps in mind that flutter Widgets should generally no
have mutable fields.
Change-Id: Ib7dc1fbd6aa013dc72925404c4be8186ddcddaa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Fixes some broken Windows bots/tests that fail to get the correct library names. The original code wrote half-windows-half-linux paths into the file, and the backslashes in the Windows paths resulted in "Invalid escape sequence" during loading (which was not visible because of an empty catch block in `EmbeddedSdk`)
Change-Id: I02677570a4c39515603aae49d94e21bedc0b39ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472905
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Fixes https://github.com/dart-lang/sdk/issues/62234 by making the
'dart:ui' library discoverable in the same way that the real one is
discoverable: by the sky_engine _embedder.yaml file.
Coupled with this change is the motivation: the stubs are out-of-date,
with `double width` and `double height` parameters on the Preview
constructor. But this has been changed to use a `Size` object, and
`Size` is written in 'dart:ui'. So to write a test that uses `Size`, the
test now needs proper access to 'dart:ui', and we should not write
'package:ui/ui.dart' in our test cases. These changes are in
`.../lib/mock_packages/package_content/flutter/lib/src/widget_previews/widget_previews.dart`
and in `invalid_widget_preview_private_argument_test.dart`.
Change-Id: I6f608eb3e1f431ad576ba8f3572454e42a39f9f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
In the analyzer, reduce our custom warning for `nonVirtual`, (largely
replaced by the existing `invalid_annotation_target` warning). The
tests for that warning are mostly covered by the existing
`invalid_annotation_target` tests, but I added a few to fill some gaps.
Otherwise, we still report a specific warning for this annotation being
placed on an abstract member, or an instance member of an extension
type.
Work towards https://github.com/dart-lang/sdk/issues/62253
Change-Id: Ibcde2f99cf53460bff636bfc8bbf07e80779a942
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469104
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
In the analyzer, remove our custom warning for `visibleForOverriding`,
`invalid_visible_for_overriding_annotation` (replaced by the existing
`invalid_annotation_target` warning). The tests for that warning are
mostly covered by the existing `invalid_annotation_target` tests, but
I added a few to fill some gaps.
Work towards https://github.com/dart-lang/sdk/issues/62253
Change-Id: Ie960db6ebe007afde787f68e4b6b9f20a1835639
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468702
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
My generator was not writing "with clauses," so this corrects that.
Additionally:
* `Diagnosticable.debugFillProperties` has annotations that I missed.
* `DiagnosticableTree.debugDescribeChildren` has an annotation that I
missed, and can be abstract.
* VoidCallback was moved to `dart:ui`, and I had missed this.
Change-Id: I6c4c79a1532ede84e8fdbeed754662b67e5c8282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Changes the logic in `pkg/analyzer_testing` to use
`DiagnosticCode.lowerCaseName` instead of `DiagnosticCode.name`. This
ensures that diagnostic codes are matched in a case-insensitive
fashion.
This paves the way for deprecating (and eventually removing) the
`DiagnosticCode.name` getter.
Change-Id: I6a6a69640838d820e8e466c23289bdf2c30eb517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466280
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Adjusts the logic in the lint `Registry` class so that lint names are
matched in case-insensitive fashion. For the most part this is
accomplished by adding calls to `.toLowerCase()` inside the `Registry`
class, preserving its API.
For the `enabled` method, preserving the API would have been a pain (I
would have had to translate the keys in the `ruleConfigs` parameter to
lower case). So instead I added an assertion to verify that the keys
were lower case, and pushed the responsibility to the callers to
create lower case keys.
This paves the way for a follow-up CL that will translate diagnostic
codes to `lower_snake_case` conventions.
It also solves a longstanding problem with the mixed case lint rules
`no_runtimeType_toString`, `prefer_for_elements_to_map_fromIterable`,
`prefer_iterable_whereType`. Previously, the user had to carefully
imitate the capitalization of the lint rules when specifying them in
the `analysis_options.yaml` file, even though `// ignore:` comments
for the lints matched in case insensitive fashion. With this CL, the
lint rule names in `analysis_options.yaml` are matched in case
insensitive fashion as well.
Change-Id: I6a6a6964d83241e49878bbf96ef9b94cbb12098b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465964
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
(just animation, foundation, and widget_previews)
Work towards https://github.com/dart-lang/sdk/issues/61597
Work towards https://github.com/dart-lang/sdk/issues/61943
In this CL, I try to keep the elements generally the same as they
are in `pkg/analyzer_testing/lib/mock_packages/package_content/flutter`
and only correcting things that are wrong/out of date. To that end:
* AnimationController extends Animation, which is defined in
`lib/src/animation/animation.dart`, so we add that.
* FlutterErrorDetails.new has many more parameters.
* Listenable and ValueListenable are necessary, so those are added in
`lib/src/foundation/change_notifier.dart`.
* There is no `Key._` constructor, but there is now `Key.empty`.
* Preview no longer has a `width` or `height` property (or constructor
parameter) but now has `size`.
Change-Id: I7e73d26e6fdf9896b24e1d908f0bf2950f67db16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465660
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
When generating the mock packages from the real packages, I found this
discrepancy; we're missing this deprecation. To keep things aligned as
close as possible, we should add it.
Change-Id: Ibbfd9164be5b344c358a4546542723f7deaff73d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463162
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
The only piece that _changed_ is the Allocator class and Opaque class.
The previous (deleted) mock package for ffi included these classes,
but the real ffi package does not declare either. Instead,
`dart:ffi` declares these classes. The mock dart:ffi already has a
stub Opaque class, and this change adds the Allocator class.
Change-Id: I561bda1375c8711ae819ffe0bc562e5570b31cc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461902
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Changes the analyzer and related packages so that when they refer to
diagnostic constants, they do so via the import prefix `diag`, which
refers to the appropriate `diagnostic.dart` file containing the top
level diagnostic constant declarations, rather than the static
declarations inside `DiagnosticCode`-derived classes (which will soon
be removed).
This CL was created by the following steps:
- Run the script
`pkg/analyzer_utilities/tool/messages/switch_to_toplevel_diagnostics.dart`.
- Execute `dart fix --apply --code=unused_import,unnecessary_import`
on the following directories (this removes imports that are no
longer necessary due to the change):
- `pkg/analysis_server`
- `pkg/analyzer`
- `pkg/linter`
- `pkg/analysis_server_plugin`
- `pkg/analyzer_plugin`
- `pkg/analyzer_testing`
- `pkg/front_end`
- `pkg/analyzer_cli`
- Execute `dart format` on the following files and directories:
- `pkg/analysis_server`
- `pkg/analyzer`
- `pkg/linter`
- `pkg/analysis_server_plugin`
- `pkg/analyzer_plugin`
- `pkg/analyzer_testing`
- `pkg/front_end/test/scanner_test.dart`
(Note that `pkg/front_end` and `pkg/analyzer_cli` are not
re-formatted as whole directories because they contain `.dart` files
that are test cases rather than source code, and reformatting those
files might change test expectations.)
- Manually add `diag` to
pkg/front_end/test/spell_checking_list_tests.txt.
- Manually fix the ignore comment in
`pkg/analyzer_testing/lib/src/analysis_rule/pub_package_resolution.dart`. (The
script `switch_to_toplevel_diagnostics.dart` automatically adds it
after `import 'package:analyzer/src/diagnostic/diagnostic.dart' as
diag;`, but then executing `dart format` bumps the ignore comment to
the following line, where it has no effect.)
Change-Id: I6a6a69643022aab2b5a6224fb4124eead243260d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Before this change, `_cacheFiles` was a function that took a Map as a
parameter, which was always empty, and returned `void`, because the
Map is an output parameter. This was kind of like a return type, but
with extra steps.
In this CL, I make the function return a Map, and then
`MockPackagesMixin._cachedFiles` can be made non-nullable, and
`late final`, with a simpler lifecycle.
Change-Id: Iae236e43de32d4ed82466cfa5661d266c52b14ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460202
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>