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

Side by Side Diff: tests/language_strong/recursive_generic_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 abstract class S<T extends S<T>> { m() => 123; get S_T => T; } 7 abstract class S<T extends S<T>> { m() => 123; get S_T => T; }
8 class C<T extends C<T>> extends S<C> { m() => 456; get C_T => T; } 8 class C<T extends C<T>> extends S<C> { m() => 456; get C_T => T; }
9 9
10 class D extends C<D> {}
11
10 main() { 12 main() {
11 Expect.equals(new C().m(), 456); 13 Expect.equals(new C<D>().m(), 456);
12 // TODO(jmesserly): this should be dart1 vs dart2, not DDC vs VM. 14 // TODO(jmesserly): this should be dart1 vs dart2, not DDC vs VM.
13 var isVM = const bool.fromEnvironment('dart.isVM'); 15 var isVM = const bool.fromEnvironment('dart.isVM');
14 Expect.equals(new C().S_T.toString(), isVM ? 'C' : 'C<C>'); 16 Expect.equals(new C<D>().S_T.toString(), isVM ? 'C' : 'C<C>');
15 Expect.equals(new C().C_T.toString(), isVM ? 'dynamic' : 'C'); 17 Expect.equals(new C<D>().C_T.toString(), isVM ? 'dynamic' : 'D');
16 } 18 }
OLDNEW
« no previous file with comments | « tests/language_strong/issue_23914_test.dart ('k') | tests/language_strong/recursive_inheritance_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698