Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: tests/language_2/generic_methods_generic_function_result_test.dart

Issue 2989513002: [VM generic functions] Disallow generic function types as type arguments or bounds. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/language_2/language_2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language_2/generic_methods_generic_function_result_test.dart
diff --git a/tests/language_2/generic_methods_generic_function_result_test.dart b/tests/language_2/generic_methods_generic_function_result_test.dart
index 8c4d91c28a42147ebc99aa4a6c811307e0ec9514..56e9fa14959e63d4e6aaec1b007fa1bb3d115ef4 100644
--- a/tests/language_2/generic_methods_generic_function_result_test.dart
+++ b/tests/language_2/generic_methods_generic_function_result_test.dart
@@ -4,19 +4,25 @@
//
// VMOptions=--generic-method-syntax,--error-on-bad-type
-// Verify that function type parameter S can be resolved in bar.
+// Verify that function type parameter S can be resolved in bar's result type.
+// Verify that generic function types are not allowed as type arguments.
import "package:expect/expect.dart";
-T foo<T extends num>(int i, T t) => i + t;
+int foo
+ <T> //# 01: continued
+ (int i, int j) => i + j;
-List<T Function<T extends num>(S, T)> bar<S extends int>() {
- return <T Function<T extends num>(S, T)>[foo, foo];
+List<int Function
+ <T> //# 01: compile-time error
+ (S, int)> bar<S extends int>() {
+ return <int Function
+ <T> //# 01: continued
+ (S, int)>[foo, foo];
}
void main() {
var list = bar<int>();
- print(list[0]
- .runtimeType); // "<T extends num>(int, T) => T" when reifying generic functions.
+ print(list[0].runtimeType);
Expect.equals(123, list[1]<int>(100, 23));
}
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/language_2/language_2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698