Commit Graph

24153 Commits

Author SHA1 Message Date
mohammadmseet-hue 794b281da3 fix: cap uncompressed WebSocket frame size to prevent peer-induced OOM
Closes https://github.com/dart-lang/sdk/pull/63257

GitOrigin-RevId: 47b50221f808d62c660d855b10cc1f22981c996a
Change-Id: I8c42b12277982caf0da5a627dc8de12102595d0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498460
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-05-06 04:54:42 -07:00
Johnni Winther a782aed439 [cfe][PrimaryConstructors] Add AsyncModifier
This adds an AsyncModifier class that holds both the AsyncMarker, used in the kernel encoding, and the file offset of the async modifier. This is used throughout the front end and ensures that the correct offset is used for errors reported on the async modifier.

Change-Id: If16d293ffb9b2e8fa8eca8c65f7548d920c5d56b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500720
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-05-06 01:35:05 -07:00
Alexander Aprelev 00cda4d60f [ffi/isolate_group] Move IsolateGroupBound callbacks from isolate to isolate group.
This allows creation of isolategroup-bound callbacks when isolate is not available. For example, to support proposed Isolate::onEvent/Isolate::handleEvent api https://github.com/dart-lang/language/blob/main/working/333%20-%20shared%20memory%20multithreading/shared_native_memory.md#additional-isolate-apis.

BUG=https://github.com/dart-lang/sdk/issues/63291
TEST=isolate_group_bound_callback_test

CoreLibraryReviewExempt: vm ffi-specific comments changes
Change-Id: I9a757a39ba8e152db64f59a66d337ca672103277
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499661
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2026-05-05 08:37:06 -07:00
Ivan Ugryumov 6dd8ad5397 Add InterfaceAddress for broadcast address support
Closes https://github.com/dart-lang/sdk/pull/63088

GitOrigin-RevId: c72afbbbf2774fd4c3c3f83b69c30e86e4302abd
Change-Id: I2462f006dcbe2256b019c5b13674ca0d93838fc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492180
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-05 01:15:37 -07:00
mohammadmseet-hue 4d6c9b756c fix: reject Set-Cookie with SameSite=None but no Secure attribute
Closes https://github.com/dart-lang/sdk/pull/63254

GitOrigin-RevId: 18d7d0e46c31783ff200657c0f81d029e9a64231
Change-Id: I3019e7733b6e2a3e1634b6bb7f8bb5e17be35d4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498423
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-05-05 00:53:33 -07:00
Kallen Tu 8bfb683892 Enable 'primary-constructors' feature flag.
This CL enables the primary constructors feature by default in Dart 3.13.

The primary constructors feature is a brevity feature. There are no new semantics, but it allows us to express declarations in a less verbose way.

This feature allows one constructor and a set of instance variables to be specified in the header of a declaration.

Currently a declaration with a constructor and some fields is written as:

```dart
// Current syntax.
class Point {
  int x;
  int y;
  Point(this.x, this.y);
}
```

With a primary constructor, we would write the above as:

```
class Point(var int x, var int y);
```

If a primary constructor needs an initializer list or a body, they can be
specified inside the class using the `this` body syntax:

```dart
class Point(var int x, var int y) {
  this : assert(x >= 0) {
    print('Point created at $x, $y');
  }
}
```

As part of this feature, you can also use the `new` and `factory` keywords to
declare constructors in the class body without repeating the class name:
```dart
class Point {
  int x, y;

  // Equivalent to Point(this.x, this.y)
  new(this.x, this.y);

  // Equivalent to Point.origin()
  new origin() : x = 0, y = 0;

  // Equivalent to factory Point.clone(Point other)
  factory clone(Point other) => Point(other.x, other.y);
}
```

To learn more about the feature, check out the feature specification located here: https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md

Tested: Has existing language, CFE, analyzer, analysis server tests.
Bug: https://github.com/dart-lang/sdk/issues/61524
Change-Id: I296f2fcd918b87bf2a1dd00256340759866c2423
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489241
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2026-05-04 15:09:49 -07:00
Paul Berry 9dfa6738c9 Revert "[flow analysis] Fix unsound type promotion in inner async/generator functions."
This reverts commit 3eb697c0af.

Reason for revert: Internal Google3 breakages

Original change's description:
> [flow analysis] Fix unsound type promotion in inner async/generator functions.
>
> An `await` expression or `yield` statement suspends the current
> function and allows other code in the same isolate to execute. In the
> case of nested functions, an `await` or `yield` in the inner function
> can allow the outer function to continue executing. That means that if
> the inner function promotes a local variable belonging to the outer
> function, then it isn't sound to carry that promotion past an `await`
> or `yield`.
>
> This change fixes the unsoundness by adding a flow analysis method
> `suspension`, which the shared type analysis logic uses to tell flow
> analysis that an `await` or `yield` has been found. The `suspension`
> method un-does the promotions of any variables that might be written
> to while the inner function is suspended.
>
> Fixes https://github.com/dart-lang/sdk/issues/62889.
>
> Change-Id: I77eaf997159819a7c50f44b67174d2aa6a6a6964
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499382
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Bob Nystrom <rnystrom@google.com>

