#1231. More Super parameters tests added
diff --git a/LanguageFeatures/Super-parameters/semantics_A05_t02.dart b/LanguageFeatures/Super-parameters/semantics_A05_t02.dart
index 78cbd95..0ac4afe 100644
--- a/LanguageFeatures/Super-parameters/semantics_A05_t02.dart
+++ b/LanguageFeatures/Super-parameters/semantics_A05_t02.dart
@@ -6,11 +6,13 @@
/// super-parameter with name n and a super-constructor invocation with a named
/// argument with name n.
///
-/// @description Check that it is a compile-time error if a constructor has a
-/// named super-parameter with name n and a super-constructor invocation with a
+/// @description Check that it is no compile-time error if a constructor has a
+/// named super-parameter with name n and a super-constructor invocation with no
/// named argument with name n.
/// @author sgrekhov@unipro.ru
+import "../../Utils/expect.dart";
+
class S {
int? n;
S({int? n}) : this.n = n;
@@ -19,10 +21,9 @@
class C extends S {
int i1;
C(this.i1, {super.n}): super();
-// ^^^^^
-// [analyzer] unspecified
-// [cfe] unspecified
}
main() {
- C(1, n: 2);
+ C c = C(1, n: 2);
+ Expect.equals(1 ,c.i1);
+ Expect.equals(2 ,c.n);
}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t01.dart b/LanguageFeatures/Super-parameters/semantics_A06_t01.dart
new file mode 100644
index 0000000..07bdbb6
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t01.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is a compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with no associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1): s2 = s1;
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, super.s2) : this.i2 = x;
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ C(1, 2, 3, 4);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t02.dart b/LanguageFeatures/Super-parameters/semantics_A06_t02.dart
new file mode 100644
index 0000000..66a500b
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t02.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is a compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with no associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+class S {
+ int s1;
+ int s2;
+ int s3;
+ S(this.s1, this.s2, this.s3);
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, super.s2) : this.i2 = x;
+//^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ C(1, 2, 3, 4);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t03.dart b/LanguageFeatures/Super-parameters/semantics_A06_t03.dart
new file mode 100644
index 0000000..0d1ed31
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t03.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is a compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with no associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, {this.s2 = 0});
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, super.s2) : this.i2 = x;
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ C(1, 2, 3, 4);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t04.dart b/LanguageFeatures/Super-parameters/semantics_A06_t04.dart
new file mode 100644
index 0000000..ce11d8d
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t04.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is a compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with no associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, this.s2);
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, {super.s2}) : this.i2 = x;
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ C(1, 2, 3, s2: 4);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t05.dart b/LanguageFeatures/Super-parameters/semantics_A06_t05.dart
new file mode 100644
index 0000000..1214567
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t05.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is a compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with no associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, {required this.s2});
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x) : this.i2 = x;
+//^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ C(1, 2, 3);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t06.dart b/LanguageFeatures/Super-parameters/semantics_A06_t06.dart
new file mode 100644
index 0000000..df50ca5
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t06.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is a compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with no associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, {required this.s2});
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, super.s2) : this.i2 = x;
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ C(1, 2, 3, 4);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t07.dart b/LanguageFeatures/Super-parameters/semantics_A06_t07.dart
new file mode 100644
index 0000000..b46d21d
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t07.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is a compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with no associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, {required this.s2}); // note, s2 is required here
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, {super.s2}) : this.i2 = x; // s2 is not required here
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ C(1, 2, 3, 4);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t08.dart b/LanguageFeatures/Super-parameters/semantics_A06_t08.dart
new file mode 100644
index 0000000..ade63f0
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t08.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is no compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, this.s2);
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, super.s2) : this.i2 = x;
+}
+
+main() {
+ C c = C(1, 2, 3, 4);
+ Expect.equals(2, c.s1);
+ Expect.equals(4, c.s2);
+ Expect.equals(1, c.i1);
+ Expect.equals(3, c.i2);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t09.dart b/LanguageFeatures/Super-parameters/semantics_A06_t09.dart
new file mode 100644
index 0000000..3746317
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t09.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is no compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, {this.s2 = 0});
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, {super.s2 = 5}) : this.i2 = x;
+}
+
+main() {
+ C c1 = C(1, 2, 3, s2: 4);
+ Expect.equals(2, c1.s1);
+ Expect.equals(4, c1.s2);
+ Expect.equals(1, c1.i1);
+ Expect.equals(3, c1.i2);
+
+ C c2 = C(1, 2, 3);
+ Expect.equals(2, c2.s1);
+ Expect.equals(5, c2.s2);
+ Expect.equals(1, c2.i1);
+ Expect.equals(3, c2.i2);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t10.dart b/LanguageFeatures/Super-parameters/semantics_A06_t10.dart
new file mode 100644
index 0000000..e357f2c
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t10.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is no compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, [this.s2]);
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, [super.s2]) : this.i2 = x;
+}
+
+main() {
+ C c = C(1, 2, 3, 4);
+ Expect.equals(2, c.s1);
+ Expect.equals(4, c.s2);
+ Expect.equals(1, c.i1);
+ Expect.equals(3, c.i2);
+}
diff --git a/LanguageFeatures/Super-parameters/semantics_A06_t11.dart b/LanguageFeatures/Super-parameters/semantics_A06_t11.dart
new file mode 100644
index 0000000..45e1bc0
--- /dev/null
+++ b/LanguageFeatures/Super-parameters/semantics_A06_t11.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2021, 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 Let C be a non-redirecting generative constructor with, implicit
+/// or explicit, super-constructor invocation s at the end of its initializer
+/// list. Let D be the superclass constructor targeted by s (which must exist).
+///
+/// We define the associated super-constructor parameter for each
+/// super-parameter p of C as follows:
+///
+/// If p is a positional parameter, let j be the number of positional
+/// super-parameters of C up to and including p in source order. The associated
+/// super-constructor parameter of p is the jth positional parameter of D
+/// (1-based), if D has that many positional parameters.
+/// If p is a named parameter with name n, the associated super-constructor
+/// parameter is the named parameter of D with name n, if D has a named
+/// parameter with that name.
+///
+/// It’s a compile-time error if a non-redirecting generative
+/// constructor has a super-parameter with no associated super-constructor
+/// parameter.
+///
+/// @description Check that it is no compile-time error if a non-redirecting
+/// generative constructor has a super-parameter with associated
+/// super-constructor parameter.
+/// @author sgrekhov@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class S {
+ int s1;
+ int s2;
+ S(this.s1, [this.s2]);
+}
+
+class C extends S {
+ int i1;
+ int i2;
+ C(this.i1, super.s1, int x, super.s2) : this.i2 = x;
+}
+
+main() {
+ C c = C(1, 2, 3, 4);
+ Expect.equals(2, c.s1);
+ Expect.equals(4, c.s2);
+ Expect.equals(1, c.i1);
+ Expect.equals(3, c.i2);
+}