Commit graph

101611 commits

Author SHA1 Message Date
dependabot[bot] 05d9e5bf37 Bump github/codeql-action from 3.25.7 to 3.25.8
Closes https://github.com/dart-lang/sdk/pull/55963

GitOrigin-RevId: 8619c27e49c9226b952d17082c04086c95cffc4b
Change-Id: I82da17f70dad04f3e17b37e7838ef5aae029b582
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370324
Reviewed-by: Alexander Thomas <athom@google.com>
2024-06-10 16:22:59 +00:00
Alexander Markov 17e12879fc Dynamic interface yaml file
TEST=pkg/vm/test/transformations/dynamic_interface_annotator_test.dart

Change-Id: Ib620a98b19067c51d913b499274bfed9aaa576f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370065
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-06-10 16:09:54 +00:00
Paul Berry ef57b15de7 Analyzer: initial infrastructure for logging details of type inference.
This is the first in a planned series of commits that will give the
analyzer and the CFE the ability to instrument their type inference
functionality. The eventual goal is to have an easy way for developers
of the Dart SDK (and perhaps even curious customers) to supply some
code to the analyzer and/or CFE, and see a trace of the relevant type
inference events (e.g. when each statement, expression, pattern, or
collection element was type inferred, the context supplied to type
inference of each expression, the static type of each expression, the
steps involved in inferring generic type parameters, significant flow
analysis events, etc.).

For now, the only functionality that is implemented is to track when
the `ResolverVisitor` enters and exits each expression. This is done
by adding the null-aware calls
`inferenceLogWriter?.enterExpression(...)` and
`inferenceLogWriter?.exitExpression(...)` to each expression `visit`
method in the `ResolverVisitor`.

In normal operation, `inferenceLogWriter` returns `null`, so there is
no effect. But when type inference logging is active, this call
triggers information to be recorded in memory. This information can be
printed to standard output in two scenarios: (1) if the user requests
type inference logging (not yet implemented), or (2) if the type
inference logging mechanism detects that an important invariant has
not been satisfied (e.g. improper nesting of `enterExpression` and
`exitExpression` calls).

This mechanism of using null-aware calls for instrumentation is very
low overhead when inference logging is inactive; I've verified using
Golem that the overhead is well below the noise level of all our
benchmarks (this Golem run was done using a private branch in which
inference logging is more completely fleshed out, to try to provoke
the most overhead possible).  Details can be found here:
https://golem.corp.goog/Comparison?repository=dart#targetA%3Ddart-analysis-server%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D110445%3BpatchA%3Dpaulberry-inference_log%3BtargetB%3Ddart-analysis-server%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D110443%3BpatchB%3DNone

Note that the expression visit methods in `ResolverVisitor` are
invoked in two ways depending on the surrounding code: via the
abstract function `ExpressionImpl.resolveExpression` (when supplying a
context) and via the standard visitor mechanism (typically using
`AstNode.visitChildren`). So there is no single unique function
involved in all expression type inference. This means that in order to
fully instrument expression inference, every single expression visit
method in `ResolverVisitor` must call `enterExpression` and
`exitExpression`. It would be very easy to get this wrong, and forget
to instrument an important expression type.

Two mitigation strategies were used to reduce the risk of an
expression type getting forgotten. Firstly, the
`ResolverVisitor.dispatchExpression` method (which is a
frequently-used entry point for type inferring an expression) calls
`inferenceLogWriter?.assertExpressionWasRecorded` after visiting the
expression; this checks that `enterExpression` was properly
called. Secondly, each time `enterExpression` is called, the inference
logging mechanism looks through the ancestors in the AST, and checks
that `enterExpression` was also appropriately called for the innermost
enclosing expression.

To make sure that the analyzer really satisfies the invariants that
these checks are checking, the type inference logging mechanism is
turned on when assertions are enabled (but it is turned on in a way
where it only dumps to standard out if something goes wrong). This
ensures that the checks will be verified when running analyzer unit
tests on the trybots, but doesn't introduce any extra overhead the
production analyzer (beyond the null-aware calls mentioned earlier).

In follow-up commits I intend to add logic to do the following:
- Track the context and static type of each expression.
- Track type inference of statements, patterns, and collection
  elements.
- Track the computations involved in solving for generic type
  parameters.
- Add a command-line mechanism that developers of the Dart SDK can use
  to analyze some code with type inference logging enabled.