Change-Id: I187ba9a347394946ecc8749d35dc7914d271b90a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-05-04 10:37:11 -07:00
Lasse R.H. Nielsen f35a3fcce4 Add alternatives for functions that should be deprecated.
`List.unmodifiable` and `Map.unmodifiable` is as badly typed
as `List.from` and `Map.from`, but does not have a better-typed
`.of` constructor. This adds such, to give a migration target
when deprecating the badly typed constructors.

The `Future.delayed` with no second argument is also unsafely
typed, it fails if the type argument is not nullable.
The `Future.pause` creates `Future<void>` instead.

CoreLibraryReviewExempt: No new or platform specific behavior.
Change-Id: Iba101b3dc62f412003abd501fa042aca0ce63116
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499280
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2026-05-04 08:08:35 -07:00
Paul Berry 3eb697c0af [flow analysis] Fix unsound type promotion in inner async/generator functions.
An `await` expression or `yield` statement suspends the current
function and allows other code in the same isolate to execute. In the
case of nested functions, an `await` or `yield` in the inner function
can allow the outer function to continue executing. That means that if
the inner function promotes a local variable belonging to the outer
function, then it isn't sound to carry that promotion past an `await`
or `yield`.

This change fixes the unsoundness by adding a flow analysis method
`suspension`, which the shared type analysis logic uses to tell flow
analysis that an `await` or `yield` has been found. The `suspension`
method un-does the promotions of any variables that might be written
to while the inner function is suspended.

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

Change-Id: I77eaf997159819a7c50f44b67174d2aa6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499382
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2026-05-01 07:16:25 -07:00
Paul Berry 07b9707d96 [front end] Perform hoisting after coercion.
Coercion from `dynamic` to a non-top type has observable effects,
since it may throw an exception. Therefore it's important that any
tree manipulations that are performed as part of type inference (such
as hoisting of named arguments that precede unnamed ones) preserve the
order of coercions relative to expression evaluation.

Prior to this change, the following code:

    f(n: e1, e2)

Would get transformed into:

    let tmp = e1 in f(coerce(e2), n: coerce(tmp))

And so the coercion of e1 would not happen until after the evaluation
of e2.

With this change, the code is transformed into:

    let tmp = coerce(e1) in f(coerce(e2), n: tmp)

Which (correctly) coerces e1 before evaluating e2.

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

Change-Id: Iee33c162c7cc3a9b0a8b03bde211bf926a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498980
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-30 11:05:39 -07:00
mohammadmseet-hue c5d23e0df3 fix: HTTP request smuggling via Transfer-Encoding token whitespace
Closes https://github.com/dart-lang/sdk/pull/63250

GitOrigin-RevId: 7c6b7bf7d033dd31dc23a7cc3a30b3dc4db41d16
Change-Id: I573328660bbef7ec9cd829ec376fcee894a6bc34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498420
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-30 00:52:02 -07:00
mohammadmseet-hue 890f7e8aa9 fix: do not forward Authorization/Cookie to subdomains on redirect
Closes https://github.com/dart-lang/sdk/pull/63256

GitOrigin-RevId: 1cf4d94690343b4df087e7c583154a36580fff71
Change-Id: I186e9338e36ee72714d385444e6fbf3b217ec4ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498424
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-29 00:54:05 -07:00
Martin Kustermann b8b0cad67a [dart2wasm] Make most void functions have no return values
This gives around 0.2% improvement in compressed e main module.

In Dart a function with `void` return type can actually return values
that callers can observe. But most of the time this doesn't happen, most
times those functions return `null` values and callers don't observe
them.

Let's use inferred return value information to see if a function is
guaranteed to only return `null`. If so we make the wasm function
signature not return any values. Callers will then synthesize a `null`
which may immediatly be dropped or (in rare cases) actually be used.

