Skip to content

Commit

Permalink
dart-lang#2386. Rename well-bounded tests. Update descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Nov 28, 2023
1 parent 85c868a commit b79288d
Show file tree
Hide file tree
Showing 26 changed files with 198 additions and 121 deletions.
21 changes: 0 additions & 21 deletions Language/Generics/Superbounded_types/class_A01_t09.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends A<T>> {}

main() {
A a1;

A<dynamic> a2;
A<Object?> a3;
A<Object> a4;
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

A<void> a5;
A<Never> a6;

A<A<dynamic>> a7;
A<A<Object?>> a8;
A<A<Object>> a9;
// ^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

A<A<void>> a10;
A<A<Never>> a11;

A<A> a12;
A<A<A>> a13;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends A<T>> {}

main() {
A<Object> a0;
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
A<int> a1;
// ^^^
// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
Expand All @@ -23,5 +28,9 @@ main() {
A<A<A<int>>> a3;
// ^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
A<A<Object>> a4;
// ^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 thrown when class with not well
/// bounded type parameter is declared
///
/// @description Checks that it is a compile-time error when a class with a not
/// well-bounded type parameter is declared
/// @author iarkh@unipro.ru
class A<T extends A<T>> {}
Expand All @@ -27,4 +28,8 @@ class B3<X extends A<int>> {}
// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS

main() {
print(A);
print(B1);
print(B2);
print(B3);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 when a parametrized type which
/// extends a super-bounded type is declared
/// @Issue 37034
/// @author iarkh@unipro.ru

class A<T extends A<T>> {}

class B1<X extends A<Object?>> {}
Expand All @@ -18,4 +18,8 @@ class B3<X extends A<void>> {}
class B4<X extends A<Never>> {}

main() {
B1();
B2();
B3();
B4();
}
27 changes: 27 additions & 0 deletions Language/Generics/Superbounded_types/well_bounded_A01_t05.dart
Original file line number Diff line number Diff line change
@@ -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 when a class with a
/// super-bounded type parameter is declared
/// @Issue 37034, 37050
/// @author iarkh@unipro.ru
class A<T extends A<T>> {}

class B1<X extends A<X>> {}
class B2<X extends A<A<Object?>>> {}
class B3<X extends A<A<dynamic>>> {}
class B4<X extends A<A<void>>> {}
class B5<X extends A<A<Never>>> {}

main() {
B1<Never>();
B2();
B3();
B4();
B5();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 thrown when function with not well
/// bounded type parameter is declared
///
/// @description Checks that it is a compile-time error when a function with a
/// not well-bounded type parameter is declared
/// @author iarkh@unipro.ru
class A<T extends A<T>> {}
Expand All @@ -27,4 +28,7 @@ void testme3<X extends A<int>>() {}
// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS

main() {
print(testme1);
print(testme2);
print(testme3);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// well-bounded type parameter is declared
/// @Issue 36959, 37028, 37050
/// @author iarkh@unipro.ru

class A<T extends A<T>> {}

void testme1<X extends A<dynamic>>() {}
Expand All @@ -22,4 +22,13 @@ void testme6<X extends A<A<Object?>>>() {}
void testme7<X extends A<A<Never>>>() {}
void testme8<X extends A<A<void>>>() {}

main() {}
main() {
testme1();
testme2();
testme3();
testme4();
testme5();
testme6();
testme7();
testme8();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 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<T> {}
void testme<X extends num>() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 a type parameter which is not well-bounded
/// @author iarkh@unipro.ru

class A<T> {}
void testme<X extends num>() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 dependant well-bounded type parameters
/// @author iarkh@unipro.ru

class A<X extends A<X>> {}
void testme<X extends Y, Y extends A<X>>() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 dependant type parameters which are not well-bounded.
/// @Issue 37061
/// @author iarkh@unipro.ru

class A<X extends A<X>> {}
void testme<X extends Y, Y extends A<X>>() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 function alias with not
/// well bounded type parameter is declared
///
/// @description Checks that it is a compile-time error when a function alias
/// with a not well-bounded type parameter is declared
/// @Issue 37031
/// @author iarkh@unipro.ru

class A<T extends A<T>> {}

typedef B1<X extends A> = void Function();
Expand Down Expand Up @@ -98,4 +98,24 @@ typedef B20<X extends A<int>> = 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// well-bounded type parameter is declared
/// @Issue 36959, 37050, 37034
/// @author iarkh@unipro.ru

class A<T extends A<T>> {}

typedef B1<X extends A<dynamic>> = void Function();
Expand All @@ -23,4 +23,12 @@ typedef B7<X extends A<A<Object?>>> = void Function();
typedef B8<X extends A<A<void>>> = void Function();

main() {
print(B1);
print(B2);
print(B3);
print(B4);
print(B5);
print(B6);
print(B7);
print(B8);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// well-bounded type parameter is declared
/// @Issue 36959, 37050, 42415
/// @author iarkh@unipro.ru

class A<T extends A<T>> {}

typedef B<X extends A<X>> = void Function();
Expand Down

0 comments on commit b79288d

Please sign in to comment.