Change-Id: I9757bdd2b3cb996fc98b615d87991de16674e53b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369788
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-10 15:16:06 +00:00
Sam Rawlins eee06a5f8f linter: move constant_identifier_names tests
Change-Id: I3bc6b00a94536c94ee0f68cc7875d6a05d9b76d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370420
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Sam Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-06-10 15:15:12 +00:00
pq 2ebde46492 quick fix for INVALID_USE_OF_COVARIANT
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I9e7ad32fb3aaea28c31b6b29af4b2f1233cb9f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-06-10 15:08:03 +00:00
pq adc59f66a4 quick fix for NULL_CHECK_ALWAYS_FAILS
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: Ic38b8a9e9717fc477394ea19bbb7173b2234d2f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-10 15:07:09 +00:00
pq 224d19ec06 [wildcards] avoid_unused_constructor_parameters wildcard test
Test to ensure that `avoid_unused_constructor_parameters` doesn't overreport in the presence of an unused wildcard param.

(Note that underscores are ignored pre-wildcards too and this ensures that that behavior is preserved too.)

Fixes: https://github.com/dart-lang/linter/issues/4995

Change-Id: I13ef73eb28cf2501ed292dd3c56c9933a8feefa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-10 15:00:00 +00:00
Brian Wilkerson 7d7596fe3a Ensure we have a matcher score for every suggestion
Change-Id: I1b2ae695deeaec05d11ca40d1367883667e4fee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370300
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-10 14:59:04 +00:00
Keerti Parthasarathy 5e595d3374 Add a validator for pubspec.yaml workspace field.
BUG: https://github.com/dart-lang/sdk/issues/55915

Change-Id: I42dc1e2986a55a8e0ee0505cbfa6b3e2dbcbca85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370066
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-06-10 14:46:20 +00:00
Sam Rawlins 38e60413a0 linter: move tests for three rules
* library_prefixes
* no_leading_underscores_for_library_prefixes
* package_prefixed_library_names

Change-Id: I641a547d572abc5001d42ceaed0dd216e0d07338
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370460
Auto-Submit: Sam Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-10 14:33:07 +00:00
Martin Kustermann e18c43a21e [dart2wasm] Add dart2wasm-asserts-* configurations
Our tests (including code in core libraries) are never run with
assertions enabled.

=> Add the necessary configuration support in test_matrix.json
=> We'll then add a new builder running one configuration with asserts.

Change-Id: Id1bc27ddf7d683846510af4711679ad14f0e4168
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370620
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-10 14:24:12 +00:00
Jens Johansen 2645665183 [vm_service] Skip vm_service/test/coverage_closure_call_after_optimization_test.dart in aot
Change-Id: I03e8445064b54ec2f9b19b0440b691e6835fab83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370600
Commit-Queue: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-06-10 13:46:25 +00:00
Johnni Winther b6249b851f [cfe] Introduce compilation unit
This adds CompilationUnit as a supertype of LibraryBuilder as a
first step towards splitting libraries from compilation units.
The SourceLoader._builders are now compilation units and lookups
in to the SourceLoader are split into compilation units, loaded
library builders and source library builders.

Change-Id: If9958a5a67443170cc1a538106d9efd424e36889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369643
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-06-10 13:41:24 +00:00
Jens Johansen 911b8d11a7 [vm] RecordCoverageInstr isn't dead code
Dead Code Elimination can remove `RecordCoverageInstr`, but shouldn't.
This CL makes it stay by returning true in `HasUnknownSideEffects`
making `MayHaveVisibleEffect` return true, making Dead Code Elimination
keep it.
Note that `RecordCoverageInstr::Canonicalize` will still let it go away
if the position is already covered which is what we want.

Bug: https://github.com/dart-lang/sdk/issues/42061

TEST=pkg/vm_service/test/coverage_closure_call_after_optimization_test.dart,vm/cc/IL_RecordCoverageSurvivesOptimizations

Change-Id: Ifd72f9071a51924fd71f3dae91687acb1467047d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370220
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-06-10 13:02:28 +00:00
Martin Kustermann e7239ff03c [dart2wasm] Specialize is/as checks for interface types
Currently if we have a `<obj> is/as Iterable<T>` check we will

  * allocate a `WasmArray<_Type>` array and put value for `T` in it
  * allocate a `_InterfaceType` object with the array as type arguments
  * call to RTT which is looping over the type arguments array

