Commit Graph

56623 Commits

Author SHA1 Message Date
Konstantin Shcheglov dbeb7e1e5b Prepare to publish analyzer 13.3.0, _fe_analyzer_shared 103.0.0, analysis_server_plugin 0.3.18, analyzer_plugin 0.14.12, analyzer_testing 0.3.2
Change-Id: I0a5bf96733f2908160a6ef2ee99f54ef25f11547
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511480
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-11 10:59:52 -07:00
Konstantin Shcheglov 4b10d3e1d3 CQ. Remove GatheringDiagnosticListener.
Change-Id: I1d45d3ea4bf0e556851bf943b95076c11158d9cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511300
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-11 10:52:47 -07:00
Konstantin Shcheglov 47ba94ebea CQ. Switch ErrorReporterTest to simpler RecordingDiagnosticListener.
Change-Id: Iaf5a243ed0b35c369e254e5541448aab06c48b6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511280
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 10:51:44 -07:00
Konstantin Shcheglov 4473de2a5d CQ. Use inline expected diagnostics in PubspecDiagnosticTest(s).
Change-Id: Id6f8305c0f5e92ee48cf9c0ac1adc5c2e3a2d490
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 09:51:05 -07:00
Parker Lougheed 84088f6a8b [ddc] Migrate stack_trace_mapper to static JS interop
Also removes the dependency on `package:js` as this was the only remaining usage.

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

Change-Id: Icba5bce7fbc087ed2284754656bf06493c516009
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510100
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2026-06-11 09:32:44 -07:00
Konstantin Shcheglov c3c2986b82 CQ. Remove low value test/src/lint/lint_rule_test.dart
These tests only checked that MultiAnalysisRule.reportAtNode / reportAtToken
forward the supplied DiagnosticCode into DiagnosticReporter.

Change-Id: Iade193431ab28ff4c2ac5f9f77874f1dd3c821cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 08:59:53 -07:00
Konstantin Shcheglov 96c0be6601 CQ. Simplify LineInfoTest, stop using GatheringDiagnosticListener.
Change-Id: I7d859f80eb36b9d2e29ccdd013bcdc4c04ed8219
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511141
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-11 08:55:58 -07:00
Alexander Markov 9297d718a1 Revert "[test_runner] Invoke tests with relative paths."
This reverts commit b5294b9753.

Reason for revert: many failures on appjit, reload and fuchsia bots

Failure Link: <LINK TO FAILURE>

Original change's description:
> [test_runner] Invoke tests with relative paths.
>
> This makes tests more reproducible, and makes it easier to copy commands between workspaces, or between a failing bot and a local workspace.
>
> Change-Id: Ic8dd10a3540f314a406e5c5b0a23d97032e5d01d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508364
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Change-Id: Id7aa668c0609df65a5f622ae73013a15e7f9200e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511400
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-11 08:08:41 -07:00
Konstantin Shcheglov d22b566c31 CQ. Migrate ManifestValidatorTest to inline expected diagnostics.
Change-Id: I499057965ea93aae9f550b9a383033ea6072db41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511140
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 07:53:15 -07:00
Konstantin Shcheglov be4df1a869 API. Add Folder.getFile/Folder, deprecate getChildAssumingFile/Folder
This aligns names with ResourceProvider.getFile/Folder.

Change-Id: I30383ef1fa6f7cbe60b187338e25b8ca75806730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 07:46:21 -07:00
Konstantin Shcheglov 649a56d6e4 CQ. Switch analysis options tests to inline expected diagnostics.
Change-Id: I2c33dbd645bd8611836cbcbab597a23165d1fb9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511060
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 07:45:07 -07:00
Brian Wilkerson e171e636d5 Do not offer to bind a declaring parameter to a field
Closes https://github.com/dart-lang/sdk/issues/63540

