Commit Graph

106478 Commits

Author SHA1 Message Date
Danny Tuppeny 5e62d29bf5 [analysis_server] Add 'range' to EditableArguments response
See https://github.com/flutter/devtools/issues/9035

Change-Id: Ia2cadea05f10f16e00d1dbf0240b16761c0c6b0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-01 10:50:07 -07:00
Konstantin Shcheglov 9e3239652e Elements. Deprecate TypeParameterizedElement.
Change-Id: I4c6df544c8134eadf5ec2d0e3f3c5780d1ce1f58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418909
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-01 10:49:07 -07:00
Paul Berry d7fa12fbe2 [analyzer] Lock down the behavior of ResultComparator with unit tests.
In a follow-up CL, I intend to rewrite `ResultComparator` in a way
that doesn't depend on its base class, `AstComparator` (so that
`AstComparator` can be deleted). This change prepares for the rewrite
by adding unit tests for `ResultComparator`.

I've discovered some bugs in `ResultComparator` in the process:

- The failure messages reported when one of the two nodes was `null`
  were reversed. I've gone ahead and fixed this as part of this CL,
  since the fix was easy and didn't affect any tests beyond the tests
  that I've added.

- The failure message reported when a node had the wrong type
  contained an unnecessary newline. I've gone ahead and fixed this as
  part of this CL, since the fix was easy and didn't affect any tests
  beyond the tests that I've added.

- When comparing identifiers, if the actual identifier is a synthetic
  identifier, and the expected identifier is any identifier at all,
  the identifiers are considered to match. This is clearly not the
  intended behavior; the intended behavior is that the expected
  identifier must be `_s_` to match a synthetic identifier. I've
  documented this bug with a TODO, which I'll address in a follow-up
  CL.

- When comparing comments, only the references inside the comment are
  compared; the text of the comment is ignored. This seems
  inconsistent with the other behaviors of `ResultComparator`, and I'm
  pretty sure it's not necessary. I've documented this bug with a
  TODO, which I'll address in a follow-up CL.

Change-Id: Iba0169ded812d646b71966c2be22174d787c5a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419424
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-04-01 10:38:50 -07:00
Konstantin Shcheglov b18aad8f0d Fine. Extract InstanceItem and InterfaceItem.
Change-Id: I3678aeba2da34805119c9b3c22603618bea9e10e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419360
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-01 10:32:39 -07:00
Mayank Patke 66666c39a1 [dart2js] Add extension type to distinguish flags and powersets
Change-Id: I516cd7f0e6a03b680a399c483ef93d1e1d6cbeee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417911
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2025-04-01 10:28:58 -07:00
Mayank Patke ee48eb7c84 [dart2js] Ensure all flat typemasks are normalized at construction.
Because certain union cases weaken the type constraint (the kind), it
was unsafe to pass the full set of flags rather than just the powerset.

Change-Id: Ia4a65d539669acbe696bc237230eb84a4b7d8c99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417951
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-04-01 10:28:58 -07:00
Konstantin Shcheglov d6e1fe5e7f Elements. Deprecate TypeDefiningElement.
Change-Id: Ibb24c4b509eb86efe2f82fdf1c05acdb9bb403bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418834
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-01 10:23:59 -07:00
Danny Tuppeny 21c0584631 [analysis_server] Allow allowOverlappingHandlers to be controlled via initializationOptions
For troubleshooting, this allows the client to override this flag.

I'd originally planned to use ClientConfiguration for this and allow it to be changed on-the-fly, however this can result in a mix of requests and therefore I decided it best to only support setting once during startup (which is part of initialization, and therefore before general requests start being sent).

This will require some Dart-Code work to provide a value here (and without a value, it will always be the servers default).

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

Change-Id: Ie9843543d6d491afb046f3d1106211b7db852605
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-04-01 10:15:49 -07:00
Danny Tuppeny 0476f21604 [analysis_server] Mark editableArguments / editArgument as not-experimental
This should not be landed until after https://github.com/flutter/devtools/pull/8990 lands and is included in the version of DevTools in the Dart SDK.

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

Change-Id: I19a72ef0e3680aa620d47f8f9556e38b90a98aa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-01 10:08:56 -07:00
Ryan Macnak 0bed1ac7f1 [test] Disable the background compiler during vm/cc/DartAPI_OptimizedExternalByteDataAccess.
This avoid racy access to the optimization counter threshold.