With this CL we recognize in the compiler if we generate tests against
interface types and specialize the most common cases (0, 1 or 2 type
arguments). This in return will make us

  * call to 0/1/2 specialized RTT isInterfaceSubtype implementation
    which will use unrolled loops to do the checking.

=> We avoid allocation of `_InterfaceType` always
=> We avoid allocation of `WasmArray<_Type>` for length=0/1/2
=> We have faster checking due to unrolled loops.

(It is very unlikely binaryen can achieve the same, as it would
need to do very aggressive inlining & loop unrolling to get to the
same result. If we'd force it to inline then every is/as check
would be very large).

Issue https://github.com/dart-lang/sdk/issues/55516

Change-Id: Ia99548d514683f678178ea30d07aeb742ae914ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370260
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-10 11:27:51 +00:00
Martin Kustermann 54ab47ec82 [dart2wasm] Refactor RTT type checking implementation
We make the compiler emit a special index (namely 0) into the
canonical type argument substitution table iff no substitution has to be
performed.

This is very common:

    ```
    class List<T> implements Iterable<T> {}
    ```

=> The translation of the type arguments from `List` to those of
   `Iterable` is a NOP and can therefore be skipped.

Issue https://github.com/dart-lang/sdk/issues/55516

Change-Id: I16ad8d7196656dddeba15801e80c2e23ae0af51b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370242
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-06-10 10:49:58 +00:00
Sigurd Meldgaard efa782d1ba Bump pub to 61716827b14e1848d82f1070ed5be881650c511d
Changes:
```
> git log --format="%C(auto) %h %s" 75ab224..6171682
 https://dart.googlesource.com/pub.git/+/61716827 Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group (4298)
 https://dart.googlesource.com/pub.git/+/0ecaae85 Handle whole workspace in dependency_services (4294)
 https://dart.googlesource.com/pub.git/+/bde31408 Avoid quoting null constraint (4293)
 https://dart.googlesource.com/pub.git/+/ddaf829c Remove a stale statement in a doc comment (4292)
 https://dart.googlesource.com/pub.git/+/61aea102 await exit code in publication test (4289)
 https://dart.googlesource.com/pub.git/+/4287a77c Also use absolute path in solve report, when root is a parent (4287)
 https://dart.googlesource.com/pub.git/+/d165b5fa Handle file system error 17 (EEXIST) on linux and macos (4286)
 https://dart.googlesource.com/pub.git/+/e48f9797 Include all directories in published tar.gz archive (4283)
 https://dart.googlesource.com/pub.git/+/2dd60e10 Test that consuming packages out of their workspace context works (4282)
 https://dart.googlesource.com/pub.git/+/d67d08e7 Test publishing from workspace (4280)
 https://dart.googlesource.com/pub.git/+/c9563e3c Include empty directories in published archives (4278)

```

Diff: https://dart.googlesource.com/pub.git/+/75ab224376e80e918d3c53494a36d4bf8a2f2af6..61716827b14e1848d82f1070ed5be881650c511d/
Change-Id: I679f2f4229c28970d33774eea17c08263abc3879
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370502
Reviewed-by: Sarah Zakarias <zarah@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2024-06-10 10:34:42 +00:00
Sarah Zakarias 5e76f788a5 [pkg:meta] Add topics to pubspec.yaml
Closes https://github.com/dart-lang/sdk/pull/55923

GitOrigin-RevId: e4322c06820f99013464cc37dfa291f345aad686
Change-Id: I6bb9e7c9c6c2d8c823d49c098acf4c62fd2181b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369528
Commit-Queue: Sarah Zakarias <zarah@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-10 10:27:36 +00:00
Chloe Stefantsova d34dbe232a Revert "[cfe] Account for compilation stage in invocations post-processing"
This reverts commit d31d0f9618.

Reason for revert: The CL breaks some tests in google3.

Original change's description:
> [cfe] Account for compilation stage in invocations post-processing
>
> Closes https://github.com/dart-lang/sdk/issues/55849
> Closes https://github.com/dart-lang/sdk/issues/55755
>
> Change-Id: I471830cafed76ec5c503fe726ade857c007ed712
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369063
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>

