Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
// 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.

/// @assertion The following errors apply to formal parameters of a declaring
/// constructor, be it in the header or in the body. Let `p` be a formal
/// parameter of a declaring constructor in a class, enum, or extension type
/// declaration `D` named `C`:
/// @assertion The following errors apply to formal parameters of a primary
/// constructor. Let `p` be a formal parameter of a primary constructor in a
/// class, mixin class, enum, or extension type declaration `D` named `C`:
///
/// A compile-time error occurs if `p` contains a term of the form
/// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier
/// `covariant`.
///
/// @description Check that it is a compile-time error if a formal parameter of
/// a declaring constructor contains a term of the form `this.v` and has the
/// a primary constructor contains a term of the form `this.v` and has the
/// modifier `covariant`. Test classes.
/// @author sgrekhov22@gmail.com

Expand Down Expand Up @@ -46,45 +45,9 @@ class C4({required covariant String this.x}) {
String x;
}

class C5 {
String x;
this(covariant String this.x);
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

class C6 {
String x;
this([covariant this.x = ""]);
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

class C7 {
String x;
this({covariant String this.x = ""});
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

class C8 {
String x;
this({required covariant String this.x});
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(C1);
print(C2);
print(C3);
print(C4);
print(C5);
print(C6);
print(C7);
print(C8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
// 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.

/// @assertion The following errors apply to formal parameters of a declaring
/// constructor, be it in the header or in the body. Let `p` be a formal
/// parameter of a declaring constructor in a class, enum, or extension type
/// declaration `D` named `C`:
/// @assertion The following errors apply to formal parameters of a primary
/// constructor. Let `p` be a formal parameter of a primary constructor in a
/// class, mixin class, enum, or extension type declaration `D` named `C`:
///
/// A compile-time error occurs if `p` contains a term of the form
/// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier
/// `covariant`.
///
/// @description Check that it is a compile-time error if a formal parameter of
/// a declaring constructor contains a term of the form `super.v` and has the
/// a primary constructor contains a term of the form `super.v` and has the
/// modifier `covariant`. Test classes.
/// @author sgrekhov22@gmail.com

Expand Down Expand Up @@ -51,45 +50,9 @@ class C4({required covariant String super.x}) extends A {
String x;
}

class C5 extends A {
String x;
this(covariant String super.x);
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

class C6 extends A {
String x;
this([covariant super.x = ""]);
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

class C7 extends A {
String x;
this({covariant String super.x = ""});
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

class C8 extends A {
String x;
this({required covariant String super.x});
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(C1);
print(C2);
print(C3);
print(C4);
print(C5);
print(C6);
print(C7);
print(C8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
// 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.

/// @assertion The following errors apply to formal parameters of a declaring
/// constructor, be it in the header or in the body. Let `p` be a formal
/// parameter of a declaring constructor in a class, enum, or extension type
/// declaration `D` named `C`:
/// @assertion The following errors apply to formal parameters of a primary
/// constructor. Let `p` be a formal parameter of a primary constructor in a
/// class, mixin class, enum, or extension type declaration `D` named `C`:
///
/// A compile-time error occurs if `p` contains a term of the form
/// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier
/// `covariant`.
///
/// @description Check that it is a compile-time error if a formal parameter of
/// a declaring constructor contains a term of the form `this.v` and has the
/// a primary constructor contains a term of the form `this.v` and has the
/// modifier `covariant`. Test extension types.
/// @author sgrekhov22@gmail.com

Expand Down Expand Up @@ -46,41 +45,9 @@ extension type ET4({required covariant String this.x}) {
ET4.someName(String x);
}

extension type ET5(String x) {
this.someName(covariant String this.x);
//^
// [analyzer] unspecified
// [cfe] unspecified
}

extension type ET6(String x) {
this.someName([covariant String this.x = ""]);
//^
// [analyzer] unspecified
// [cfe] unspecified
}

extension type ET7(String x) {
this.someName({covariant String this.x = ""});
//^
// [analyzer] unspecified
// [cfe] unspecified
}

extension type ET8(String x) {
this.someName({required covariant String this.x});
//^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(ET1);
print(ET2);
print(ET3);
print(ET4);
print(ET5);
print(ET6);
print(ET7);
print(ET8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
// 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.

/// @assertion The following errors apply to formal parameters of a declaring
/// constructor, be it in the header or in the body. Let `p` be a formal
/// parameter of a declaring constructor in a class, enum, or extension type
/// declaration `D` named `C`:
/// @assertion The following errors apply to formal parameters of a primary
/// constructor. Let `p` be a formal parameter of a primary constructor in a
/// class, mixin class, enum, or extension type declaration `D` named `C`:
///
/// A compile-time error occurs if `p` contains a term of the form
/// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier
/// `covariant`.
///
/// @description Check that it is a compile-time error if a formal parameter of
/// a declaring constructor contains a term of the form `this.v` and has the
/// a primary constructor contains a term of the form `this.v` and has the
/// modifier `covariant`. Test enums.
/// @author sgrekhov22@gmail.com

Expand Down Expand Up @@ -50,49 +49,10 @@ enum E4({required covariant String this.x}) {
final String x;
}

enum E5 {
e0("");
final String x;
this(covariant String this.x);
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

enum E6 {
e0("");
final String x;
this([covariant this.x = ""]);
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

enum E7 {
e0("");
final String x;
this({covariant String this.x = ""});
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

enum E8 {
e0("");
final String x;
this({required covariant String this.x});
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(E1);
print(E2);
print(E3);
print(E4);
print(E5);
print(E6);
print(E7);
print(E8);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2025, 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.

/// @assertion The following errors apply to formal parameters of a primary
/// constructor. Let `p` be a formal parameter of a primary constructor in a
/// class, mixin class, enum, or extension type declaration `D` named `C`:
/// ...
/// A compile-time error occurs if `p` has the modifier covariant, but not `var`.
///
/// @description Check that it is a compile-time error if a formal parameters of
/// a primary constructor has both of the modifiers `covariant` and `final`.
/// Test classes.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=primary-constructors

class C1(covariant final String x) {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

class C2([covariant final String x = ""]) {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

class C3({covariant final String x = ""}) {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

class C4({required covariant final String x}) {}
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
print(C1);
print(C2);
print(C3);
print(C4);
}
Loading
Loading