Change-Id: I72f8f76878e5a058f58aca80b1543a1141a68b72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511100
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-11 06:51:41 -07:00
Jens Johansen b32e313620 [vm] Introduce --script_uri_override to support Platform.script in dart run -r
If a script uses `Platform.script` running it with as `dart
<script.dart>` and `dart run <script.dart>` would give the correct
script ("<script.dart>"), but running it with `dart run -r
<script.dart>` would report a dill file in the temp directory which is
not only surprising, but also breaking and for instance running the CFEs
strong_suite.dart via `dart run -r` didn't work.

This CL introduces --script_uri_override to the VM and makes the
resident compiler setup pass it so that when running `dart run -r
<script.dart>`, even though the vm is actually launched from a dill file
that resides in temp, `Platform.script` will actually return
`<script.dart>` - and running the CFEs strong_suite.dart via `dart run
-r` now actually works.

Tested: Added pkg/dartdev/test/commands/run_test.dart and manual testing.
Change-Id: Ia65c01834485fe06af63584baf0448dd5b9ffdb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510343
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-06-11 06:34:20 -07:00
Johnni Winther f3d47ab020 [cfe][InternalNodes] Remove InternalVariable.initializer
This removes the initializer property on InternalVariable together with various other internal delegations to the astVariable to make sure the InternalVariable is behaving has a normal InternalTreeNode.

Change-Id: I1f8469eeb3f80d815f3bb5676bf43e66067b82ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510841
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2026-06-11 06:12:25 -07:00
Lasse R.H. Nielsen f1fcecc81d Improve optimization of int & 0xFFFFFFFF.
Recognize a second operand if its `ToUint32` is `0xFFFFFFFF`,
not just the exact value. This includes fx `& -1`, which is output
by `toUnsigned(32)`.

Change-Id: Ieccb42591efd72b4aae62a7c6e678f05510abdc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510960
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-06-11 06:09:58 -07:00
Johnni Winther 8e2d140fa5 [cfe][InternalNodes] Implement InternalVariable directly
This updates the InternalVariable hierarchy to be based on a sealed base class InternalVariable with no connection to IVariable. IVariable is removed and unused properties of InternalVariable are removed.

TEST=existing

Change-Id: Iacfbe9ab21d1c9aab043712099cd1ee6e4cee174
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510825
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-06-11 02:43:16 -07:00
Johnni Winther c390eb0931 [cfe][InternalNodes] Separate Variable from InternalVariable
This adds an InternalLegacyVariable the doesn't derive from LegacyVariable. This fully separates InternalVariable from Variable and assigned variable tracking and flow analysis is now changed to used InternalVariable instead.

TEST=existing

Change-Id: Ida9dc78d4f0e3fab3baf7a965273e1ddf68a80b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510341
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-06-11 02:43:16 -07:00
Martin Kustermann 892e6a8b53 [dart2wasm] Pass on @pragma('wasm:prefer-inline') to wasm-opt
Now that we have a way to tell binaryen to inline functions (see [0],
which added support for `(@binaryen.inline <0...127>)` annotations) we
can tell it to inline functions that were annotated with
`@pragma('wasm:prefer-inline')`

Since binaryen sometimes can devirtualize call sites that TFA cannot, it
can then inline those devirtualized calls.

[0] https://github.com/WebAssembly/binaryen/issues/7972

Change-Id: I139bd43976a1ddb83afe756d4fbac09419f7199e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510822
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-06-10 15:59:53 -07:00
Martin Kustermann 8e751fbc02 [dart2wasm] Remove deprecated mjs API functions
This is a re-land of [0] from 1.5 years ago.

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

Change-Id: I92747494f7c0d9dc43c09040ce06a523453994f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510823
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-06-10 15:52:03 -07:00
Martin Kustermann 5cd42e6b21 [dart2wasm] Start emitting binaryen.inline custom section
Binaryen introduced `binaryen.inline` which allows us to tell it
inlining hints now, including "never inline" hint (see [0])

This allows us to remove the ugly mangling of wasm function names with
`<noInline>` postfix.

We also now pass `--strip-toolchain-annotations`: The annotations
occupy size in the wasm binary and wasm runtimes ignore them (they are
for `wams-opt` only).