Change-Id: Ia0fa3002a46352b15f42166188c32821897841ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370480
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2024-06-10 09:13:59 +00:00
Martin Kustermann d32e2ece05 [dart2wasm] Move StackTrace.current for as checks into shared runtime code
When an implicit or explicit `as` check fails we throw a [TypeError]
exception with a stack trace. Though that stack trace doesn't really
have to have the top-frame being where the check failed, it's fine if
there's an additional frame from the runtime code that actually throws
the exception.

Doing so removes `StackTrace.current` from every `as` check and
therefore reduces size.

Change-Id: Ia34b59ebaa54b8cdcd2dc7b153a1e4e2fe1dd0e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370340
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-10 07:11:05 +00:00
Martin Kustermann 1e607007cd [dart2wasm] Optimize RTT data structures
This CL optimizes the RTT data structures by

* Having a canonical table for substitution arrays
* Stores the (canonical) substitution index to use right next
  to the super class id, thereby
* Removing an indirection when looking up substitutions

See more information in `sdk/lib/_internal/wasm/lib/type.dart`

This reduces
  * `Hello.Compile.Size.wasm.opt` by ~ 4%
  * `FluteComplex.Compile.Size.wasm.opt` by ~0.5%

Issue https://github.com/dart-lang/sdk/issues/55516

Change-Id: If0a50780a9a604886bd67a08a2f345103f0bcb32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369641
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-08 20:07:36 +00:00
pq 6424397cbf quick fix for STATIC_OPERATOR
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I41dd40a11e98340dc90f3673c8c6b37e3bf3d7f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370161
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-08 19:57:46 +00:00
Martin Kustermann dd89732126 [dart2wasm] Make implicit arguments check use optimized is/as helpers
The implicit covariance type checks are currently performed by always
calling out to RTT. Those can use our existing optimized implementation
for is/as checks.

This reduces code size of -O2 mode as well as makes certain
benchmarks significantly faster (e.g. UIMatrix* 2x faster)

Change-Id: Ib5224a310b2188b9edb2de1e800d2e60010d11f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370280
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-08 10:29:25 +00:00
Kallen Tu 07d2288908 [wildcard-variables] Add a test on unnamed optional parameters with no default value.
Bug: https://github.com/dart-lang/language/issues/3807
Change-Id: Ibeb29d3702b74379b64e8965c3ef9709c7bf2f41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369780
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-06-07 22:02:17 +00:00
Devon Carew cb64e64ccc [third_party/pkg] put package:dap and package:language_server_protocol under analysis
Change-Id: Ie1a48956055fa0f4ebcd85e5d2b762021fc074d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370101
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
2024-06-07 19:33:13 +00:00
Sam Rawlins d5333825f7 analyzer/frontend: fix broken doc links
Work towards https://github.com/dart-lang/sdk/issues/49042

Change-Id: I05203f65b8e47871ddf7a651d590db9512d1724a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370142
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Sam Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-06-07 19:12:49 +00:00
Stephen Adams b42bd24b78 Clean up DateTime tests
Followup to fb057ea4e0

Now that the web implementation of DateTime supports microseconds, the test special cases for not supporting microseconds can be removed.

Change-Id: I10991b25e42d643ae58850d7190621c9d11877b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367680
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2024-06-07 17:58:32 +00:00
Devon Carew 8a65c5056a [triage] contribute an issue triage github workflow
Change-Id: I9b4122bed37b2e4ef3b7c0dcc3c840ebfb2d5fc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370160
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2024-06-07 16:07:30 +00:00
Danny Tuppeny 216a14b599 [analysis_server] Avoid using stale LineInfos immediately after overlay updates
This fixes a bug where a semantic tokens request could use an incorrect LineInfo for mappings if sent immediately after an overlay update because:

a) we computed a LineInfo from the source instead of using one consistent with the resolved unit
b) we read the file state in a way that did not take into account the latest overlay updates if the analysis driver hadn't handled the changed file

The second issue could affect other requests too because server.getLineInfo() is used in a number of places (to support plugins). This change reverts reading the file state directly, but also updates semantic tokens to prefer using the LineInfo from the resolved unit when we have one (only falling back to computing one from current sources for non-Dart files, which can be handled by plugins).

Fixes https://github.com/dart-lang/sdk/issues/55084

