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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // VMOptions=--generic-method-syntax,--error-on-bad-type 5 // VMOptions=--generic-method-syntax,--error-on-bad-type
6 6
7 // Verify that function type parameter S can be resolved in bar. 7 // Verify that function type parameter S can be resolved in bar's result type.
8 // Verify that generic function types are not allowed as type arguments.
8 9
9 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
10 11
11 T foo<T extends num>(int i, T t) => i + t; 12 int foo
13 <T> //# 01: continued
14 (int i, int j) => i + j;
12 15
13 List<T Function<T extends num>(S, T)> bar<S extends int>() { 16 List<int Function
14 return <T Function<T extends num>(S, T)>[foo, foo]; 17 <T> //# 01: compile-time error
18 (S, int)> bar<S extends int>() {
19 return <int Function
20 <T> //# 01: continued
21 (S, int)>[foo, foo];
15 } 22 }
16 23
17 void main() { 24 void main() {
18 var list = bar<int>(); 25 var list = bar<int>();
19 print(list[0] 26 print(list[0].runtimeType);
20 .runtimeType); // "<T extends num>(int, T) => T" when reifying generic fun ctions.
21 Expect.equals(123, list[1]<int>(100, 23)); 27 Expect.equals(123, list[1]<int>(100, 23));
22 } 28 }
OLDNEW
« 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