Skip to content

Commit

Permalink
Version 3.6.0-13.0.dev
Browse files Browse the repository at this point in the history
Merge d35cbca into dev
  • Loading branch information
Dart CI committed Jul 8, 2024
2 parents 8e2d6c3 + d35cbca commit 43e5b0f
Show file tree
Hide file tree
Showing 12 changed files with 218 additions and 3 deletions.
13 changes: 13 additions & 0 deletions pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16803,6 +16803,19 @@ Message _withArgumentsUnexpectedModifierInNonNnbd(Token token) {
);
}

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeUnexpectedSuperParametersInGenerativeConstructors =
messageUnexpectedSuperParametersInGenerativeConstructors;

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageUnexpectedSuperParametersInGenerativeConstructors =
const MessageCode(
"UnexpectedSuperParametersInGenerativeConstructors",
analyzerCodes: <String>["INVALID_SUPER_FORMAL_PARAMETER_LOCATION"],
problemMessage:
r"""Super parameters can only be used in non-redirecting generative constructors.""",
);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(Token token)> templateUnexpectedToken =
const Template<Message Function(Token token)>(
Expand Down
10 changes: 10 additions & 0 deletions pkg/front_end/lib/src/kernel/body_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9398,6 +9398,16 @@ class BodyBuilder extends StackListenerImpl
addProblem(fasta.messageConstructorCyclic, fileOffset, length);
// TODO(askesc): Produce invalid initializer.
}
if (_context.formals != null) {
for (FormalParameterBuilder formal in _context.formals!) {
if (formal.isSuperInitializingFormal) {
addProblem(
fasta.messageUnexpectedSuperParametersInGenerativeConstructors,
formal.charOffset,
noLength);
}
}
}
needsImplicitSuperInitializer = false;
return _context.buildRedirectingInitializer(constructorBuilder, arguments,
fileOffset: fileOffset);
Expand Down
6 changes: 6 additions & 0 deletions pkg/front_end/messages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7357,3 +7357,9 @@ ExperimentExpiredDisabled:

DartFfiLibraryInDart2Wasm:
problemMessage: "'dart:ffi' can't be imported when compiling to Wasm."

UnexpectedSuperParametersInGenerativeConstructors:
problemMessage: "Super parameters can only be used in non-redirecting generative constructors."
analyzerCode: INVALID_SUPER_FORMAL_PARAMETER_LOCATION
script: |
class A { A(); A.named(super.x) : this(); }
4 changes: 2 additions & 2 deletions pkg/front_end/test/coverage_suite_expected.dart
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
),
// 100.0%.
"package:front_end/src/kernel/body_builder.dart": (
hitCount: 6927,
hitCount: 6976,
missCount: 0,
),
// 100.0%.
Expand Down Expand Up @@ -520,7 +520,7 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
),
// 100.0%.
"package:front_end/src/kernel/forest.dart": (
hitCount: 390,
hitCount: 395,
missCount: 0,
),
// 100.0%.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

class A {
int x;
A(this.x);
}

class C extends A {
C(super._);
C.r(super._) : this(0); // Error.
factory C.r2(super._) = C; // Error.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:12:13: Error: Super parameters can only be used in non-redirecting generative constructors.
// C.r(super._) : this(0); // Error.
// ^
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
// - 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
// factory C.r2(super._) = C; // Error.
// ^
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:16: Error: Super-initializer formal parameters can only be used in generative constructors.
// Try removing 'super.'.
// factory C.r2(super._) = C; // Error.
// ^^^^^
//
import self as self;
import "dart:core" as core;

class A extends core::Object {
field core::int x;
constructor •(core::int x) → self::A
: self::A::x = x, super core::Object::•()
;
}
class C extends self::A {
constructor •(core::int _) → self::C
: super self::A::•(_)
;
constructor r(core::int _) → self::C
: this self::C::•(0)
;
static factory r2(dynamic _) → self::C
return invalid-expression "pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
- 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
factory C.r2(super._) = C; // Error.
^";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:12:13: Error: Super parameters can only be used in non-redirecting generative constructors.
// C.r(super._) : this(0); // Error.
// ^
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
// - 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
// factory C.r2(super._) = C; // Error.
// ^
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:16: Error: Super-initializer formal parameters can only be used in generative constructors.
// Try removing 'super.'.
// factory C.r2(super._) = C; // Error.
// ^^^^^
//
import self as self;
import "dart:core" as core;

class A extends core::Object {
field core::int x;
constructor •(core::int x) → self::A
: self::A::x = x, super core::Object::•()
;
}
class C extends self::A {
constructor •(core::int _) → self::C
: super self::A::•(_)
;
constructor r(core::int _) → self::C
: this self::C::•(0)
;
static factory r2(dynamic _) → self::C
return invalid-expression "pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
- 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
factory C.r2(super._) = C; // Error.
^";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:12:13: Error: Super parameters can only be used in non-redirecting generative constructors.
// C.r(super._) : this(0); // Error.
// ^
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
// - 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
// factory C.r2(super._) = C; // Error.
// ^
//
import self as self;
import "dart:core" as core;

class A extends core::Object {
field core::int x;
constructor •(core::int x) → self::A
;
}
class C extends self::A {
constructor •(core::int _) → self::C
;
constructor r(core::int _) → self::C
;
static factory r2(dynamic _) → self::C
return invalid-expression "pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
- 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
factory C.r2(super._) = C; // Error.
^";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:12:13: Error: Super parameters can only be used in non-redirecting generative constructors.
// C.r(super._) : this(0); // Error.
// ^
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
// - 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
// factory C.r2(super._) = C; // Error.
// ^
//
// pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:16: Error: Super-initializer formal parameters can only be used in generative constructors.
// Try removing 'super.'.
// factory C.r2(super._) = C; // Error.
// ^^^^^
//
import self as self;
import "dart:core" as core;

class A extends core::Object {
field core::int x;
constructor •(core::int x) → self::A
: self::A::x = x, super core::Object::•()
;
}
class C extends self::A {
constructor •(core::int _) → self::C
: super self::A::•(_)
;
constructor r(core::int _) → self::C
: this self::C::•(0)
;
static factory r2(dynamic _) → self::C
return invalid-expression "pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart:13:27: Error: The constructor function type 'C Function(int)' isn't a subtype of 'C Function(dynamic)'.
- 'C' is from 'pkg/front_end/testcases/general/super_initializing_parameters_in_redirecting_generative_constructors.dart'.
factory C.r2(super._) = C; // Error.
^";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class A {
int x;
A(this.x);
}

class C extends A {
C(super._);
C.r(super._) : this(0);
factory C.r2(super._) = C;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class A {
A(this.x);
int x;
}

class C extends A {
C(super._);
C.r(super._) : this(0);
factory C.r2(super._) = C;
}
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 6
PATCH 0
PRERELEASE 12
PRERELEASE 13
PRERELEASE_PATCH 0

0 comments on commit 43e5b0f

Please sign in to comment.