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

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

Issue 2456803004: fixes #27586, prefer context type in generic inference (Closed)
Patch Set: fix Created 3 years, 9 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
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Regression test for recursive inheritance patterns 7 // Regression test for recursive inheritance patterns
8 abstract class Comparable<T> { 8 abstract class Comparable<T> {
9 int compare(T a); 9 int compareTo(T a);
10 } 10 }
11 class MI<T extends MI<T>> { 11 class MI<T extends MI<T>> {}
12 } 12
13 class _MI extends MI<_MI> {}
13 14
14 class PMI<T extends Comparable<T>> extends MI<PMI<T>> {} 15 class PMI<T extends Comparable<T>> extends MI<PMI<T>> {}
15 16
17 class _PMI extends PMI<_PMI> implements Comparable<_PMI> {
18 int compareTo(_PMI other) => throw new UnimplementedError();
19 }
20
16 void main() { 21 void main() {
17 var a = new MI(); 22 MI a = new MI<_MI>();
18 var b = new PMI(); 23 PMI b = new PMI<_PMI>();
19 a = b; 24 a = b;
20 Expect.isTrue(a is MI); 25 Expect.isTrue(a is MI);
21 Expect.isTrue(b is PMI); 26 Expect.isTrue(b is PMI);
22 Expect.isTrue(b is MI); 27 Expect.isTrue(b is MI);
23 Expect.isTrue(b is MI<PMI>); 28 Expect.isTrue(b is MI<PMI>);
24 } 29 }
OLDNEW
« no previous file with comments | « tests/language_strong/recursive_generic_test.dart ('k') | tests/lib_strong/html/documentfragment_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698