TEST=tsan
Change-Id: I5bba52e88957022007060893159e26ebe47e40a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419421
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-04-01 09:56:48 -07:00
Ryan Macnak 4ab313cf09 [vm, test] Enable some AOT testing for Fuchsia.
Fix the standalone embedder's ELF loader to open files with the executable permission.

TEST=ci
Bug: b/399714829
Bug: https://github.com/dart-lang/sdk/issues/60442
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Change-Id: I2652a5849462ce63585550e6c581cc578a228955
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419341
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zijie He <zijiehe@google.com>
2025-04-01 09:50:12 -07:00
Paul Berry 9cd4cdf351 [analyzer] Fix failing ParameterListTest cases.
These test cases were broken by
https://dart-review.googlesource.com/c/sdk/+/252566 and were marked
with `@failingTest`.

The reason for the breakage was that the aforementioned CL changed the
implementation of `AstComparator.visitSimpleFormalParameter` so that
it compared the parameter's names using `isEqualTokens` rather than
`isEqualNodes`. When this logic is used by `ParameterListTest`,
`isEqualTokens` and `isEqualNodes` are being overridden by methods in
the derived class `ResultComparator`, and one of the special behaviors
of `ResultComparator.isEqualNodes` is to allow the simple identifier
`_k_` to be substituted for a keyword token.

To fix the test, this special behavior needs to be moved from
`ResultComparator.isEqualNodes` to `ResultComparator.isEqualTokens`.

This paves the way for a follow-up CL in which I plan to rewrite
`ResultComparator` so that it doesn't depend on `AstComparator`; that
in turn will allow `AstComparator` to be rmoved.