Except for IR tests: Here we want to see the annotations, so we keep
them there.

We also rename the package:wasm_builder classes to clearly indicate
those are binaryen specific sections.

We also make the ir_test.dart put it's options first, allowing the IR
tests to override options if needed.

[0] https://github.com/WebAssembly/binaryen/commit/3c25487214600a9

Change-Id: I96688bfaeba403a39cd5e7376f8d2889bcbae030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510000
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2026-06-10 15:51:47 -07:00
Ryan Macnak b5294b9753 [test_runner] Invoke tests with relative paths.
This makes tests more reproducible, and makes it easier to copy commands between workspaces, or between a failing bot and a local workspace.

Change-Id: Ic8dd10a3540f314a406e5c5b0a23d97032e5d01d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508364
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-10 15:30:26 -07:00
Brian Wilkerson bdd383b966 Add a fix for unnecessaryPrimaryConstructorBody
Closes https://github.com/dart-lang/sdk/issues/63556

Change-Id: I04ff967649b1b834600578a2d38ca480b9d19ec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511020
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-06-10 13:04:13 -07:00
Konstantin Shcheglov 78f9ab6cb8 Start analyzer 13.3.0-dev, analyzer_plugin 0.14.12-dev, analyzer_testing 0.3.2-dev, analysis_server_plugin 0.3.18-dev
Change-Id: I2a9e762e2f5b3fd4762ee0d0eb22296db0f3dff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-10 13:03:15 -07:00
Brian Wilkerson 594efdd63c Add documentation for another warning
Change-Id: If31cfea7c3dc3379cc0e8eda454ac9fdec4a348d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503942
Reviewed-by: Connie Ooi <connieooi@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-06-10 12:21:26 -07:00
Danny Tuppeny ff0cd5e0d6 [analysis_server] Don't warn on renames of private named parameters
Fixes https://github.com/dart-lang/sdk/issues/63433

Change-Id: I6e39d3b8c9379df07a677cabfcd9028a7bca79db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510840
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-10 11:57:21 -07:00
Konstantin Shcheglov bf71251dcd CQ. Remove ResolutionTest.error/message, all goes through inline expected diagnostics now.
Change-Id: I46fd2efe14e1bb46fa7ec12423c19fcf551bdca9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510660
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-10 11:25:41 -07:00
Konstantin Shcheglov cb41c7b055 CQ. Remove assertErrorsInList().
Change-Id: I51afa9bce21992d6093935d303034551e135c94d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510500
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-10 11:25:01 -07:00
Konstantin Shcheglov 8267ce6fff CQ. Use more inline expected diagnostics.
Change-Id: I83743fee43718133df71dd33093056543dc83094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510482
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-10 10:57:43 -07:00
Konstantin Shcheglov e4ef831dfc Prepare to publish analyzer 13.2.0, _fe_analyzer_shared 102.0.0, analysis_server_plugin 0.3.17, analyzer_plugin 0.14.11, analyzer_testing 0.3.1
Change-Id: I534e30c37570cf5fdc194eb9668d37747823aa82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510480
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-10 10:52:25 -07:00
Konstantin Shcheglov 6d86b39595 Fine. Store formal parameter default values separately from FunctionType(s).
A type is just a type, it should not attempt to carry element semantics.

Bug: https://github.com/dart-lang/sdk/issues/63555
Change-Id: I9dacc4f5cc4060d862f7e1bb1ececdd9dc1a303c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510420
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-10 10:29:28 -07:00
Konstantin Shcheglov 24cf34371a CQ. Stop using assertErrorsInList() in AnalysisDriverCachingTest.
Change-Id: Icac933eb6cfd61798a163daa906348f68b7c2616
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510441
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-10 09:57:10 -07:00
Sam Rawlins 088614d11b DAS plugins: Export types from analyzer_plugin for convenience
Fixes https://github.com/dart-lang/sdk/issues/61821

