From 21a5fc18cac5bc9db5489102d43f822a1a0d406e Mon Sep 17 00:00:00 2001 From: "Sergey G. Grekhov" Date: Mon, 11 Dec 2023 20:17:15 +0200 Subject: [PATCH] #2386. Rename well-bounded tests. Update descriptions (#2405) Rename well-bounded tests. Update descriptions. --- .../Superbounded_types/class_A01_t09.dart | 21 ------ .../Superbounded_types/typedef3_A01_t05.dart | 22 ------- ...A01_t01.dart => well_bounded_A01_t01.dart} | 21 ++---- ...A01_t02.dart => well_bounded_A01_t02.dart} | 15 ++++- ...A01_t03.dart => well_bounded_A01_t03.dart} | 20 ++++-- ...A01_t08.dart => well_bounded_A01_t04.dart} | 12 ++-- .../well_bounded_A01_t05.dart | 27 ++++++++ ...A01_t01.dart => well_bounded_A02_t01.dart} | 20 ++++-- ...A01_t02.dart => well_bounded_A02_t02.dart} | 19 ++++-- ...A01_t03.dart => well_bounded_A02_t03.dart} | 9 ++- ...A01_t04.dart => well_bounded_A02_t04.dart} | 9 ++- ...A01_t05.dart => well_bounded_A02_t05.dart} | 8 +-- ...A01_t06.dart => well_bounded_A02_t06.dart} | 8 +-- ...A01_t01.dart => well_bounded_A03_t01.dart} | 65 +++++++++++++------ ...A01_t02.dart => well_bounded_A03_t02.dart} | 22 +++++-- ...A01_t03.dart => well_bounded_A03_t03.dart} | 6 +- ...A01_t04.dart => well_bounded_A03_t04.dart} | 8 +-- ...A01_t01.dart => well_bounded_A04_t01.dart} | 17 +++-- ...A01_t02.dart => well_bounded_A04_t02.dart} | 16 +++-- ...A01_t03.dart => well_bounded_A04_t03.dart} | 8 +-- ...A01_t04.dart => well_bounded_A04_t04.dart} | 8 +-- ...A01_t01.dart => well_bounded_A05_t01.dart} | 15 +++-- ...A01_t02.dart => well_bounded_A05_t02.dart} | 13 +++- ...A01_t03.dart => well_bounded_A05_t03.dart} | 11 +++- ...A01_t04.dart => well_bounded_A05_t04.dart} | 7 +- .../well_bounded_A05_t05.dart | 26 ++++++++ ...A01_t06.dart => well_bounded_A05_t06.dart} | 8 +-- 27 files changed, 273 insertions(+), 168 deletions(-) delete mode 100644 Language/Generics/Superbounded_types/class_A01_t09.dart delete mode 100644 Language/Generics/Superbounded_types/typedef3_A01_t05.dart rename Language/Generics/Superbounded_types/{class_A01_t01.dart => well_bounded_A01_t01.dart} (60%) rename Language/Generics/Superbounded_types/{class_A01_t02.dart => well_bounded_A01_t02.dart} (65%) rename Language/Generics/Superbounded_types/{class_A01_t03.dart => well_bounded_A01_t03.dart} (59%) rename Language/Generics/Superbounded_types/{class_A01_t08.dart => well_bounded_A01_t04.dart} (66%) create mode 100644 Language/Generics/Superbounded_types/well_bounded_A01_t05.dart rename Language/Generics/Superbounded_types/{function_A01_t01.dart => well_bounded_A02_t01.dart} (60%) rename Language/Generics/Superbounded_types/{function_A01_t02.dart => well_bounded_A02_t02.dart} (67%) rename Language/Generics/Superbounded_types/{function_A01_t03.dart => well_bounded_A02_t03.dart} (64%) rename Language/Generics/Superbounded_types/{function_A01_t04.dart => well_bounded_A02_t04.dart} (84%) rename Language/Generics/Superbounded_types/{function_A01_t05.dart => well_bounded_A02_t05.dart} (68%) rename Language/Generics/Superbounded_types/{function_A01_t06.dart => well_bounded_A02_t06.dart} (86%) rename Language/Generics/Superbounded_types/{typedef1_A01_t01.dart => well_bounded_A03_t01.dart} (55%) rename Language/Generics/Superbounded_types/{typedef1_A01_t02.dart => well_bounded_A03_t02.dart} (58%) rename Language/Generics/Superbounded_types/{typedef1_A01_t03.dart => well_bounded_A03_t03.dart} (80%) rename Language/Generics/Superbounded_types/{typedef1_A01_t04.dart => well_bounded_A03_t04.dart} (69%) rename Language/Generics/Superbounded_types/{typedef2_A01_t01.dart => well_bounded_A04_t01.dart} (53%) rename Language/Generics/Superbounded_types/{typedef2_A01_t02.dart => well_bounded_A04_t02.dart} (68%) rename Language/Generics/Superbounded_types/{typedef2_A01_t03.dart => well_bounded_A04_t03.dart} (71%) rename Language/Generics/Superbounded_types/{typedef2_A01_t04.dart => well_bounded_A04_t04.dart} (67%) rename Language/Generics/Superbounded_types/{typedef3_A01_t01.dart => well_bounded_A05_t01.dart} (51%) rename Language/Generics/Superbounded_types/{typedef3_A01_t02.dart => well_bounded_A05_t02.dart} (55%) rename Language/Generics/Superbounded_types/{typedef3_A01_t03.dart => well_bounded_A05_t03.dart} (71%) rename Language/Generics/Superbounded_types/{typedef3_A01_t04.dart => well_bounded_A05_t04.dart} (63%) create mode 100644 Language/Generics/Superbounded_types/well_bounded_A05_t05.dart rename Language/Generics/Superbounded_types/{typedef3_A01_t06.dart => well_bounded_A05_t06.dart} (64%) diff --git a/Language/Generics/Superbounded_types/class_A01_t09.dart b/Language/Generics/Superbounded_types/class_A01_t09.dart deleted file mode 100644 index 1022335f4e..0000000000 --- a/Language/Generics/Superbounded_types/class_A01_t09.dart +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2019, 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 Any use of a type [T] which is not well-bounded is a -/// compile-time error. -/// @description Checks that compile error is not thrown when class with super -/// bounded type parameter is declared -/// @Issue 37034, 37050 -/// @author iarkh@unipro.ru - - -class A> {} - -class B1> {} -class B5>> {} -class B6>> {} -class B7>> {} -class B8>> {} - -main() {} diff --git a/Language/Generics/Superbounded_types/typedef3_A01_t05.dart b/Language/Generics/Superbounded_types/typedef3_A01_t05.dart deleted file mode 100644 index f4651eb1a8..0000000000 --- a/Language/Generics/Superbounded_types/typedef3_A01_t05.dart +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2019, 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 Any use of a type [T] which is not well-bounded is a -/// compile-time error. -/// @description Checks that compile error is not thrown when non-function type -/// alias variable with well bounded type parameter is declared -/// @author iarkh@unipro.ru - -class A {} - -typedef B = A; - -main() { - B b1; - B> b2; - B> b3; - B> b4; - B> b5; - B> b6; -} diff --git a/Language/Generics/Superbounded_types/class_A01_t01.dart b/Language/Generics/Superbounded_types/well_bounded_A01_t01.dart similarity index 60% rename from Language/Generics/Superbounded_types/class_A01_t01.dart rename to Language/Generics/Superbounded_types/well_bounded_A01_t01.dart index 7b86a5b2e6..ffdf047400 100644 --- a/Language/Generics/Superbounded_types/class_A01_t01.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A01_t01.dart @@ -2,39 +2,26 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when variable with super -/// bounded type parameter is declared +/// +/// @description Checks that it is not an error if a variable with a +/// well-bounded type parameter is declared /// @Issue 42415, 42429 /// @author iarkh@unipro.ru - class A> {} main() { A a1; - A a2; A a3; - A a4; -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - A a5; A a6; - A> a7; A> a8; - A> a9; -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - A> a10; A> a11; - A a12; A> a13; } diff --git a/Language/Generics/Superbounded_types/class_A01_t02.dart b/Language/Generics/Superbounded_types/well_bounded_A01_t02.dart similarity index 65% rename from Language/Generics/Superbounded_types/class_A01_t02.dart rename to Language/Generics/Superbounded_types/well_bounded_A01_t02.dart index 337ad1731c..3cf12ad46b 100644 --- a/Language/Generics/Superbounded_types/class_A01_t02.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A01_t02.dart @@ -2,15 +2,20 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown if variable type is not well -/// bounded +/// +/// @description Checks that it is a compile-time error to declare a variable +/// with a type parameter which is not well-bounded /// @author iarkh@unipro.ru class A> {} main() { + A a0; +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified A a1; // ^^^ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS @@ -23,5 +28,9 @@ main() { A>> a3; // ^^^^^^^^^ // [analyzer] unspecified +// [cfe] unspecified + A> a4; +// ^^^^^^^^^ +// [analyzer] unspecified // [cfe] unspecified } diff --git a/Language/Generics/Superbounded_types/class_A01_t03.dart b/Language/Generics/Superbounded_types/well_bounded_A01_t03.dart similarity index 59% rename from Language/Generics/Superbounded_types/class_A01_t03.dart rename to Language/Generics/Superbounded_types/well_bounded_A01_t03.dart index be0981ab4a..eb63963080 100644 --- a/Language/Generics/Superbounded_types/class_A01_t03.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A01_t03.dart @@ -2,29 +2,41 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown when class with not well -/// bounded type parameter is declared +/// +/// @description Checks that it is a compile-time error when a class has a type +/// parameter bound which is a raw type that does not have simple bounds, and +/// when a class has a type parameter bound which is malbounded. /// @author iarkh@unipro.ru class A> {} +// Here `B1` is a well-bounded type, but the bound is a raw type `A` that +// doesn't have simple bounds, and that's a compile-time error. class B1 {} // ^ // [cfe] Generic type 'A' can't be used without type arguments in a type variable bound. // ^ // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND + +// Same for B2, it's well-bounded but the bound is a raw type without simple +// bound class B2> {} // ^ // [cfe] Generic type 'A' can't be used without type arguments in a type variable bound. // ^ // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND -class B3> {} + +class B3> {} // A is a malbounded type // ^ // [cfe] Type argument 'int' doesn't conform to the bound 'A' of the type variable 'T' on 'A'. // ^^^ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS main() { + print(A); + print(B1); + print(B2); + print(B3); } diff --git a/Language/Generics/Superbounded_types/class_A01_t08.dart b/Language/Generics/Superbounded_types/well_bounded_A01_t04.dart similarity index 66% rename from Language/Generics/Superbounded_types/class_A01_t08.dart rename to Language/Generics/Superbounded_types/well_bounded_A01_t04.dart index b6e590ca9b..93398500f5 100644 --- a/Language/Generics/Superbounded_types/class_A01_t08.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A01_t04.dart @@ -2,14 +2,14 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when class with type -/// parameter which extends super bounded type is declared +/// +/// @description Checks that it is not an error to declare a class with a type +/// parameter whose bound is a super-bounded type /// @Issue 37034 /// @author iarkh@unipro.ru - class A> {} class B1> {} @@ -18,4 +18,8 @@ class B3> {} class B4> {} main() { + B1(); + B2(); + B3(); + B4(); } diff --git a/Language/Generics/Superbounded_types/well_bounded_A01_t05.dart b/Language/Generics/Superbounded_types/well_bounded_A01_t05.dart new file mode 100644 index 0000000000..512820b26c --- /dev/null +++ b/Language/Generics/Superbounded_types/well_bounded_A01_t05.dart @@ -0,0 +1,27 @@ +// Copyright (c) 2019, 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 Any use of a type `T` which is not well-bounded is a +/// compile-time error. +/// +/// @description Checks that it is not an error to have a class with a +/// super-bounded type parameter whose bound is a super-bounded type. +/// @Issue 37034, 37050 +/// @author iarkh@unipro.ru + +class A> {} + +class B1> {} +class B2>> {} +class B3>> {} +class B4>> {} +class B5>> {} + +main() { + B1(); + B2(); + B3(); + B4(); + B5(); +} diff --git a/Language/Generics/Superbounded_types/function_A01_t01.dart b/Language/Generics/Superbounded_types/well_bounded_A02_t01.dart similarity index 60% rename from Language/Generics/Superbounded_types/function_A01_t01.dart rename to Language/Generics/Superbounded_types/well_bounded_A02_t01.dart index c94b4d7dcc..6ceac5c65f 100644 --- a/Language/Generics/Superbounded_types/function_A01_t01.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A02_t01.dart @@ -2,29 +2,41 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown when function with not well -/// bounded type parameter is declared +/// +/// @description Checks that it is a compile-time error when a function has a +/// type parameter bound which is a raw type that does not have simple bounds, +/// and when a function has a type parameter bound which is malbounded. /// @author iarkh@unipro.ru class A> {} +// Here the function is a well-bounded but the bound is a raw type A> +// that doesn't have simple bounds void testme1() {} // ^ // [cfe] Generic type 'A' can't be used without type arguments in a type variable bound. // ^ // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND + +// Same here, the function is a well-bounded but the bound is a raw type without +// simple bound void testme2>() {} // ^ // [cfe] Generic type 'A' can't be used without type arguments in a type variable bound. // ^ // [analyzer] COMPILE_TIME_ERROR.NOT_INSTANTIATED_BOUND -void testme3>() {} + + +void testme3>() {} // A is a malbounded type // ^ // [cfe] Type argument 'int' doesn't conform to the bound 'A' of the type variable 'T' on 'A'. // ^^^ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS main() { + print(testme1); + print(testme2); + print(testme3); } diff --git a/Language/Generics/Superbounded_types/function_A01_t02.dart b/Language/Generics/Superbounded_types/well_bounded_A02_t02.dart similarity index 67% rename from Language/Generics/Superbounded_types/function_A01_t02.dart rename to Language/Generics/Superbounded_types/well_bounded_A02_t02.dart index 23da7ab676..e2d185bfd1 100644 --- a/Language/Generics/Superbounded_types/function_A01_t02.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A02_t02.dart @@ -2,14 +2,14 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when function with well -/// bounded type parameter is declared +/// +/// @description Checks that it is not an error when a function with a type +/// parameter whose bound is super-bounded type is declared /// @Issue 36959, 37028, 37050 /// @author iarkh@unipro.ru - class A> {} void testme1>() {} @@ -22,4 +22,13 @@ void testme6>>() {} void testme7>>() {} void testme8>>() {} -main() {} +main() { + testme1(); + testme2(); + testme3(); + testme4(); + testme5(); + testme6(); + testme7(); + testme8(); +} diff --git a/Language/Generics/Superbounded_types/function_A01_t03.dart b/Language/Generics/Superbounded_types/well_bounded_A02_t03.dart similarity index 64% rename from Language/Generics/Superbounded_types/function_A01_t03.dart rename to Language/Generics/Superbounded_types/well_bounded_A02_t03.dart index 6e6e5aa918..d474cac130 100644 --- a/Language/Generics/Superbounded_types/function_A01_t03.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A02_t03.dart @@ -2,14 +2,13 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when call generic -/// function with well bounded type parameter +/// +/// @description Checks that it is not an error to call a generic function with +/// a well-bounded type parameter /// @author iarkh@unipro.ru - -class A {} void testme() {} main() { diff --git a/Language/Generics/Superbounded_types/function_A01_t04.dart b/Language/Generics/Superbounded_types/well_bounded_A02_t04.dart similarity index 84% rename from Language/Generics/Superbounded_types/function_A01_t04.dart rename to Language/Generics/Superbounded_types/well_bounded_A02_t04.dart index 7707b971df..66979b642a 100644 --- a/Language/Generics/Superbounded_types/function_A01_t04.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A02_t04.dart @@ -2,14 +2,13 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown when call generic -/// function with type parameter which is not well bounded +/// +/// @description Checks that it is a compile-time error to call a generic +/// function with an actual type argument which does not satisfy the bounds. /// @author iarkh@unipro.ru - -class A {} void testme() {} main() { diff --git a/Language/Generics/Superbounded_types/function_A01_t05.dart b/Language/Generics/Superbounded_types/well_bounded_A02_t05.dart similarity index 68% rename from Language/Generics/Superbounded_types/function_A01_t05.dart rename to Language/Generics/Superbounded_types/well_bounded_A02_t05.dart index 1656231727..5783f3f914 100644 --- a/Language/Generics/Superbounded_types/function_A01_t05.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A02_t05.dart @@ -2,13 +2,13 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when call generic -/// function with two dependant well bounded type parameters +/// +/// @description Checks that it is not an error to call a generic function with +/// two dependent type arguments that satisfy the bounds. /// @author iarkh@unipro.ru - class A> {} void testme>() {} diff --git a/Language/Generics/Superbounded_types/function_A01_t06.dart b/Language/Generics/Superbounded_types/well_bounded_A02_t06.dart similarity index 86% rename from Language/Generics/Superbounded_types/function_A01_t06.dart rename to Language/Generics/Superbounded_types/well_bounded_A02_t06.dart index ba437236d3..86f63ca618 100644 --- a/Language/Generics/Superbounded_types/function_A01_t06.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A02_t06.dart @@ -2,14 +2,14 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown when call generic -/// function with two dependant type parameters which are not bounded well. +/// +/// @description Checks that it is a compile-time to call a generic function +/// with two dependent type arguments that do not satisfy the bounds. /// @Issue 37061 /// @author iarkh@unipro.ru - class A> {} void testme>() {} diff --git a/Language/Generics/Superbounded_types/typedef1_A01_t01.dart b/Language/Generics/Superbounded_types/well_bounded_A03_t01.dart similarity index 55% rename from Language/Generics/Superbounded_types/typedef1_A01_t01.dart rename to Language/Generics/Superbounded_types/well_bounded_A03_t01.dart index b56748c170..17494ab96f 100644 --- a/Language/Generics/Superbounded_types/typedef1_A01_t01.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A03_t01.dart @@ -2,59 +2,62 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown when function alias with not -/// well bounded type parameter is declared +/// +/// @description Checks that it is a compile-time error when a function type has +/// a type parameter bound which is a raw type that does not have simple bounds, +/// and when a function has a type parameter bound which is malbounded. /// @Issue 37031 /// @author iarkh@unipro.ru - class A> {} -typedef B1 = void Function(); +// Here `B1` is a well-bounded type, but the bound is a raw type `A` that +// doesn't have simple bounds, and that's a compile-time error. +typedef B1 = void Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B2> = void Function(); +typedef B2> = void Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B3 = void Function(); +typedef B3 = void Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B4> = void Function(); +typedef B4> = void Function(); // A is a malbounded type // ^^^ // [analyzer] unspecified // [cfe] unspecified -typedef B5 = X Function(); +typedef B5 = X Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B6> = X Function(); +typedef B6> = X Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B7 = X Function(); +typedef B7 = X Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B8> = X Function(); +typedef B8> = X Function(); // ^^^ // [analyzer] unspecified // [cfe] unspecified -typedef B9 = void Function(X); +typedef B9 = void Function(X); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B10> = void Function(X); +typedef B10> = void Function(X); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B11 = void Function(X); +typedef B11 = void Function(X); // ^ // [analyzer] unspecified // [cfe] unspecified @@ -63,15 +66,15 @@ typedef B12> = void Function(X); // [analyzer] unspecified // [cfe] unspecified -typedef B13 = void Function(); +typedef B13 = void Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B14> = void Function(); +typedef B14> = void Function(); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B15 = void Function(); +typedef B15 = void Function(); // ^ // [analyzer] unspecified // [cfe] unspecified @@ -80,15 +83,15 @@ typedef B16> = void Function(); // [analyzer] unspecified // [cfe] unspecified -typedef B17 = X Function(X); +typedef B17 = X Function(X); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B18> = X Function(X); +typedef B18> = X Function(X); // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B19 = X Function(X); +typedef B19 = X Function(X); // ^ // [analyzer] unspecified // [cfe] unspecified @@ -98,4 +101,24 @@ typedef B20> = X Function(X); // [cfe] unspecified main() { + print(B1); + print(B2); + print(B3); + print(B4); + print(B5); + print(B6); + print(B7); + print(B8); + print(B9); + print(B10); + print(B11); + print(B12); + print(B13); + print(B14); + print(B15); + print(B16); + print(B17); + print(B18); + print(B19); + print(B20); } diff --git a/Language/Generics/Superbounded_types/typedef1_A01_t02.dart b/Language/Generics/Superbounded_types/well_bounded_A03_t02.dart similarity index 58% rename from Language/Generics/Superbounded_types/typedef1_A01_t02.dart rename to Language/Generics/Superbounded_types/well_bounded_A03_t02.dart index 45d3a1bf5b..06f8953653 100644 --- a/Language/Generics/Superbounded_types/typedef1_A01_t02.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A03_t02.dart @@ -4,23 +4,31 @@ /// @assertion Any use of a type [T] which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when function alias with -/// well bounded type parameter is declared +/// +/// @description Checks that it is not an error when a function alias with a +/// type parameter with a well-bounded bound is declared. /// @Issue 36959, 37050, 37034 /// @author iarkh@unipro.ru - class A> {} typedef B1> = void Function(); -typedef B2> = void Function(); +typedef B2> = void Function(); typedef B3> = void Function(); -typedef B4> = void Function(); +typedef B4> = void Function(); typedef B5>> = void Function(); -typedef B6>> = void Function(); +typedef B6>> = void Function(); typedef B7>> = void Function(); -typedef B8>> = void Function(); +typedef B8>> = void Function(); main() { + print(B1); + print(B2); + print(B3); + print(B4); + print(B5); + print(B6); + print(B7); + print(B8); } diff --git a/Language/Generics/Superbounded_types/typedef1_A01_t03.dart b/Language/Generics/Superbounded_types/well_bounded_A03_t03.dart similarity index 80% rename from Language/Generics/Superbounded_types/typedef1_A01_t03.dart rename to Language/Generics/Superbounded_types/well_bounded_A03_t03.dart index f7560a43c8..d28519a777 100644 --- a/Language/Generics/Superbounded_types/typedef1_A01_t03.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A03_t03.dart @@ -4,12 +4,12 @@ /// @assertion Any use of a type [T] which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when function alias with -/// well bounded type parameter is declared +/// +/// @description Checks that it is not an error when a function alias with a +/// type parameter with a bound which is a well-bounded type is declared. /// @Issue 36959, 37050, 42415 /// @author iarkh@unipro.ru - class A> {} typedef B> = void Function(); diff --git a/Language/Generics/Superbounded_types/typedef1_A01_t04.dart b/Language/Generics/Superbounded_types/well_bounded_A03_t04.dart similarity index 69% rename from Language/Generics/Superbounded_types/typedef1_A01_t04.dart rename to Language/Generics/Superbounded_types/well_bounded_A03_t04.dart index c0ee66a250..3fcdd5e75a 100644 --- a/Language/Generics/Superbounded_types/typedef1_A01_t04.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A03_t04.dart @@ -2,14 +2,14 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when function alias with -/// well bounded type parameters is declared. +/// +/// @description Checks that it is not an error to declare a type alias for a +/// function type with a type parameter whose bound is well-bounded. /// @Issue 36959, 37050, 42415 /// @author iarkh@unipro.ru - class A> {} typedef B> = X Function(X); diff --git a/Language/Generics/Superbounded_types/typedef2_A01_t01.dart b/Language/Generics/Superbounded_types/well_bounded_A04_t01.dart similarity index 53% rename from Language/Generics/Superbounded_types/typedef2_A01_t01.dart rename to Language/Generics/Superbounded_types/well_bounded_A04_t01.dart index 3ccf5d2981..c7e26644b1 100644 --- a/Language/Generics/Superbounded_types/typedef2_A01_t01.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A04_t01.dart @@ -2,16 +2,19 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown when function alias with not -/// well bounded type parameter is declared +/// +/// @description Checks that it is a compile-time error when a function type has +/// a type parameter bound which is a raw type that does not have simple bounds, +/// and when a function has a type parameter bound which is malbounded. /// @Issue 37031 /// @author iarkh@unipro.ru - class A> {} +// Here `B1` is a well-bounded type, but the bound is a raw type `A` that +// doesn't have simple bounds, and that's a compile-time error. typedef void B1(X); // ^ // [analyzer] unspecified @@ -22,11 +25,13 @@ typedef void B2>(X); // [analyzer] unspecified // [cfe] unspecified -typedef void B3>(X); +typedef void B3>(X); // A is a malbounded type // ^^^ // [analyzer] unspecified // [cfe] unspecified - main() { + print(B1); + print(B2); + print(B3); } diff --git a/Language/Generics/Superbounded_types/typedef2_A01_t02.dart b/Language/Generics/Superbounded_types/well_bounded_A04_t02.dart similarity index 68% rename from Language/Generics/Superbounded_types/typedef2_A01_t02.dart rename to Language/Generics/Superbounded_types/well_bounded_A04_t02.dart index 37eba12e13..8588bff09a 100644 --- a/Language/Generics/Superbounded_types/typedef2_A01_t02.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A04_t02.dart @@ -2,14 +2,14 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when function alias with -/// well bounded type parameter is declared +/// +/// @description Checks that it is not an error when a function type with a +/// type parameter whose bound is a well-bounded type is declared. /// @Issue 36959, 37050, 37034 /// @author iarkh@unipro.ru - class A> {} typedef void B1>(); @@ -23,4 +23,12 @@ typedef void B7>>(); typedef void B8>>(); main() { + print(B1); + print(B2); + print(B3); + print(B4); + print(B5); + print(B6); + print(B7); + print(B8); } diff --git a/Language/Generics/Superbounded_types/typedef2_A01_t03.dart b/Language/Generics/Superbounded_types/well_bounded_A04_t03.dart similarity index 71% rename from Language/Generics/Superbounded_types/typedef2_A01_t03.dart rename to Language/Generics/Superbounded_types/well_bounded_A04_t03.dart index a6d738eee1..d6d062d05e 100644 --- a/Language/Generics/Superbounded_types/typedef2_A01_t03.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A04_t03.dart @@ -2,14 +2,14 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when function alias with -/// well bounded type parameter is declared +/// +/// @description Checks that it is not an error when a function type with a +/// type parameter whose bound is a well-bounded type is declared. /// @Issue 36959 /// @author iarkh@unipro.ru - class A> {} typedef X B>(); diff --git a/Language/Generics/Superbounded_types/typedef2_A01_t04.dart b/Language/Generics/Superbounded_types/well_bounded_A04_t04.dart similarity index 67% rename from Language/Generics/Superbounded_types/typedef2_A01_t04.dart rename to Language/Generics/Superbounded_types/well_bounded_A04_t04.dart index dd885a5fd4..0b8d037d22 100644 --- a/Language/Generics/Superbounded_types/typedef2_A01_t04.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A04_t04.dart @@ -2,13 +2,13 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when function alias with -/// well bounded type parameters is declared. +/// +/// @description Checks that it is not an error when a function alias with a +/// type parameter whose bound is a well-bounded type is declared. /// @author iarkh@unipro.ru - class A> {} typedef void B>(X); diff --git a/Language/Generics/Superbounded_types/typedef3_A01_t01.dart b/Language/Generics/Superbounded_types/well_bounded_A05_t01.dart similarity index 51% rename from Language/Generics/Superbounded_types/typedef3_A01_t01.dart rename to Language/Generics/Superbounded_types/well_bounded_A05_t01.dart index 21fa619f93..92cc7c796e 100644 --- a/Language/Generics/Superbounded_types/typedef3_A01_t01.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A05_t01.dart @@ -2,14 +2,18 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is thrown when non-function type alias -/// with not well bounded type parameter is declared +/// +/// @description Checks that it is a compile-time error when a non-function type +/// has a type parameter bound which is a raw type that does not have simple +/// bounds, and when a function has a type parameter bound which is malbounded. /// @author iarkh@unipro.ru class A> {} +// Here B1 is a well-bounded type but the bound is a raw type A> that +// doesn't have simple bounds, and that's a compile-time error. typedef B1 = A; // ^ // [analyzer] unspecified @@ -18,10 +22,13 @@ typedef B2> = A; // ^ // [analyzer] unspecified // [cfe] unspecified -typedef B3> = A; +typedef B3> = A; // A is a malbounded type // ^^^ // [analyzer] unspecified // [cfe] unspecified main() { + print(B1); + print(B2); + print(B3); } diff --git a/Language/Generics/Superbounded_types/typedef3_A01_t02.dart b/Language/Generics/Superbounded_types/well_bounded_A05_t02.dart similarity index 55% rename from Language/Generics/Superbounded_types/typedef3_A01_t02.dart rename to Language/Generics/Superbounded_types/well_bounded_A05_t02.dart index 804face9b9..a5c00fa1d3 100644 --- a/Language/Generics/Superbounded_types/typedef3_A01_t02.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A05_t02.dart @@ -2,16 +2,23 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when non-function type -/// alias with well bounded type parameter is declared +/// +/// @description Checks that it is not an error to declare a non-function type +/// alias with a type parameter whose bound is a top type /// @author iarkh@unipro.ru class A {} +typedef Void = void; + typedef B1 = A; typedef B2 = A; +typedef B3 = A; main() { + print(B1); + print(B2); + print(B3); } diff --git a/Language/Generics/Superbounded_types/typedef3_A01_t03.dart b/Language/Generics/Superbounded_types/well_bounded_A05_t03.dart similarity index 71% rename from Language/Generics/Superbounded_types/typedef3_A01_t03.dart rename to Language/Generics/Superbounded_types/well_bounded_A05_t03.dart index 285fa1459a..8516f07969 100644 --- a/Language/Generics/Superbounded_types/typedef3_A01_t03.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A05_t03.dart @@ -2,10 +2,11 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when non-function type -/// alias with well bounded type parameter is declared +/// +/// @description Checks that it is a compile-time error when a non-function type +/// alias is declared with a type parameter which doesn't satisfy the bounds /// @Issue 44830 /// @author iarkh@unipro.ru @@ -29,4 +30,8 @@ typedef B4> = A; // [cfe] unspecified main() { + print(B1); + print(B2); + print(B3); + print(B4); } diff --git a/Language/Generics/Superbounded_types/typedef3_A01_t04.dart b/Language/Generics/Superbounded_types/well_bounded_A05_t04.dart similarity index 63% rename from Language/Generics/Superbounded_types/typedef3_A01_t04.dart rename to Language/Generics/Superbounded_types/well_bounded_A05_t04.dart index a3b7a27e7e..4ba1e4f516 100644 --- a/Language/Generics/Superbounded_types/typedef3_A01_t04.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A05_t04.dart @@ -2,10 +2,11 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when non-function type -/// alias variable with well bounded type parameter is declared +/// +/// @description Checks that it is not an error to declare a variable with a +/// type which is a non-function type alias with a well-bounded type parameter /// @author iarkh@unipro.ru class A {} diff --git a/Language/Generics/Superbounded_types/well_bounded_A05_t05.dart b/Language/Generics/Superbounded_types/well_bounded_A05_t05.dart new file mode 100644 index 0000000000..bcc680b295 --- /dev/null +++ b/Language/Generics/Superbounded_types/well_bounded_A05_t05.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2019, 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 Any use of a type `T` which is not well-bounded is a +/// compile-time error. +/// +/// @description Checks that it is not an error to declare a variable with a +/// type which is a non-function type alias with a well-bounded type parameter +/// @author iarkh@unipro.ru + +class A {} + +typedef B1 = A; + +typedef B2> = A; + +main() { + B1 b1; + B1> b2; + B1> b3; + B1> b4; + B1> b5; + B1> b6; + B2>>> b7; +} diff --git a/Language/Generics/Superbounded_types/typedef3_A01_t06.dart b/Language/Generics/Superbounded_types/well_bounded_A05_t06.dart similarity index 64% rename from Language/Generics/Superbounded_types/typedef3_A01_t06.dart rename to Language/Generics/Superbounded_types/well_bounded_A05_t06.dart index ca9bc6d4b5..cfc374f55c 100644 --- a/Language/Generics/Superbounded_types/typedef3_A01_t06.dart +++ b/Language/Generics/Superbounded_types/well_bounded_A05_t06.dart @@ -2,10 +2,11 @@ // 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 Any use of a type [T] which is not well-bounded is a +/// @assertion Any use of a type `T` which is not well-bounded is a /// compile-time error. -/// @description Checks that compile error is not thrown when non-function type -/// alias variable with not well bounded type parameter is declared +/// +/// @description Checks that it is a compile-time error to declare a variable +/// with a type which is a non-function type alias which is not well-bounded. /// @Issue 37031 /// @author iarkh@unipro.ru @@ -18,5 +19,4 @@ main() { // ^^^^^^ // [analyzer] unspecified // [cfe] unspecified - B>>> b2; }