Change-Id: I8434c7c694e1e5c613df62bf34ee69126fb0c2ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-01 09:42:32 -07:00
Danny Tuppeny 36faa9a61a [analysis_server] Support running server tests from source through the test runner
When running tests from source (by setting the `TEST_SERVER_SNAPSHOT` env variable to `"false"`), we used `Platform.script` to locate the server script, however this fails when running the test through `dart test` (see https://github.com/dart-lang/test/issues/110).

This changes to using `Isolate.resolvePackageUri` to locate the root instead.

Fixes at least some of https://github.com/Dart-Code/Dart-Code/issues/5471.

Change-Id: I8a4ad408d3323d479b1ba2be3c224e4026d12f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-04-01 09:39:45 -07:00
Sam Rawlins aa21742d03 CHANGELOG: Add analyzer entries; organize
Change-Id: I11f340704b2e393c53c611f52accadea6d665dea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419241
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-01 09:27:15 -07:00
Konstantin Shcheglov 007bd5d6c0 Elements. Deprecate TypeParameterElement.
Change-Id: I2f4c22fb4928cb5f296a190d7c165a3887d9eeae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418833
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-04-01 09:18:01 -07:00
pq 46699a91d0 [das] allow interleaved requests in the message scheduler
Includes a new `allowOverlappingHandlers` flag to support re-disablement as discussed w/ Danny.

Bug: https://github.com/dart-lang/sdk/issues/60440
Change-Id: I007f0276bf8cdbfd418ea5dacb251db3eef8dd3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-04-01 09:11:43 -07:00
Sigmund Cherem 44f8e21c82 [kernel] Adds helper to trim dill files for modular dependencies.
Introduce a helper library to trim components based on what we believe
it is needed for modular bytecode compilation. The script is configured
to accept a set of entry points, so unreachable libraries can be removed
entirely. The contents of the retained libraries is trimmed to remove
method bodies, constructor bodies, and initializers, except for where
they may be needed.


In the near future, this should be expanded to:
* include proper unit testing in the CFE
* review whether additional trimming operations can be made
* consider an explicit representation of trimmed content, to help the
  CFE recover when assumptions are not met (e.g. sentinel markers
  to establish whether a value has been trimmed)
* CFE produces trimmed data directly if needed, without having to first
  produce the full dill.

Tests that specifically stress that we don't over-trim include:
apply_mixin (requires preserving method bodies), const_body (requires
preserving initializers).

TEST=existing and new e2e dynamic module aot tests.

b/394936876

Change-Id: I26db8385bdfe1664b2aea234ec8bb896c7c21230
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418702
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-04-01 08:49:11 -07:00
Konstantin Shcheglov b46ee2cee8 Elements. Deprecate TypeAliasElement.
Change-Id: I0cbcb9e3cf0fac76ebed59cabc4dc4b5205c78ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418908
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-04-01 08:01:09 -07:00
Konstantin Shcheglov c94331f6ed Elements. Deprecate FunctionTypedElement.
Change-Id: I76ffe0f5812dbc1c71e6fb609b1b8c23fc35a9f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418907
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-01 07:06:01 -07:00
Ömer Ağacan dad797e04a [dart2wasm] Remove unused default states in br_tables in state machines
When generating the `br_table` for the state machines in `sync*` and
`async` functions, we currently generate a default state (required by
`br_table`) with an `unreachable` instruction.

Instead, remove the default state and make the last state in the
function the default state.

This saves a few instructions per `sync*` and `async` functions.

Issue: https://github.com/dart-lang/sdk/issues/60433
Change-Id: Ie89c3581304a97082628b150cc5604f9e4c2849e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419540
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-04-01 05:01:13 -07:00
Martin Kustermann bc76743c0f [dart2wasm] Move canonicalization of symbols to one place
Only in `Function.apply` we have the problem of determining
the order of named parameters for calling the closure. In all
other cases, the compiler can ensure the caller and callee
agree on the order.

There's one place where we determine this order. That place
can also be used to swap out user-provided `new Symbol()`s that
were passed to `Function.apply` with the canonicalized
`const Symbol()` instances the compiler uses for the
closure functions.

Doing so allows us to use `identical()` for symbol comparisons
everywhere else in the system.

Change-Id: Ib9833e708ba197c8b9ef18ef4bf9e7a64bdf9a40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419201
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-04-01 04:28:30 -07:00
Martin Kustermann e40980cb3d [tfa] Fix bug in TFA transformation of unused fields
When a TFA eliminates a field it moves it's initializer to a
`LocalInitializer` of the constructor. After [0] the
`VariableDeclaration` of the local initializer will get the type of the
field.

Though that CL didn't ensure TFA also visits the type of the
`VariableDeclaration`. This can lead to a situation where the type
refers to a class that TFA has tree shaken, which causes dangling
references in the AST.

[0] https://dart-review.googlesource.com/c/sdk/+/415201

Issue https://github.com/flutter/flutter/issues/166124
Issue b/406692736

TEST=pkg/vm/testcases/transformations/type_flow/transformer/write_only_field

Change-Id: Ieb8f5c4daedd314c613617218da898059bb6941a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419542
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-04-01 04:22:37 -07:00
Tess Strickland 3d0a29d159 [vm/compiler] Allow Slot::Equals to be used with native slots.
Before this change, Slot::Equals would hit the default UNREACHABLE()
case if used to compare two equal native slots. That's surprising and
also unavoidable if code comparing arbitrary slots wants to check Slot
equality, since there's no existing predicate to determine whether an
arbitrary slot is native.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-linux-product-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-mac-release-arm64-try
Change-Id: Ia794a33fc607013bf35435b0427ceb02bdae4b0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419560
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-04-01 03:53:30 -07:00
Jens Johansen 9f42ef774e [analyzer] Add "interactive" option to "getResolvedUnit"; "setSubscriptions" are not; non-interactive ones have less priority
The legacy_many_files_in_flutter_set_subscriptions benchmark shows how
"flutter.setSubscriptions" calls can make the analyzer slower to
respond.

What happens is this:

* The user opens a new file in the IDE.
* The IDE sends the `flutter.setSubscriptions` request which equates to
  a call to `getResolvedUnit` for each file in the request. If this is,
  say, 300 files it's 300 calls to `getResolvedUnit`.
* The IDE sends a `edit.getAssists` request for the newly opened file.
  This request starts processing, reaches `getResolvedLibrary(file)`
  which calls `getUnitElement` ultimately adding the path to
  `_unitElementRequestedFiles` which in `performWork` is done _after_
  `_requestedFiles`, meaning it has to do all the flutter requested
  files first.
* The user might then request completion for instance, but because the
  analyzer only processes one request at a time it has to wait for the
  `edit.getAssists` request to finish first, which had to wait for the
  files from the `flutter.setSubscriptions` request to process.

All in all it's a lot of waiting for the user.

This CL adds a `interactive` option to the `getResolvedUnit` call. It
defaults to true in which case files are still added to
`_requestedFiles` and processed the same. If it's false it will instead
be added to a newly introduced list instead and processed at a lower
priority. Subscription requests are changed to pass `false` to
`interactive`, avoiding the scenario above.

Comparing before this CL with this CL on the
"legacy_many_files_in_flutter_set_subscriptions" benchmark with 100
files / CodeType.ImportChain these are the statistics on the changes
based on 5 runs each:

```
Completion after open of new file: -81.6652% +/- 7.7564% (-3.70 +/- 0.35) (4.53 -> 0.83)
getAssists call: -96.6315% +/- 0.9307% (-3.61 +/- 0.03) (3.74 -> 0.13)
peak virtual memory size: -5.6786% +/- 3.2964% (-139.00 +/- 80.69) (2447.80 -> 2308.80)
total program size (virtual): -4.6387% +/- 3.8146% (-110.80 +/- 91.11) (2388.60 -> 2277.80)
```

Even when https://github.com/flutter/flutter-intellij/issues/7980 is
hopefully fixed I think it is a fair change to de-prioritize a
non-interactive request.

Change-Id: Icba2faebf12f9913cf24db7cb90fdc6f4c74164e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2025-04-01 00:56:39 -07:00
Jens Johansen f6fcd37cb8 [analyzer] Add benchmark with plugin that times out
TL;DR: Add benchmark that shows the Dart 3.7
(https://dart-review.googlesource.com/c/sdk/+/386581 specifically)
introduced a regression.

Details: We've observed that sometimes the plugin that users has
installed times out (takes > 500 ms to answer).

This benchmark simulates that and shows the worse handling of this
introduced in Dart 3.7.

Running 10 iterations each of lsp_with_plugin_that_times_out.dart with
params 10, ImportChain:

Comparing 3.5.4 with 3.6.2

```
Initial analysis: -7.1855% +/- 2.9168% (-0.09 +/- 0.04)
peak virtual memory size: 11.8795% +/- 1.6185% (313.00 +/- 42.64)
total program size (virtual): 12.4293% +/- 1.2818% (323.10 +/- 33.32)
peak resident set size ("high water mark"): -7.4081% +/- 0.9050% (-38.90 +/- 4.75)
size of memory portions (rss): -6.3154% +/- 1.3641% (-32.00 +/- 6.91)
```

I'll note that this is only 10 files and we probably shouldn't put too
much weight on the initial analysis time here. Equivalently memory
probably isn't super interesting.

Comparing 3.6.2 with 3.7.2

```
Initial analysis: -45.8697% +/- 2.7193% (-0.53 +/- 0.03)
Completion call 1: 652.8573% +/- 1.3303% (0.97 +/- 0.00)
codeAction call 1: -0.7637% +/- 0.5174% (-0.01 +/- 0.01)
Completion call 2: 807.2503% +/- 0.7116% (0.89 +/- 0.00)
codeAction call 2: 0.2624% +/- 0.0456% (0.00 +/- 0.00)
Completion call 3: 868.9361% +/- 0.3199% (0.90 +/- 0.00)
codeAction call 3: 0.1433% +/- 0.0287% (0.00 +/- 0.00)
peak virtual memory size: -7.1307% +/- 3.4799% (-210.20 +/- 102.58)
total program size (virtual): -8.1674% +/- 3.5673% (-238.70 +/- 104.26)
peak resident set size ("high water mark"): -1.2546% +/- 0.7151% (-6.10 +/- 3.48)
size of memory portions (rss): -7.6891% +/- 0.9209% (-36.50 +/- 4.37)
```

Again I'll note that this is only 10 files and we probably shouldn't put
too much weight on the initial analysis time here - although we've seen
this improve in other benchmarks too so I do believe we have an
improvement here.
And again memory probably isn't super interesting because of the few
files.
The codeAction calls are basically the same which makes sense: In all
cases it's dominated by the plugin that times out.
The codeAction call does two calls to the plugin and it takes around
1000 ms (a timeout of 500 ms on each plugin call).

Here we see the regression in 3.7 clearly though (cut-out from above):

```
Completion call 1: 652.8573% +/- 1.3303% (0.97 +/- 0.00)
Completion call 2: 807.2503% +/- 0.7116% (0.89 +/- 0.00)
Completion call 3: 868.9361% +/- 0.3199% (0.90 +/- 0.00)
```

Because of https://dart-review.googlesource.com/c/sdk/+/386581 we only
do one request at a time. Before we would interleave the requests,
something like this:

```
Request 1: codeAction:
|--|waiting for plugin|--|waiting for plugin|--|

Request 2: completion:
 |..--|
```

(I'm trying to ascii-draw that when the codeAction is just awaiting the
plugin the completion request can be executed)

Now instead we're doing this:

```
Request 1: codeAction:
|--|waiting for plugin|--|waiting for plugin|--|

Request 2: completion:
 |..............................................--|
```

(I'm trying to ascii-draw that when the codeAction has to finish before
the completion request can be executed)

I'll also note that while it's here shown trough a plugin that times out
the same will likely happen in other circumstances as well. E.g. the
completion resolves with a special call `resolveForCompletion` which in
`performWork` gets priority over other things - but when not
interleaving requests that has very little effect.

For good measure, comparing 3.7.2 with HEAD

```
Completion call 1: 0.6851% +/- 0.2074% (0.01 +/- 0.00)
codeAction call 1: 0.6962% +/- 0.1876% (0.01 +/- 0.00)
peak virtual memory size: -11.7293% +/- 4.7947% (-321.10 +/- 131.26)
total program size (virtual): -12.1763% +/- 4.9125% (-326.80 +/- 131.85)
peak resident set size ("high water mark"): -14.7469% +/- 0.6980% (-70.80 +/- 3.35)
size of memory portions (rss): -10.4518% +/- 0.8927% (-45.80 +/- 3.91)
```

Not a whole lot of change for the time-related things on this benchmark.

Running legacy_with_plugin_that_times_out.dart shows the same thing
(here there's only 1 plugin call instead of 2 though; here only looking
at completion calls):

```
Comparing 3.5.4 with 3.6.2
Completion call 1: -6.1695% +/- 3.6147% (-0.03 +/- 0.02)
Completion call 2: -14.4462% +/- 8.8828% (-0.02 +/- 0.01)
Completion call 3: -16.7707% +/- 7.5412% (-0.03 +/- 0.01)

Comparing 3.6.2 with 3.7.2
Completion call 1: 139.2436% +/- 3.8814% (0.70 +/- 0.02)
Completion call 2: 1128.6580% +/- 14.8207% (1.41 +/- 0.02)
Completion call 3: 589.1425% +/- 11.9186% (0.78 +/- 0.02)

Comparing 3.7.2 with HEAD
no change on completion calls.
```

For fun, lets try to comment out `await completer.future;` in
`pkg/analysis_server/lib/src/server/message_scheduler.dart` that was
introduced in https://dart-review.googlesource.com/c/sdk/+/386581
(again only looking at completion calls):

legacy_with_plugin_that_times_out.dart:

```
Comparing 3.7.2 with HEAD (with commented out await)
Completion call 1: -58.5720% +/- 1.9196% (-0.70 +/- 0.02)
Completion call 2: -82.8149% +/- 1.1050% (-1.27 +/- 0.02)
Completion call 3: -85.6439% +/- 1.5128% (-0.79 +/- 0.01)
```

If looking at the values instead of the percent it looks to almost undo
the change from 3.6.2 to 3.7.2, so let's for good measure compare 3.6.2
with that:

```
Comparing 3.6.2 with HEAD (with commented out await)
Completion call 2: 95.7654% +/- 11.4279% (0.12 +/- 0.01)
```

So one of the calls is slower, but just double, not 10x. I haven't
looked into why.

And for lsp_with_plugin_that_times_out.dart:

```
Comparing 3.7.2 with HEAD (with commented out await)
Completion call 1: -92.9578% +/- 0.5505% (-1.04 +/- 0.01)
Completion call 2: -99.6372% +/- 0.0534% (-1.00 +/- 0.00)
Completion call 3: -99.6370% +/- 0.0429% (-1.00 +/- 0.00)
```

The 1000 ms wait time is gone.

And again let's for good measure compare 3.6.2 with that:

```
Comparing 3.6.2 with HEAD (with commented out await)
Completion call 1: -45.4578% +/- 2.4320% (-0.07 +/- 0.00)
Completion call 2: -96.6303% +/- 0.2481% (-0.11 +/- 0.00)
Completion call 3: -96.2054% +/- 0.3875% (-0.10 +/- 0.00)
```

Here all the completion calls are faster. I haven't looked into why.

Change-Id: I7c312f77b51bb4df68eedeb9bc6e27c2b0175cbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418263
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-31 23:29:39 -07:00
Konstantin Shcheglov fdc469778c Elements. Deprecate ExecutableElement.
Change-Id: Ic66c9df46bfcfe93d2e6bd93315e298eee694533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418831
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 17:29:16 -07:00
Konstantin Shcheglov b18ffd3c43 Elements. Deprecate FunctionElement.
Change-Id: I668284d0b8346728bc529635ef898794fbab2c79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418830
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 17:15:53 -07:00
Konstantin Shcheglov 8455955c6b Elements. Deprecate PropertyAccessorElement.
Change-Id: I6a2cc303fde74044d69d67275e55101be89dd926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418906
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 17:00:31 -07:00
Konstantin Shcheglov 97e5d6c005 Elements. Deprecate MethodElement.
Change-Id: Iaeb9617ffdbd5998a7df2dbbde7049f2d79a7086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418905
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 16:42:28 -07:00
Konstantin Shcheglov e9ddff548a Elements. Deprecate InstanceElement.
Change-Id: I7e1d80c01d90e64cc0e4b43a7ed58ceb7f149883
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418941
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-31 16:36:11 -07:00
Konstantin Shcheglov 30270ba98d Elements. Deprecate InterfaceElement.
Change-Id: I59d5a7d98ebde932f411ba3f6e17da43ebf662e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418940
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-31 16:18:50 -07:00
Konstantin Shcheglov 1a08dac89c Elements. Deprecate ExtensionTypeElement.
Change-Id: Ia86a2b7b543fce9bec19583d7fe5d5d767c52d6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418904
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 15:59:45 -07:00
Konstantin Shcheglov 53d2db7fd3 Elements. Deprecate ExtensionElement.
Change-Id: I467cefb09bf9260aa57f7597726442e1708e9f64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418829
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 15:43:44 -07:00
Konstantin Shcheglov 637355a7e9 Elements. Migrate ElementPrinter.
Change-Id: I712c9da94194656b8e85247e2024b8c0c77bf336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418824
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-31 15:37:13 -07:00
Konstantin Shcheglov 073df7a4fd Elements. Deprecate EnumElement.
Change-Id: I21b51cf2a0eff465dc9725a9477656b7ba2228ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418828
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-31 15:04:59 -07:00
Ben Konyi 138924c1e8 [ dart:io ] Add tmux terminals to list of terminals known to support ANSI
Fixes https://github.com/flutter/flutter/issues/142861

TEST=N/A

Change-Id: I208c597f33c622d19419202351dd17d39ec82bc3
CoreLibraryReviewExempt: only dart:io
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419280
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-03-31 14:31:47 -07:00
Ryan Macnak 92df34dfd5 [build] Remove Fuchsia sub-builds.
The builders at https://ci.chromium.org/p/fuchsia/g/dart/console no longer exist.

TEST=build
Change-Id: I1b801d7892b3e6cba37d7b9549e3d08306cc9723
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417907
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-03-31 13:07:29 -07:00
Konstantin Shcheglov 19c5d0d274 Elements. Deprecate MixinElement.
Change-Id: I03ded956186834561e2ab1ce6ff0626c9f054e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418827
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 11:40:17 -07:00
Alexander Markov 733ca506c1 [dynamic modules] Add pragmas to core library classes and members used to implement language features
This change adds pragmas which can be used in dart:* libraries to
specify classes and members which are used by the compiler
to implement certain language features. Compiler can insert
references to those classes and members when desugaring language
constructs, so dynamic module code can use these classes and members
implicitly even if they are private.

Previously, we required to specify these members in the
dynamic_interface.yaml before dynamic modules could use them.
However, this is cumbersome and error-prone.

Now, the following pragmas are recognized:

@pragma('dyn-module:language-impl:extendable')
@pragma('dyn-module:language-impl:can-be-overridden')
@pragma('dyn-module:language-impl:callable')

If dynamic interface yaml file is specified during compilation,
then classes/members annotated with these pragmas are treated as if
they are used in corresponding sections of dynamic_interface.yaml.

If dynamic interface yaml file is not specified, these pragmas
are ignored.

Bug: b/395992622

TEST=existing
CoreLibraryReviewExempt: no API changes, only adding pragmas.
Change-Id: I6606467fc5e5264a2565d7eb8e8baccc2eebea84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418663
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2025-03-31 11:33:50 -07:00
Mayank Patke 0c422d6d61 [dart2js] Don't use a record key for canonicalized type mask cache.
Bug: #60419
Change-Id: Id3368d69d9590b328dc26b5aa088cf1e7142c5b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418500
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2025-03-31 11:32:14 -07:00
Alexander Aprelev 4a46bed718 [vm/prealloc] Don't preallocate oom, unwind errors, stacktrace object during isolate startup.
For out-of-memory events vm reserves (and if used, then replenishes) small chunk of memory for handling those, so preallocation of oom and stacktrace is not needed.
Unwind error can be created once as part of vm launch, kept in vm isolate.

This should reduce overhead of starting new isolate.

TEST=ci

Change-Id: Ibe2c85f250a521a8e838cc5690984fe9fa287a98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419261
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2025-03-31 11:17:18 -07:00
Konstantin Shcheglov 0fda5de36a Elements. Deprecate ClassElement.
Change-Id: I0bf4a73bacc4917d4f61c91bcdceba41a9c18ec9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418903
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 11:09:38 -07:00
Brian Wilkerson a0d4786adc Update the GitHub template for analyzer issues
This updates the template to apply the correct label to the issue being
created.

Change-Id: I67f2c0d7145dfe98f1907351f88fb1f8d3b723fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418680
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2025-03-31 11:06:21 -07:00
Konstantin Shcheglov 1dcc22fc15 Elements. Deprecate ConstructorElement.
Change-Id: I4182423232709ed2c954cee89ab913bd3bc4453e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418902
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 10:13:20 -07:00
Sam Rawlins bc230b73aa Deprecate the unused importPrefixGenerator parameter of ChangeBuilder.addDartFileEdit
Change-Id: Ic8bad9999359d3670ea58fe9594e744d6560a030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2025-03-31 09:53:57 -07:00
Brian Wilkerson f7f9318db3 Update the Writing Lints document
The document refers to GitHub labels that have been changed. This
updates the references to be complete.

Change-Id: Ib08e3dfaf386997d6bd126708f56584b57a1f5fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418660
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
2025-03-31 09:46:29 -07:00
Konstantin Shcheglov 393bc6439c Elements. Deprecate CompilationUnitElement.
Change-Id: Id2f5258a002967bf4ebdad72997791bdf8ba276a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418826
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 09:33:31 -07:00
Paul Berry 650900448f [analyzer] Rename the element model migration guide.
The new name clarifies that the guide is specifically about element
model migration, not migration in general.

Changing the name now allows us to make links to the guide without
having to worry about updating those links if we change the name
later.

Change-Id: I6860867246b41671c20ecc725fdb2a5f7b77b949
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419240
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-03-31 09:32:10 -07:00
Sam Rawlins 59fee86145 DAS: Rearrange code to promote variables better
The motivation here was to remove the local duplicate variables like
`final_foo` or `foo_final`. These variables only existed because the
variables they duplicate lose their promoted types inside the
`builder.addDartFileEdit` closure. They lose their promoted type
because they are multiply assigned in loops or not always promoted to
be non-null.

Often the fix is to replace a `if (x == null) return` with
`} else { return; }`. I think this code more directly represents the
flow of code, rather than relying on the nullity of a variable, like
"is this variable still null? Oh then we must not have entered any
of the situations above, so we should return."

Change-Id: I9dd6686b7f4d9c6caf59c171179b129a5a957ba8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418160
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-03-31 09:23:29 -07:00
Sam Rawlins d592a7eb26 DAS: Remove dead DartFileEditBuilderImpl code
* Privatize `DartEditBuilderImpl.dartFileEditBuilder`.
* Rename the `toAdd` parameter on `_addAll` to `items`.
* Remove the unused `required` argument on `_canWriteType`.
* Privatize `DartFileEditBuilderImpl.createEditsForImports`,
  `.codeStyleOptions`, and `ensureShown`.
* Remove the unused `useShow` parameter on
  `DartFileEditBuilderImpl.importElementLibrary`.

Change-Id: I473788d9d566a2982914c374fce2429909466381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418703
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-03-31 08:46:20 -07:00