This change restores the property that the only caller to
`ExpressionImpl.resolveExpression` is
`ResolverVisitor.dispatchExpression`. This is a useful property
because it means that if there's special logic related to type
contexts that we want to be executed every time the resolver recurses
into an expression, we can safely put that logic in
`ResolverVisitor.dispatchExpression`*.
(*Exception: sometimes the resolver recurses into expressions using
`AstNode.visitChildren`, in which case
`ResolverVisitor.dispatchExpression` is bypassed, but fortunately when
this happens, the context is guaranteed to be `_`, so most
context-related logic is irrelevant.)
Change-Id: Ia39c8564014815551266d6b91d0cc102b5768ba8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
In particular, this makes it use the mock versions of 'flutter' and
'meta'. The other mock packages it uses aren't yet in the shared
support. I'll add support for them and move the linter over in a future
CL, then in later CLs I'll look at moving the analyzer and
analysis_server packages to the shared versions.
Change-Id: Ib0e272b48332278acf9dcfd4e4d0fc59ba9d29b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371947
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
Revisions updated by `dart tools/rev_sdk_deps.dart`.
async (a004370..d7c0cd5):
d7c0cd5 2024-06-17 Kevin Moore Drop use of pkg:collection whereNotNull() (dart-lang/async#278)
dartdoc (14d33d3..818d1f5):
818d1f52 2024-06-17 Sam Rawlins Minor improvement to the 'documentedWhere' comment (dart-lang/dartdoc#3789)
39591df5 2024-06-17 Sam Rawlins Pipe the '--stats' flag through for the 'doc sdk' task (dart-lang/dartdoc#3791)
6b2ee570 2024-06-17 Sam Rawlins Use 'named' extension in tests (dart-lang/dartdoc#3790)
fabc394b 2024-06-17 Sam Rawlins Add more information to various asserts. (dart-lang/dartdoc#3787)
64982f89 2024-06-17 Parker Lougheed Update to package:lints v4 (dart-lang/dartdoc#3785)
http_parser (71b4c2c..9bf7bd9):
9bf7bd9 2024-06-17 Kevin Moore Prepare release v4.1.0 (dart-lang/http_parser#100)
shelf (4c54af6..2536c15):
2536c15 2024-06-17 Graciliano Monteiro Passos `Headers.fromEntries`: using `CaseInsensitiveMap.fromEntries` (dart-lang/shelf#437)
Change-Id: Iff49c7356534f950147b2c0c087e59414a6fc393
Tested: pkg/vm changes are updating test expectations
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372101
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
CommentToken is the static type of `Token.precedingComments`:
https://pub.dev/documentation/analyzer/5.13.0/dart_ast_token/Token/precedingComments.html
and so should be exposed as public API.
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I06e3e897bf310b9bc0e5067ab0f44db3a3e459c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371946
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
This changes the (non-machine/json) output of "dart analyze" when there are errors in pubspec.yaml/analysis_options.
Before:
```
Analyzing myapp...
error • analysis_options.yaml:3:1 • Expected ':'. Parse errors in analysis_options.yaml may result in other incorrect diagnostics. • parse_error
error • lib\main.dart:1:16 • A value of type 'Null' can't be returned from the function 'foo' because it has a return type of 'int'. • return_of_invalid_type
2 issues found.
```
After:
```
Analyzing myapp...
Errors were found in pubspec.yaml or analysis_options.yaml which may result in other incorrect errors.
error • analysis_options.yaml:3:1 • Expected ':'. Parse errors in analysis_options.yaml may result in other incorrect diagnostics. • parse_error
Errors in other files that might be caused by those above.
error • lib\main.dart:1:16 • A value of type 'Null' can't be returned from the function 'foo' because it has a return type of 'int'. • return_of_invalid_type
2 issues found.
```
Fixes https://github.com/dart-lang/sdk/issues/55987
Change-Id: I25ae7b200463f2cd3f2046ea9f5f8ddc5c62cc60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372080
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Introducing a partial redundancy with a variable with a longer
live-range can reduce the size of the emitted code.
Flute.complex (-O4): -0.377%
cm_shell (-O4): -0.029%
Change-Id: I0d03119b17f4b58d61f277bf8bb0e57d8e7c47c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360360
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
I noticed that dart2js generated poor code for `(a, b) = (1, 2)`.
This is due to an oversight in not constant-folding record field loads.
Change-Id: Iac110d8c3373d7673c21494fc467f7fcb400de1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371505
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Removes the port from `startService()` (which as far as I can see is unused) and parses it from `args` instead.
I had to add support for "options" in the argument classes and switched from a bool flag `isFlag` to an enum to be a bit more descriptive (and be easier to support multi-options in future if required).
Fixes https://github.com/dart-lang/sdk/issues/56000
Change-Id: Ib08513139f58e8845a7c2cbbeeea06787dbc2df1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371840
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Change-Id: Ice61586e2a60d039987b1e3b5f5f328cc46fb41e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371880
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Since the addition of the OffsetMap, imports and exports no longer
need to be processed by offsets, simplifying their handling.
Change-Id: I98698bf1d8f287046147d2f8ebfb005c5fae4d0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371403
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
After VM fix (856139bfc3) the coverage
should be stable.
This CL updates the coverage "expect" file.
Change-Id: Icfcb4e0869ea97232b985f985a79754da3832ebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371820
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Before this CL, becase of optimizations, coverage of some of these goes
away, making coverage unreliable.
I believe this fixes the issues for "regular" runs (at least it seems to
be stable on the CFE coverage tests).
If setting `--optimization-counter-threshold=-1` there'll still be
trouble though and we would have to also insert these calls in the start
of FunctionBody and the start of FieldInitializer for it to produce the
same results.
TEST=pkg/vm_service/test/coverage_instance_call_after_optimization_test.dart,pkg/vm_service/test/coverage_static_call_after_optimization_test.dart
Bug: https://github.com/dart-lang/sdk/issues/42061
Bug: https://github.com/dart-lang/sdk/issues/55959
Bug: https://github.com/dart-lang/sdk/issues/56018
Change-Id: I34947f0d4b123e52ce67b71a195782d31e4bda16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370501
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Local functions named `_` are treated the same as local wildcard variables.
They cannot be referred to.
This CL changes that behaviour.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: Idbbe2a4f5b406d4499602e808f6541af6451fb31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371480
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Adds cases for 0-6 arg functions. Currently, all of these
lower to allowInterop, but will move to a arity-dependent
lowering in a future CL.
Change-Id: I6fcb3110e16b8701444ebb98496bcdb47ffb0a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368063
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Positional record type fields named `_` are wildcards. They are non-binding and will not collide with other wildcard fields.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: Ic6985da5bdb32564402d084a3282fa448ff28cbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Wildcard optional parameters aren't used anyways, so it doesn't matter if they have a default value.
This CL removes the error that's typically there.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: Ie7286e1c3650fa347b1c28f1cc4ebd657cca33de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371560
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Like type parameters, these parameters can't be passed from JS and
such functions already do not work as intended as there is no way
to pass named args to a JS function. These named parameters were
being silently ignored in dart2wasm when creating the function
trampoline.
Change-Id: Iebb890de05f8b242e0542c1ec8f2c0582c5232df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368062
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Internal users reported a compiler crash when using sequential compilation. Their change involved adding a class hierarchy in which the constructor of a superclass included a RecordIndexGet. When analyzing the constructor of the subclass we also analyze the body of the super constructors.
In this rare case the member being analyzed does not match the member containing the receiver node. Usually calls act as a layer of indirection that we do not analyze across.
When we then save the type of the receiver, we do so in the context of the wrong member (the subclass constructor rather than the superclass constructor). We just have to be more careful to use the correct context member.
The added test fails prior to this change.
Change-Id: I8b9a3b8a7692b8604d5c37c59b94bb8d46afff75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371580
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
The tests in this class were duplicated when pattern support was added, one set
of tests for <= 2.19 and one for > 2.19. The> 2.19 tests were marked as Failing
because this functionality didn't work.
This functionality has now been implemented, but because the error code and fix
are different, these tests continued to fail. This change moves the tests to
the equivalent pattern-enabled fixes tests and removes `@FailingTest` for
those that can now pass.
There are still a few marked `@FailingTest` because of differences in the new
implementation.
See https://github.com/dart-lang/sdk/issues/52180#issuecomment-2166814402
Change-Id: Ie1dfa5bc5c608d38a191507f5f0403d20ba2ef31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This affects very common string interpolation expressions where we now
avoid creating arrays and looping over arrays and casting references
when getting things out of arrays.
e.g. `StringBuffer.write()` uses "$obj" in it's implementation
which will benefit from this.
Change-Id: Ie6615e5f76a4a8ccb4ff9aa85c05c7e39eab6f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371660
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>