Change-Id: I77ab6ad63a78ebd062b264d901a9ae8568b9096e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370021
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-07 14:34:00 +00:00
Sergey G. Grekhov 3355365187 [co19] Roll co19 to 8738630ac89dd2433b5be27157ae607ce46a7e9a
2024-06-07 sgrekhov22@gmail.com Fixes dart-lang/co19#2704. Fix typo in LanguageFeatures/Wildcards/initializing_formals_A01_t01 (dart-lang/co19#2705)
2024-06-07 sgrekhov22@gmail.com Fixes dart-lang/co19#2702. Fix parameter name in co19/Language/Functions/Formal_Parameters/Optional_Formals/name_t01 (dart-lang/co19#2703)
2024-06-06 sgrekhov22@gmail.com Fixed dart-lang/co19#2698. Update tests to check a setter (dart-lang/co19#2699)
2024-06-01 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.4 to 4.1.6 in the github-actions group (dart-lang/co19#2695)
2024-05-31 sgrekhov22@gmail.com dart-lang/co19#2641. Add initializing formals tests (dart-lang/co19#2686)

Change-Id: I3f2ca2583ac8d4bf1d4f4c5055895c48fe4824e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370241
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-06-07 13:05:49 +00:00
Sam Rawlins 6c6b1040b4 linter: Allow each LintRule multiple categories
Spelled out at https://github.com/dart-lang/linter/issues/1020

Fixes https://github.com/dart-lang/linter/issues/1020

This CL does not change the categories/groups that any rule has. We
can add/change categories in later CLs.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Ief2856a6c472492bbad19fc95df172ef8d19fe7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369861
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-07 06:18:00 +00:00
pq 63d6e6f607 quick fix for NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I9576105618d0201b4fdc339361b6c164870267b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-06-07 00:59:39 +00:00
pq a1b42e1dae quick fix for STATIC_CONSTRUCTOR
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I3bfea0a3a300a478c80d64b0813c8cb5e9024227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-06 23:21:35 +00:00
pq e8939b0ff0 quick fix for SETTER_CONSTRUCTOR
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I0984ef126107974a611c2582402e4498514377d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370061
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-06 22:15:33 +00:00
Kallen Tu 76c0e85789 [cfe][wildcard-variables] Remove local _ from scope.
Local variables named `_` are no longer in scope and can't be used when the wildcard variables experiment is enabled.

Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I13a7a9fcfb92e4b64bd51b5ccfe657f5a0633233
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369507
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-06-06 21:39:03 +00:00
pq 5575aa0823 RemoveLexeme producer + quick fix for GETTER_CONSTRUCTOR
* Generalizes `RemoveExtraModifier` to a new `RemoveLexeme` producer that works for keywords and modifiers.

* Adds a new (keyword) quick-fix for the `GETTER_CONSTRUCTOR`


See: https://github.com/dart-lang/sdk/issues/55917


Change-Id: I0e7fbc33aa970f0754c9533b3ecbd4e9dd9ddb30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370100
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-06 19:51:40 +00:00
Konstantin Shcheglov dc1130663f Macro. Issue 55910. Use 'exportNamespace' for resolveIdentifier().
Bug: https://github.com/dart-lang/sdk/issues/55910
Change-Id: Id1bf92ca2b95a33cd4feaf79e6c0a31f6d811c8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370102
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-06-06 19:27:09 +00:00
Devon Carew 20996acdc5 [deps] rev crypto, dartdoc, http, logging, test, tools, web_socket_channel, webdev, yaml_edit
Revisions updated by `dart tools/rev_sdk_deps.dart`.

crypto (0a10171..7a9428a):
  7a9428a  2024-06-04  Kevin Moore  Bump lints dep (dart-lang/crypto#172)

dartdoc (45627f9..ddb8fb4):
  ddb8fb44  2024-06-03  Konstantin Scheglov  Use package:analyzer/source/source.dart (dart-lang/dartdoc#3780)

http (7bfbeea..a3567f8):
  a3567f8  2024-06-05  Brian Quinlan  Prepare to release cronet_http 1.3.1 (dart-lang/http#1228)
  7addc61  2024-06-05  Hossein Yousefi  [cronet_http] Upgrade jnigen to 0.9.2 to close `#1213` (dart-lang/http#1225)
  eb87a60  2024-06-04  Anikate De  pkgs/ok_http: Close the client (override `close()` from `BaseClient`) (dart-lang/http#1224)
  9f022d2  2024-06-04  Anikate De  pkgs/http_client_conformance_tests: add boolean flag `supportsFoldedHeaders` (dart-lang/http#1222)
  90837df  2024-06-03  Anikate De  pkgs/ok_http: Condense JNI Bindings to `single_file` structure, and add missing server errors test (dart-lang/http#1221)

logging (73f043a..dbd6829):
  dbd6829  2024-06-04  Sarah Zakarias  Update `topics` in `pubspec.yaml` (dart-lang/logging#165)

test (2464ad5..83c597e):
  83c597e5  2024-06-05  Jacob MacDonald  enable asserts in dart2wasm tests (dart-lang/test#2241)
  60353804  2024-06-04  Nate Bosch  Remove an unnecessary `dynamic` (dart-lang/test#2239)
  43ad4cd8  2024-06-03  Kevin Moore  random cleanup (dart-lang/test#2232)
  18db77c3  2024-06-02  Kevin Moore  prepare to publish test_api (dart-lang/test#2238)
  cd72e8d8  2024-06-02  Kevin Moore  Prepare to publish (dart-lang/test#2237)
  9c6adaa7  2024-06-01  Kevin Moore  fixes (dart-lang/test#2235)
  0110a80b  2024-06-01  dependabot[bot]  Bump the github-actions group with 2 updates (dart-lang/test#2236)
  b1b2c029  2024-06-01  Martin Kustermann  Fix `dart run test -p chrome -c dart2wasm` (dart-lang/test#2233)

tools (86b3661..4321aec):
  4321aec  2024-06-05  Andrew Kolos  [unified_analytics] Suppress any `FileSystemException` thrown during `Analytics.send` (dart-lang/tools#274)
  e5d4c8b  2024-06-03  dependabot[bot]  Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group (dart-lang/tools#271)

web_socket_channel (45b8ce9..bf69990):
  bf69990  2024-06-03  Thibault Chatillon  bump web_socket dependency 0.1.3 -> 0.1.5 (dart-lang/web_socket_channel#370)
  5b428dd  2024-06-02  dependabot[bot]  Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group (dart-lang/web_socket_channel#371)
  afd1e3c  2024-05-23  Brian Quinlan  Remove `--fatal-infos` from `dart pub downgrade` analysis (dart-lang/web_socket_channel#367)
  cb20b71  2024-05-23  Sarah Zakarias  Add `topics` to `pubspec.yaml` (dart-lang/web_socket_channel#362)
  8514229  2024-05-22  Kevin Moore  Bump and fix lints (dart-lang/web_socket_channel#366)

webdev (a97c2a1..9ada46f):
  9ada46fc  2024-06-05  Nicholas Shahan  Hide more temporary variables when debugging (dart-lang/webdev#2445)

yaml_edit (963e7a3..08a146e):
  08a146e  2024-06-06  Kavisi  Fix splice list insertion (dart-lang/yaml_edit#84)
  561309e  2024-06-01  dependabot[bot]  Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group (dart-lang/yaml_edit#85)
  b582fd5  2024-05-31  Kavisi  Fix error thrown when inserting keys (dart-lang/yaml_edit#80)

Change-Id: I36acbc26fe97d8a1e3fdfa5f4855cc4be7d84dd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370080
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-06-06 19:18:22 +00:00
Paul Berry c007d3bc0c Front end: type infer all record literal fields before hoisting.
Previously, if a record literal had named fields, type inference of
the literal fields would happen as part of the process of
hoisting. This was a problem because the hoisting process requires
visiting the fields in reverse order, so as a result, the order in
which subexpressions were type inferred was the reverse of the order
in which they would be executed, leading to unsound type promotion
behavior.

Fixes #55914.

Bug: https://github.com/dart-lang/sdk/issues/55914
Change-Id: I2d8930e0e1d7579d065bfb850aa7472d28a8012c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369761
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-06-06 19:15:57 +00:00
Ben Konyi 8e00ebc689 [ CLI ] Fix snapshot detection logic for google3
google3 makes heavy use of symlinks, with no guarantee that the relative
location of files with respect to each other will be maintained after
the symlinks are resolved. This causes issues when trying to locate the
DartDev snapshot using the VM executables resolved path as a base.

This change updates the DartDev snapshot detection logic to first try to
find the snapshot using the resolved executable path before falling back
to using the unresolved path used to launch the VM (e.g., the path
specified by argv[0]).

TEST=pkg/dartdev/test/

Change-Id: I19a41c440ac82cbc671dafb3bda23a31fb4cdc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370000
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-06-06 19:10:19 +00:00
Keerti Parthasarathy cf0646d4c3 Update completions for pubspec with workspace related keywords.
BUG: https://github.com/dart-lang/sdk/issues/55915

Change-Id: Ic9b0e9f1d4b4e588778137b5affd593550bf678c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369768
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-06 18:25:53 +00:00
pq 741e1e2036 quick fix for INVALID_USE_OF_COVARIANT_IN_EXTENSION
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I1fac6f8f1bcdb0e2ede3f7766c24ada1ee037f45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370060
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-06 17:09:30 +00:00
Konstantin Shcheglov 31a9236cfb Macro. Serialization for MacroExecutionResult(s).
Bug: https://github.com/dart-lang/language/issues/3877
Change-Id: I7897bdf27a17d004b810409ad9c2ac76bb8677b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369842
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-06-06 16:12:31 +00:00
Sam Rawlins e04c53d5ac meta: add TargetKind to @factory
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I5c0608637f2feb9986e890f3c83cf02884bef7f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369789
Commit-Queue: Sam Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-06 15:39:56 +00:00
pq 3f47c93b8c quick fix for EXTERNAL_TYPEDEF
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I3826969b5f20b2140fb522ab1882e5f2330cab5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369881
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-06-06 14:45:58 +00:00
Chloe Stefantsova d31d0f9618 [cfe] Account for compilation stage in invocations post-processing
Closes https://github.com/dart-lang/sdk/issues/55849
Closes https://github.com/dart-lang/sdk/issues/55755

Change-Id: I471830cafed76ec5c503fe726ade857c007ed712
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369063
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-06-06 11:58:30 +00:00
Johnni Winther c5cd8ff349 [cfe] Remove agnostic mode
The agnostic mode was added to allow the platform dill embedded in
the VM to support both weak and strong mode. Since weak mode is no
longer supported in the VM, the agnostic mode can new be deleted.

All uses of the agnostic in Dart and Flutter have been removed prior
to this change.

Change-Id: Iff0f69d9cd64e887e01cd7e7d336a97761bd6d4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366801
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-06-06 11:02:37 +00:00
Tess Strickland d06d627c79 [vm] Remove --[no-]lazy-dispatchers flag.
No client of the VM uses this flag, only tests, and this flag was always
set to false in AOT mode. Thus, remove uses of this flag and instead
always lazily create dispatchers as needed when resolving method names
in JIT mode.

Remove the implicit value of `allow_add` for some Resolver
static methods. For callers that previously depended on the implicit
`true` value (which includes the AOT precompilier), pass `true` for
uses in the compiler and pass `!FLAG_precompiled_mode` for uses in the
runtime. Assert that `allow_add` is false when these methods are invoked
from the precompiled runtime.

Remove Resolver static methods that are no longer used.

TEST=ci

Change-Id: Ib6a7354f7a859e86743c381513a4129c14895753
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-mac-debug-arm64-try,vm-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366668
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-06-06 10:56:12 +00:00
Tess Strickland d7e6e0e8c3 [vm/compiler] Fix dart fuzzer CalculateElementAddress crash on X64C.
In the backend, handle the following cases that were assumed not to
happen before:
* If the index and offset are both 0, then the operation is a no-op
  and so the output register should be the same as the first input.
  (Should only happen if the instruction is used in a non-optimizing
  context, as otherwise it is removed by canonicalization.)
* If the scaled index can be used as an instruction immediate and the
  offset is 0, then emit the appropriate instruction(s).
* If the scaled index and offset can both be used as immediates to
  instructions, but their sum (the total offset in bytes) cannot, then
  allocate a register for the index and fall back to the non-constant
  index case.

CalculateElementAddress::Canonicalize now only performs removal of
no-op instructions.

This CL also fixes a switch on the instruction tag in
FlowGraph::RenameRecursive to appropriately convert UnboxedConstant
instructions to initial definitions of the FlowGraph as it already does
for Constant instructions.

TEST=vm/dart/regress_55877

Issue: https://github.com/dart-lang/sdk/issues/55877
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-debug-simriscv64-try,vm-mac-debug-arm64-try,vm-aot-mac-release-arm64-try
Change-Id: I613d6c8770fe02facf6bbdb3d2b11f842b51540d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369642
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-06-06 09:14:18 +00:00
pq d91f05c1c7 quick fix for EXTERNAL_ENUM
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I0f60078bfcb3ae5ab6d559a9e2314abe209726bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-06-06 03:42:03 +00:00