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

Side by Side Diff: tests/language_strong/generic_methods_recursive_bound_test.dart

Issue 3001803002: Migrate block 114 (and some of 113). (Closed)
Patch Set: Tweak app_jit status. Created 3 years, 3 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that F-bounded quantification works for generic methods, and that types
6 // that are passed to generic methods in dynamic calls are checked for being
7 // recursively defined.
8
9 library generic_methods_recursive_bound_test;
10
11 import "package:expect/expect.dart";
12
13 abstract class I<T> {
14 bool fun(T x);
15 }
16
17 void foo<T extends I<T>>(List<T> a) {
18 if (a.length > 1) {
19 a[0].fun(a[1]);
20 }
21 }
22
23 class C implements I<C> {
24 bool fun(C c) => true;
25 }
26
27 main() {
28 foo<C>(<C>[new C(), new C()]); //# 01: ok
29
30 dynamic bar = foo;
31 List<int> list2 = <int>[4, 2];
32 // The type int does not extend I<int>.
33 foo<int>(list2); //# 02: compile-time error
34 bar<int>(list2); //# 03: runtime error
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698