Change-Id: Ibb2737553de713aeef725a19417e09202bee8ac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509543
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-06-10 09:38:40 -07:00
Danny Tuppeny eb979c2f0c [analysis_server] Don't show field modifiers in signature help for primary constructors
Fixes https://github.com/dart-lang/sdk/issues/63560

Change-Id: I2c93e4a1011075e103d9165d0664f588f3109c40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510821
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-10 09:03:48 -07:00
Parker Lougheed 44bb92f49a [dartdev] Provide no installation feedback in dart installed
Updates `dart installed` to provide feedback if nothing is installed. If they didn't specify `--all` but there are inactive tools, provide a suggestion to specify the `--all` flag as well.

Resolves https://github.com/dart-lang/sdk/issues/61626

Change-Id: I7d68fe91a29650c113047065e673e7a1139df847
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510020
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-06-10 08:26:03 -07:00
Jake Macdonald 7c3c71ae4d Don't lint on raw types in constant patterns if the matched type is of type Type.
The issue does not have total consensus but I do feel strongly and the
fix was trivial and so I am just sending this out.

Feel free to push back if you feel strongly, or I should go through some
formal process.

Bug: https://github.com/dart-lang/sdk/issues/59334
Change-Id: I7c5e25e9754c4cebd427b8dc9ccfbe8daa57e71a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510460
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2026-06-10 08:23:43 -07:00
Kilian Schulte dd4f983cee fix location tracking transformer for use in flutter
Closes https://github.com/dart-lang/sdk/pull/63551

GitOrigin-RevId: a14cbbd88c605d193e2a1b744727765c45d38278
Change-Id: Ied6c2fc4ee3b5343c6ab8e38080542d667175f4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510160
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2026-06-10 04:15:37 -07:00
Martin Kustermann 034b90af5d [dart2wasm] Allow using experimental dart:ffi in deferred modules
The experimental `dart:ffi` support predates deferred loading
implementation. Any use of FFI features would lazily import `ffi.memory`
into the (fixed coded) main module.

This CL now lazily imports the `ffi.memory` module into all modules that
operate on the memory.

=> This will now allow a flutter app that is compiled with dart2wasm
   in deferred loading mode to possibly defer parts of flutter
   engine code that uses FFI into deferred modules.

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

Change-Id: Idf821ce2dd92c36ac1be9dae24307516a1ae86d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510760
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-06-10 02:34:44 -07:00
Jens Johansen abd32d5449 [analyzer] Fix _OverlayFile.writeAsBytesSync
Change-Id: I3b4d7ad2b7a781c49abebef307a44dd9b3381b37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510361
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-06-10 01:08:18 -07:00
Johnni Winther fa2e23b83c [cfe][InternalNodes] Remove unused precise messages
These messages where never used. This was revealed through the separation of Variable and InternalVariable.

Change-Id: I96d337f941d300cc5437c9fa5c9341abe4889176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510380
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-06-10 00:27:50 -07:00
Jens Johansen 26e4018188 [parser] Rename _reportInvalidConstantPatternOperator -> _checkForInvalidConstantPatternOperator
Follow-up to https://dart-review.googlesource.com/c/sdk/+/510320.

Change-Id: I90fcf18fbaf63600c40409ca420030e749180242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510360
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-06-09 23:51:55 -07:00
Nate Biggs 92ae8b61ec [dart2wasm] Fix switch statements that include a Type expression case.
'canInvokeTypeEquality' was assuming that if a single case was a Type expression, then type equality should be used for the whole switch statement. This is incorrect because if a single case is a type expression but the rest are, for example, ints (as in the fixed test) then the int cases should be compared with identical while only the type expression should be compared with ==.

More importantly, the expected type of the case expression constants should be top type rather than the Type type. Top type is the union of Type and the other case type.

Switches that only include Type expressions will now use "top" type as well but in general switching on a Type expression is an antipattern we shouldn't optimize for. And the impact of not specializing the switch type to Type should be very minimal.