This leads to less less instructions in the callee (as a callee doesn't
need to push the null onto the stack) and the caller (as the caller
doesn't have to drop it from the stack).

Change-Id: I3ed1be7592798ad0c697c5bc3ab2c4b64c156f03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497620
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2026-04-28 00:20:02 -07:00
mohammadmseet-hue 75479bc7a7 fix: reject HTTP requests with Transfer-Encoding not ending in chunked
Closes https://github.com/dart-lang/sdk/pull/63251

GitOrigin-RevId: 55ef08553ee65ab1052a46b92ff57f097863c340
Change-Id: Ibd3e93b553e046962bba36ec683b0d2bb157b264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498401
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-27 23:59:39 -07:00
Srujan Gaddam 94e1217774 Reland "[dart:js_interop] Make JSFunction and JSExportedDartFunction generic"
This is a reland of commit e7dbd6ba48

Original change's description:
> [dart:js_interop] Make JSFunction and JSExportedDartFunction generic
>
> Fixes https://github.com/dart-lang/sdk/issues/54557
>
> The generic type in JSExportedDartFunction corresponds to the
> static type of the function it wrapped, whereas for JSFunction,
> it's purely a descriptor of the JS function.
>
> When calling JSExportedDartFunction, a cast is now introduced
> to cast it to T.
>
> When calling isA, the type in JSExportedDartFunction is passed
> along to check that the value that is wrapped is that function
> type. Because the T in JSFunction is descriptive, e.g.
> isA<JSFunction<int Function()>>() does no such check.
>
> ____
>
> Also cleans up:
>
> - isA<JSTypedArray>() logic to use intrinsic functions
> - some expectation files to be consistent for both dart2js and ddc.
>
> CoreLibraryReviewExempt: Backend-specific library with needed reviews.
> Change-Id: I1a55c4386e416fa4ccabe06ac5051f41c2e2e95a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496820
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

CoreLibraryReviewExempt: Reland.
Change-Id: I29d706aa4967fd80390e8cb37f8144603ec007f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498100
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-04-27 20:32:55 -07:00
Nate Biggs 3d2d6492c1 Add 'external-effect' pragma support to all the backends.
Call sites targeting a procedure annotated with `external-effect` will
not produce any code, including the argument which will not be
evaluated.

However, the single parameter will be treated as 'live' for the purposes
of any global analysis the backends do. This is useful for things like
protobuf shaking where a user may want to retain certain protobuf
messages without actually emitting the code that retains those messages.

Today this functionality is available internally in the vm and wasm SDK
libraries. dart2js has similar functionality represented via the
opaqueTrue and opaqueFalse booleans (which will cause conditional
branches to get shaken after analysis). This will replace dart2js's
opaque(True/False).

This also adds validation to the frontend to ensure a method annotated
with 'external-effect' is well-formed.

Change-Id: If1c4096673e655c58fe7638840a16125003e7809
Tested: Backend tests for codegen were added. A frontend test was added for the validation. A language test was added to confirm the behavior.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476020
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2026-04-27 09:42:38 -07:00
Simon Binder 03fd5927a4 [dart2wasm, standalone]: Avoid importing js-string constants
dart2wasm imports strings as globals for which JavaScript engines would
provide the respective values. The standalone target needs to support
all WebAssembly runtimes, so it can't rely on this mechanism.

Instead, this imports functions to convert a WebAssembly arrays of char
codes or ASCII bytes into a string. For now, these functions have to
return JS strings since the rest of the SDK relies on that. In the
future, embedders would be able to return any string implementation as
an externref.

Because calling host functions is invalid in constant contexts, string
constants can't be regular globals. For now, this uses the default
non-eager constant implementation with one initialization function per
string constant. Eventually, we should probably initialize these
strings in a WASM start function instead.

TEST=pkg/dart2wasm/test/standalone_test.dart
Change-Id: I93b7c3846fbe99daa8ffa31e452f62672b61ce4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495020
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2026-04-24 10:49:11 -07:00
Kallen Tu 77cf3047a3 Dot Shorthands: Const selector chains.
I changed the parsing of const dot shorthands to parse the entire selector chain in `parsePrecedenceExpression` rather than parsing them in `parseConstExpression`. We were originally parsing the initial expression before the `.` and only flagging that as a dot shorthand which prevented any chaining on const constructors. Const expressions with chained methods/property accesses were not being flagged as a dot shorthand so we weren’t saving the context type properly which led to producing the “unknown context type” error.

Before:
```
class C {
  const new someConstCtor();
  C method() => this;
}

C c = const .someConstCtor.method();
// (const .someConstCtor) is parsed and handled as a const constructor
// (const .someConstCtor) is handled as a dot shorthand, context is
// saved on only this AST and not the outer chain.
// Then we parse the rest of the selector chain (.method())
//
// Error: No context type for (const .someConstCtor.method())
```

After:
```
class C {
  const new someConstCtor();
  C method() => this;
}

C c = const .someConstCtor.method();
// (const .someConstCtor) is parsed and handled as a const constructor.
// Then we parse the rest of the selector chain (.method())
// (const .someConstCtor.method()) is handled as a dot shorthand, context is saved for this outer node.
//
// OK. No error because we are able to retrieve the type for the
// entire dot shorthand chain.
```

Fixes: https://github.com/dart-lang/sdk/issues/63119
Change-Id: I3308d8eb7ce101466be257aba6b5448921bff136
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2026-04-24 10:40:26 -07:00
Srujan Gaddam 442bdeda4a Revert "[dart:js_interop] Make JSFunction and JSExportedDartFunction generic"
This reverts commit e7dbd6ba48.

Reason for revert: Broke flutter_analyze

Original change's description:
> [dart:js_interop] Make JSFunction and JSExportedDartFunction generic
>
> Fixes https://github.com/dart-lang/sdk/issues/54557
>
> The generic type in JSExportedDartFunction corresponds to the
> static type of the function it wrapped, whereas for JSFunction,
> it's purely a descriptor of the JS function.
>
> When calling JSExportedDartFunction, a cast is now introduced
> to cast it to T.
>
> When calling isA, the type in JSExportedDartFunction is passed
> along to check that the value that is wrapped is that function
> type. Because the T in JSFunction is descriptive, e.g.
> isA<JSFunction<int Function()>>() does no such check.
>
> ____
>
> Also cleans up:
>
> - isA<JSTypedArray>() logic to use intrinsic functions
> - some expectation files to be consistent for both dart2js and ddc.
>
> CoreLibraryReviewExempt: Backend-specific library with needed reviews.
> Change-Id: I1a55c4386e416fa4ccabe06ac5051f41c2e2e95a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496820
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I98447c8c95906feb7f8f1a57859a24fc8e4966d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498080
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
2026-04-24 09:31:08 -07:00
Srujan Gaddam e7dbd6ba48 [dart:js_interop] Make JSFunction and JSExportedDartFunction generic
Fixes https://github.com/dart-lang/sdk/issues/54557

The generic type in JSExportedDartFunction corresponds to the
static type of the function it wrapped, whereas for JSFunction,
it's purely a descriptor of the JS function.

When calling JSExportedDartFunction, a cast is now introduced
to cast it to T.

When calling isA, the type in JSExportedDartFunction is passed
along to check that the value that is wrapped is that function
type. Because the T in JSFunction is descriptive, e.g.
isA<JSFunction<int Function()>>() does no such check.

____

Also cleans up:

- isA<JSTypedArray>() logic to use intrinsic functions
- some expectation files to be consistent for both dart2js and ddc.

CoreLibraryReviewExempt: Backend-specific library with needed reviews.
Change-Id: I1a55c4386e416fa4ccabe06ac5051f41c2e2e95a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496820
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-04-23 20:55:26 -07:00
Simon Binder 0ae4f93e29 [dart2wasm,standalone] Split patch files by whether they use JS interop
This is a re-land of 152cc24, which has been reverted in 3f9ae7. Unlike
the original change, this doesn't alter the `dart:_wasm` library.
We can revisit an API split to remove `js_interop` APIs there once the
standalone target has progressed further.

Original change's description:
> [dart2wasm] Split patch files by whether they use JS interop
>
> The eventual goal of the `dart2wasm_standalone` platform is to not rely
> on a JavaScript environment, which requires rewriting everything that
> currently relies on `js_interop` or `JS()` helpers.
>
> Since most of the patches are still written in Dart and we don't want
> to duplicate that code for the standalone target, this splits patch
> files by whether they rely on JS-interop or not. The main entrypoint
> for each patch (e.g. `lib/_internal/wasm/lib/core_patch.dart`) no
> longer relies on JS-interop and can safely be used in the standalone
> target. Part files that previously needed to use JS-interop have been
> moved into separate patches now, which allows us to migrate them
> incrementally.
>
> In some cases, it was easier to add new patch files:
>
> - Similar to the split between `boxed_int` and the `toString` helper
>   patch, we now have the same for `boxed_double`.
> - The functionality to copy from JS typed data wrappers into Dart typed
>   lists wouldn't work with standalone, so I've moved it into a separate
>   method we can patch to be a noop.
> - `dart:_wasm` exposes APIs to convert between `JSAny` and `externref`.
>   This is part of a public API, but I had to move those declarations
>   into a patch file because they wouldn't work with standalone.
>   Arguably, a separate library (`dart:_wasm_js_interop`?) would be
>   cleaner but it might be fine as long as `dart:_wasm` is experimental?
>
> For now, new patch files relying on JS interop are also applied to the
> standalone target. They are marked with a comment indicating that they
> need to be migrated though.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try
Change-Id: I98a628f96cba7e0f0af7e86e058cda43c2c73898
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495302
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-22 23:54:32 -07:00
Paul Berry 8d59e904e4 [anonymous methods] Test private field promotion.
To work properly with anonymous methods, the private field promotion
logic in flow analysis will have to be updated so that it understands
that `this` refers to a different object inside of an anonymous
method.

This CL adds new language tests to validate that this logic has been
properly updated.

Change-Id: I4ad2c289c5b39bb7397e68eff74324226a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496720
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2026-04-22 10:19:04 -07:00
Paul Berry 46e2cfe3fd [anonymous methods] Test that super can't be used in parameterless anonymous methods.
Change-Id: Icf5ccff095e42a6e8c151b31c741aec96a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497061
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2026-04-22 07:19:04 -07:00
Lasse R.H. Nielsen ab434651fa Fix cookie-date parsing to use the correct algorithm.
A prior parser change made the parsing more restrictive,
only accepting the dart formats that a cookie creator should
produce, rather than what the RFC specifies should be accepted.

Now implements the specified algorithm again.

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

Prior over-optimisitc breaking change: https://dart-review.googlesource.com/c/sdk/+/448383

Change-Id: I4ed7cf2368d04063e0fc563ff8e64904bf0d3e1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496080
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-04-22 06:13:58 -07:00
Erik Ernst e05ce41c0d Add anonymous => method related implementation in the CFE
This CL adds an implementation of anonymous `=>` methods in the CFE
which is sufficiently complete to handle the existing test cases in
language/anonymous_methods/expression.

Coverage is handled by adding magic comments to ignore the fact that new
code is not covered by existing testcases. This will be settled in a
separate CL.

To keep the failures visible, the failures in configurations
dart2js-hostasserts-linux-d8-try, dart2js-linux-chrome-try,
dart2js-minified-linux-d8-try, and ddc-linux-chrome-try have not been
approved. It seems likely to me that those are bugs in dart2js and in
DDC.

Change-Id: Ia70fedd4de6166d6a3bf8a108f49728b6e16c9f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494440
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-21 02:09:41 -07:00
Martin Kustermann 12174830ec [dart2wasm] Optimize the way we implement constructors
This reduces essentials main module around -0.4% and possibly
opens up for changes in the inlining (specifically to possibly
not force-inline all initializers anymore)

This shrinks the amount of information
* initializer result values
* the body parameters
* the allocator needs to forward less from initializer to body

We do that by analyzing constructor parameters to see
which parameters are needed for the constructor

Change-Id: I967fa4102ea6e9d498ff07aedabc368b038e1085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496341
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-04-21 00:13:42 -07:00
Sergey G. Grekhov 8f1336e49e [co19] Roll co19 to d7f69e054e32444b634f4eed5ceec15eb3432ddb
2026-04-17 sgrekhov22@gmail.com Fixes dart-lang/co19#3742. Don't use primary constructors in typedef_A01_t03.dart (dart-lang/co19#3743)
2026-04-17 sgrekhov22@gmail.com Fixes dart-lang/co19#3740. Fix expected result in grammar_A05_t09.dart (dart-lang/co19#3741)
2026-04-16 sgrekhov22@gmail.com dart-lang/co19#3698. Update tests for `return` statement. Part 3. (dart-lang/co19#3706)
2026-04-16 sgrekhov22@gmail.com Fixes dart-lang/co19#3737. Update tests for named parameters whose names start with _. (dart-lang/co19#3738)
2026-04-16 sgrekhov22@gmail.com dart-lang/co19#3709. Fix some of failing TypeSystem tests (dart-lang/co19#3736)
2026-04-15 sgrekhov22@gmail.com dart-lang/co19#3709. Add more tests for named optional parameters (dart-lang/co19#3735)
2026-04-15 sgrekhov22@gmail.com Fixes dart-lang/co19#3730. Fix co19 tests according to Dart 3.13 syntax. Part 2. (dart-lang/co19#3733)
2026-04-14 sgrekhov22@gmail.com dart-lang/co19#3315. Add more tests for factory constructors (dart-lang/co19#3734)
2026-04-13 sgrekhov22@gmail.com Fixes dart-lang/co19#3730. Fix co19 tests according to Dart 3.13 syntax (dart-lang/co19#3732)

R=athom@google.com, eernst@google.com

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,dart2js-minified-linux-d8-try
Change-Id: If6a727d195b0cd3b267cc3eb8a7d57726b8cfcd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496580
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2026-04-20 02:58:23 -07:00
Konstantin Shcheglov 6cd3938741 Breaking changes for analyzer 13.0.0
https://github.com/dart-lang/sdk/issues/62799
https://github.com/dart-lang/sdk/issues/62944
https://github.com/dart-lang/sdk/issues/63002
https://github.com/dart-lang/sdk/issues/62970

Looks mostly green in google3: https://fusion2.corp.google.com/presubmit/901021300/OCL:901021300:BASE:901308428:1776439417713:37cd1695

Change-Id: I44754a48f66a0b58851d7c20fcfa61f7fb1b555a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488624
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-17 23:06:25 -07:00
Kallen Tu 1c7332ec86 [tests] Primary constructors: Enums have implicitly const constructors.
Added a single test for this new change.
Tested with new and old constructor syntax.

Bug: https://github.com/dart-lang/language/issues/4494
Change-Id: I8cda70398fb1d7de17f41fc541edaf8f16490a8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495580
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2026-04-16 11:56:05 -07:00
kyungilcho 316092eabb [dart2wasm] Avoid redundant typed_data buffer allocations in setRange
Closes https://github.com/dart-lang/sdk/pull/63151

GitOrigin-RevId: 17ee4021c13e74c681a3a95083eb6fdd169ae804
Change-Id: Ic62951a8a8c9c7d7cb5952a31905ad1f20b1a7d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-04-16 05:06:38 -07:00
Johnni Winther 1d40001a98 [cfe][PrimaryConstructors] Don't remove const modifier
This stops the practice of removing the const modifier from const constructors with a body. Since primary constructor introduces more complex scenarios of this problem space, retaining the constness seems to have better results in terms of cascading errors. In particular, not reporting that a non-const constructor cannot be invoked when it is actual a const (alas erroneous) constructor.

Change-Id: I33b3982ec0fce89946f8700f98bf08161d930d36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-04-15 03:08:56 -07:00
Slava Egorov 3f9ae74880 Revert "[dart2wasm] Split patch files by whether they use JS interop"
This reverts commit 152cc247e0.

Reason for revert: Broken web_ui analysis (see flutter-analyze)

Original change's description:
> [dart2wasm] Split patch files by whether they use JS interop
>
> The eventual goal of the `dart2wasm_standalone` platform is to not rely
> on a JavaScript environment, which requires rewriting everything that
> currently relies on `js_interop` or `JS()` helpers.
>
> Since most of the patches are still written in Dart and we don't want
> to duplicate that code for the standalone target, this splits patch
> files by whether they rely on JS-interop or not. The main entrypoint
> for each patch (e.g. `lib/_internal/wasm/lib/core_patch.dart`) no
> longer relies on JS-interop and can safely be used in the standalone
> target. Part files that previously needed to use JS-interop have been
> moved into separate patches now, which allows us to migrate them
> incrementally.
>
> In some cases, it was easier to add new patch files:
>
> - Similar to the split between `boxed_int` and the `toString` helper
>   patch, we now have the same for `boxed_double`.
> - The functionality to copy from JS typed data wrappers into Dart typed
>   lists wouldn't work with standalone, so I've moved it into a separate
>   method we can patch to be a noop.
> - `dart:_wasm` exposes APIs to convert between `JSAny` and `externref`.
>   This is part of a public API, but I had to move those declarations
>   into a patch file because they wouldn't work with standalone.
>   Arguably, a separate library (`dart:_wasm_js_interop`?) would be
>   cleaner but it might be fine as long as `dart:_wasm` is experimental?
>
> For now, new patch files relying on JS interop are also applied to the
> standalone target. They are marked with a comment indicating that they
> need to be migrated though.
>
> Change-Id: I583f23f6cc1a3fc7332962292d69f3a7b0327409
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489660
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I21428bdabcabdbdd07f3453384bb31154083c8aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494920
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-13 10:26:58 -07:00
Paul Berry 25bb8ce922 Add language tests for issues 33298 and 56666.
Yesterday I discovered some code in the front end type inference
engine that I didn't expect: logic that added constraints to type
inference based on the result of applying type coercions. To figure
out why it was necessary, I disabled it and ran the code through
trybots. It turns out that it's needed to prevent the following
issues:
- https://github.com/dart-lang/sdk/issues/33298
- https://github.com/dart-lang/sdk/issues/56666

Fortunately, we had regression tests for these issues:
- `pkg/front_end/testcases/general/bug33298.dart`
- `pkg/front_end/testcases/general/issue56666.dart`

Unfortunately, those regression tests are front-end specific, meaning
we didn't have any coverage for the analyzer.

This CL adds coverage for the analyzer by replicating the regression
tests in `tests/language`.

Change-Id: Ia53b3c898549e991d6685a414d177a466a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494563
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2026-04-13 09:30:21 -07:00
Sergey G. Grekhov 256878a672 [co19] Roll co19 to 4d90df49d4fc0d9aef3d3a0aed2bc0473fde81ef
2026-04-13 sgrekhov22@gmail.com dart-lang/co19#3315. Add missing experimental flag to `Language/Functions/Formal_Parameters/Optional_Formals/` tests (dart-lang/co19#3731)
2026-04-13 sgrekhov22@gmail.com dart-lang/co19#3203. Add VM debugger test for primary constructors of extension types (dart-lang/co19#3684)
2026-04-10 sgrekhov22@gmail.com Fixes dart-lang/co19#3728. Fix typos in syntax_t02.dart (dart-lang/co19#3729)
2026-04-10 sgrekhov22@gmail.com Fixes dart-lang/co19#3723. Add more tests for constants and ternary operator (dart-lang/co19#3724)
2026-04-10 sgrekhov22@gmail.com dart-lang/co19#3315. Add tests for `var` and `final` parameters of operators (dart-lang/co19#3727)
2026-04-10 sgrekhov22@gmail.com Fixes dart-lang/co19#3719. Update test in Language/Expressions/Bitwise_Expressions (dart-lang/co19#3720)
2026-04-10 sgrekhov22@gmail.com Fixes dart-lang/co19#3725. Fix the new roll failures (dart-lang/co19#3726)
2026-04-10 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete var syntax. Part 24. (dart-lang/co19#3721)
2026-04-10 sgrekhov22@gmail.com Fixes dart-lang/co19#3717. Fix expected error location in parameter_A06_t02.dart (dart-lang/co19#3722)
2026-04-09 sgrekhov22@gmail.com dart-lang/co19#3709. Fix failing tests, add issues numbers. Part 3. (dart-lang/co19#3718)
2026-04-08 sgrekhov22@gmail.com dart-lang/co19#3315. Fix tests that use obsolete var syntax. Part 23. (dart-lang/co19#3716)
2026-04-08 sgrekhov22@gmail.com Fixes dart-lang/co19#3714. Updated tests in `Language/Functions/Formal_Parameters/Optional_Formals` (dart-lang/co19#3715)
2026-04-07 sgrekhov22@gmail.com dart-lang/co19#3709. Fix failing tests, add issues numbers (dart-lang/co19#3710)
2026-04-07 sgrekhov22@gmail.com Fixes dart-lang/co19#3707. Add more tests for `continue` statement (dart-lang/co19#3708)
2026-04-07 sgrekhov22@gmail.com dart-lang/co19#3698. Update tests for `return` statement. Part 2. (dart-lang/co19#3705)
2026-04-07 sgrekhov22@gmail.com dart-lang/co19#3709. Fix failing tests, add issues numbers. Part 2. (dart-lang/co19#3712)
2026-04-07 sgrekhov22@gmail.com Fixes dart-lang/co19#3711. Update expected error location in static_processing_A03_t02.dart (dart-lang/co19#3713)
2026-04-01 sgrekhov22@gmail.com Fixes dart-lang/co19#3315. Add tests for metadata (dart-lang/co19#3704)
2026-04-01 sgrekhov22@gmail.com dart-lang/co19#3182. Add more tests for augmenting parameter with name `_`. Part 2. (dart-lang/co19#3697)
2026-04-01 sgrekhov22@gmail.com Fixes dart-lang/co19#3702. Fix/expect secondary errors in `grammar_A03_t02.dart` (dart-lang/co19#3703)
2026-04-01 sgrekhov22@gmail.com dart-lang/co19#3315. Add tests for primary constructors of mixin class (dart-lang/co19#3701)
2026-03-31 sgrekhov22@gmail.com dart-lang/co19#3315. Add tests for the syntax and for constant primary constructors (dart-lang/co19#3700)
2026-03-31 sgrekhov22@gmail.com dart-lang/co19#3698. Update tests for `return` statement. Part 1. (dart-lang/co19#3699)
2026-03-30 sgrekhov22@gmail.com dart-lang/co19#3182. Add more tests for augmenting parameter with the name `_` (dart-lang/co19#3696)
2026-03-30 sgrekhov22@gmail.com dart-lang/co19#3182. Revert tests for augmenting parameter with the name `_` (dart-lang/co19#3695)

R=athom@google.com, eernst@google.com

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,dart2js-minified-linux-d8-try
Change-Id: I1f57467f4665f37b301db3df3d8934db10afd695
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494820
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2026-04-13 08:16:43 -07:00
Simon Binder 152cc247e0 [dart2wasm] Split patch files by whether they use JS interop
The eventual goal of the `dart2wasm_standalone` platform is to not rely
on a JavaScript environment, which requires rewriting everything that
currently relies on `js_interop` or `JS()` helpers.

Since most of the patches are still written in Dart and we don't want
to duplicate that code for the standalone target, this splits patch
files by whether they rely on JS-interop or not. The main entrypoint
for each patch (e.g. `lib/_internal/wasm/lib/core_patch.dart`) no
longer relies on JS-interop and can safely be used in the standalone
target. Part files that previously needed to use JS-interop have been
moved into separate patches now, which allows us to migrate them
incrementally.

In some cases, it was easier to add new patch files:

- Similar to the split between `boxed_int` and the `toString` helper
  patch, we now have the same for `boxed_double`.
- The functionality to copy from JS typed data wrappers into Dart typed
  lists wouldn't work with standalone, so I've moved it into a separate
  method we can patch to be a noop.
- `dart:_wasm` exposes APIs to convert between `JSAny` and `externref`.
  This is part of a public API, but I had to move those declarations
  into a patch file because they wouldn't work with standalone.
  Arguably, a separate library (`dart:_wasm_js_interop`?) would be
  cleaner but it might be fine as long as `dart:_wasm` is experimental?

For now, new patch files relying on JS interop are also applied to the
standalone target. They are marked with a comment indicating that they
need to be migrated though.

Change-Id: I583f23f6cc1a3fc7332962292d69f3a7b0327409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489660
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-04-13 03:44:43 -07:00
Erik Ernst 56df2ae167 Adjust flow analysis to handle break/continue in an anonymous method
This CL changes the flow analysis slightly such that the analyzer is
able to handle a `break;`, `break L;`, `continue;`, or `continue L;`
that occurs in the body of an anonymous method. It adds a test for a few
situations where this feature is used.

Change-Id: I5b065a6ad96e346502fd071d1547ccd143f37e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491800
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2026-04-13 01:06:01 -07:00
Srujan Gaddam ef6054d688 Update Chrome to 148.0.7778.5
Also updates a few tests due to changes in how createEvent
can be used. That browser API has been deprecated for a long
time, but only recently did Chrome remove support for
PopStateEvent through that API. So, instead to retain the
original intent of the test, confuses are added after
constructing the event to check that type tests work correctly.

A few other tests are modified to remove code that depends on
createEvent, either through eventType or supported members.

See the Chrome bug for more details on the removal:
https://issues.chromium.org/issues/41228793#comment38

Change-Id: Id55a215583221de3ccdbbeff16a2e17e9e35fb0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494160
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
2026-04-10 09:24:12 -07:00
Paul Berry 3d56c6bb91 Test yield* when the return context is Iterable<_>.
This covers a test case that I forgot to include in
https://dart-review.googlesource.com/c/sdk/+/491706. As with that CL,
this test is solely intended to ensure that the current behavior is
adequately tested, so that we will avoid inadvertently changing it
while doing refactors.

Changes to the specification are being contemplated; see
https://github.com/dart-lang/language/pull/4673 and
https://github.com/dart-lang/language/issues/4672.

Change-Id: I5a21bfc2555857542d0dc02b757672a36a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492660
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2026-04-09 15:01:17 -07:00
Konstantin Shcheglov e1404d8539 Split mixinClassDeclarationWithClause and mixinModifierMixinApplicationClassWithMultipleMixins from mixinClassDeclarationExtendsNotObject.
Report dedicated diagnostics for mixin classes that use a `with` clause
and for mixin application classes that use multiple mixins, instead of
folding both cases into `mixinClassDeclarationExtendsNotObject`.

This makes the reported error match the actual invalid construct. A
`mixin class` with a `with` clause does not have the same problem as a
`mixin class` that extends a non-`Object` superclass, and a mixin
application with multiple mixins is a separate restriction again.

Update the error verifier, diagnostic definitions, messages, and fix
status entries to use the new codes. Also guard `RemoveExtendsClause` so
it only offers a fix when an actual extends clause is present, avoiding
a bogus fix for diagnostics that are now reported on `with` clauses
instead.

Consolidate the diagnostic tests under a single mixin class declaration
test file and update expectations to use the more precise error codes.

The original impetus for this change was a crash in RemoveExtendsClause
quick fix.

Change-Id: I937276f37deb293ca1fecab3ff838ace45af2ec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493865
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-04-09 15:01:11 -07:00
Konstantin Shcheglov eb1b8ea844 FixCrash. When a type parameter is referenced in static context, instantiate it to InvalidType.
When a class type parameter is referenced from a static member, the
analyzer could still instantiate it as an ordinary type parameter during
resolution and summary building. That produced inconsistent invalid
states, led to follow-on type errors, and could crash later stages that
expected a real type or a consistently invalid one.

Teach `ScopeContext` to track whether resolution is inside a static
member and use that information when instantiating type parameters. If
the referenced type parameter belongs to the enclosing instance context,
resolve it to `InvalidType` instead.

Route both `NamedTypeResolver` and `reference_resolver` through this
shared helper so fields, methods, and other named type paths handle
static references consistently. This keeps the original
`TYPE_PARAMETER_REFERENCED_BY_STATIC` diagnostic while preventing
spurious assignment and return-type errors from cascading afterward.

Bug: https://github.com/dart-lang/sdk/issues/60745
Change-Id: Ib9e685b967de5baa8a26b542be630c9fb0d6a96b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494040
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-04-09 09:34:54 -07:00
Kallen Tu c0961ff71b [tests] Primary constructors - Mixin class, const constructor bodies tests
Tests the following:
- A compile-time error occurs if a class, mixin class, enum, or
extension type has a constant primary constructor which has a body part
that has a body.
- A compile-time error occurs if a mixin class declaration has a primary
constructor which is not trivial, that is, it declares one or more
parameters, or it has a body part that has an initializer list or
a body.

Spec changes:
https://github.com/dart-lang/language/commit/e2cbe29ca23431b9d76faba4b5ead520709689cd
https://github.com/dart-lang/language/commit/9d00e024647fea00993be9c111f52528f8510206

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: If19a96cc275d502b2bdaf3924c699b5a742a1557
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492661
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2026-04-08 15:12:21 -07:00
Brian Quinlan 8b6c67a4ba [io]: Fixes a redirect credential leak and a HTTP request smuggling issue.
1. The redirect credential leak was caused because the arguments to `shouldCopyHeaderOnRedirect` were passed in the wrong order
2. The HTTP request smuggling was caused by incorrect identification of chunked transfer encoding.

Closes https://github.com/dart-lang/sdk/pull/63133

GitOrigin-RevId: 1e6189fd7cd7b0360566f01d02c82a71de5d0f0a
Change-Id: I7c76615d12b6dac8888c1cdc3a6cab46199f6b0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493600
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-08 13:31:32 -07:00
Erik Ernst e7debdf978 Add anonymous method error tests
Change-Id: I48de987b60b86a7fb52a52e75d79eaa754d5cc6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2026-04-08 02:45:57 -07:00
Johnni Winther 575553bbd2 [cfe][PrimaryConstructors] Update test expectations
This updates primary constructor tests to expect the current CFE output.

Change-Id: Ie9cd3cd6d6954642fc9e0a2f7dcd527e1fc711dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493241
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-04-08 02:05:38 -07:00
Natalie Weizenbaum d863706259 Add JS iterable types
Closes https://github.com/dart-lang/sdk/pull/62610

GitOrigin-RevId: 63f5c6eddcd2e3f6ef88656c34d67df68c053c12
Change-Id: I74556b1bd8241e1de344d4f73ca76cfea7167de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478704
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2026-04-06 13:30:46 -07:00
Konstantin Shcheglov cd7e32217f DeCo. Report const_primary_constructor_with_block_body,
const_primary_constructor_with_expression_body, primary_constructor_body_with_expression_body, primary_constructor_body_with_modifier

Bug: https://github.com/dart-lang/language/pull/4671
Change-Id: I4eb8326a2f01ee7c3a47f08fe897eb702ba994d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492281
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2026-04-02 16:05:20 -07:00
Paul Berry 6cc1bdb1ad Add language tests of yield* downwards inference.
These tests cover the behaviors mentioned in
https://github.com/dart-lang/language/issues/4672.

Long term, I'm not certain whether these are the behaviors we
want. But considering that these are the behaviors we have, it seems
reasonable to test them to avoid regressions.

Paves the way for a follow-up CL that will refactor some of the
analyzer and front end logic that handles yield statements.

Change-Id: I6af8eb67dac588d90ed95e2536184c4a6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491706
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2026-04-02 11:15:32 -07:00
Konstantin Shcheglov d53518cba5 Issue 62663. Split mixin_class_declares_constructor into class_used_as_mixin_declares_generative_constructor and mixin_class_declares_non_trivial_generative_constructor.
Bug: https://github.com/dart-lang/sdk/issues/62663
Change-Id: I7096923f139ed91451056066aa68965f1b821c5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491925
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2026-04-01 15:20:26 -07:00
Johnni Winther 4cfd3da965 [cfe][PrimaryConstructors] Update reporting for mixin class with initializer/constructor body
This update the position used for reporting a mixin class primary constructor with a primary constructor by declaration with initializers or an explicit body. Since mixin classes can have simple constructors, it makes more sense to report the error on the offending syntax than on the primary constructor itself.

The CL also updates the offset used for field initializers to the field name rather than the `=`. This align the offset with what is used for property sets.

Change-Id: Id5ccd55536b2c3b9d9336d2854772c1bcc5a175a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-04-01 01:17:28 -07:00
Johnni Winther 62e11ac90a [PrimaryConstructors] Mark tests as SkipByDesign for dart2js/ddc
These tests use `external` modifier on constructors, and dart2js/ddc only supports external on constructors marked as JS-interop and therefore reports compile-time errors for these tests.

Change-Id: I7f55086170b06d2b31bda8c1916780622502df41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490540
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-03-25 05:22:00 -07:00