Fixes: https://github.com/dart-lang/sdk/issues/63476
Change-Id: Ib96172f157d8cf3093199e5127d4835e7b25011c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2026-06-09 20:39:04 -07:00
Nate Biggs 6282b35c4c [dart2js] Fix labeled jump target resolution in SSA builder
When generating SSA jump instructions (HContinue and HBreak) for AST break statements, ensure that we only select labels from the target's label list that are explicitly marked as valid continue (isContinueTarget) or break (isBreakTarget) targets.

Previously, handler.labels.first was selected indiscriminately if non-empty, which caused unlabeled continue statements inside loops that had an outer break label to incorrectly generate labeled continue jumps targeting the break label.

Fixes: https://github.com/dart-lang/sdk/issues/63456
Change-Id: Ic497776141a192edb0930f4585cdaae2feecb3d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510280
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2026-06-09 19:23:06 -07:00
Konstantin Shcheglov f8d286d4d2 CQ. Migrate from assertInvalidTestCode() to resolveTestCodeWithDiagnostics() and remove it.
Change-Id: Id1306cef4434ee4f61fa3df8a33aa4009698203f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510189
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-09 12:34:43 -07:00
Konstantin Shcheglov a7c437e4d8 CQ. Remove SdkConstraintVerifierTest, assertErrorsInCode()
Change-Id: I563d661c70faa6c3cedf64df442f06aa688864c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510186
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-06-09 12:26:39 -07:00
Brian Wilkerson 9f47e3186d Add an unnecessary_primary_constructor_body lint
The lint will fire even when there is a comment in the body, such as
```dart
class C() {
  this { /* comment */ }
}
```

I think this is the right behavior because I can't think of any useful
comment that wouldn't be better somewhere else, but let me know if you
disagree.

This doesn't yet have a fix, but it should.

Change-Id: Ia5ffa6b06c75a6a7400ec32a9d22209c08a9c73d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510401
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-06-09 11:39:04 -07:00
Kallen Tu 2a3c26806f [migrate] Allow additional force enabled codes in BulkFixProcessor.
This CL allows the BulkFixProcessor to handle additional force-enabled
codes that may not be enabled in the existing analysis options of the
current project.

Change-Id: I346a1fba8a25d7ebc6a2d95828796e7f7c0ff52c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509681
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-09 11:29:45 -07:00
Konstantin Shcheglov fa78f9f947 Augment. Deprecate MethodDeclaration.isAbstract, add isComplete to ConstructorDeclaration, FunctionDeclaration, MethodDeclaration.
Change-Id: I3d5c884870ef183f54e59cd0a5c735373cbe71a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509900
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-06-09 11:28:23 -07:00
Varad Raj Agrawal 6a678d1f49 Quick fixes that create constructors use new-style syntax when primary_constructors is enabled
Closes https://github.com/dart-lang/sdk/pull/63534

GitOrigin-RevId: 345471bc33c002bbca9cea9c6626a05f481f70e3
Change-Id: If8d533ab0bbb4e6dff51a4256101fb8cb0490fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509680
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-09 10:57:01 -07:00
Konstantin Shcheglov e15ccdd9be CQ. Remove not useful PubSuggestionCodeTest, tweak for encoding test.
Change-Id: I08f5da69db285395566e71463e4e357ea4227ac2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510201
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-09 10:48:56 -07:00
Konstantin Shcheglov ea50ec6486 API. Deprecate FormalParameterElement.formalParameters and typeParameters.
For clients outside the library the useful property in
`FormalParameterElement.type`, not *how* this type was specified
syntactically: `void f(int a<T>())` vs. `void f(int Function<T>() a)`.
This way, we have to think about these type parameters and formal
parameters only locally, like for example about local variables - they
exist, enclosed in a fragment, but don't leak outside into the element
model of a method.

I found this while working on the augmentations: that formal parameters
have to have the same types in the introductory declaration, and in
augmentations.

Change-Id: Ie4e92ebd0cd0204c4ba80200a9497e95859cc3e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-09 09:51:14 -07:00