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

Side by Side Diff: pkg/kernel/testcases/reify/generic_methods_overriding_contravariance_test.dart

Issue 2756693002: Add generic-methods 'golden' tests for 'reify' transformation (Closed)
Patch Set: 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
(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 generic methods can be overridden using the bound of a type
6 // variable as the type of the parameter in the overloaded method.
7
8 library generic_methods_overriding_contravariance_test;
9
10 import "test_base.dart";
11
12 class X {}
13
14 class Y extends X {}
15
16 class Z extends Y {}
17
18 class C {
19 String fun<T extends Y>(T t) => "C";
20 }
21
22 class E extends C {
23 String fun<T extends Y>(Y y) => "E";
24 }
25
26 main() {
27 Y y = new Y();
28
29 C c = new C();
30 E e = new E();
31
32 expectTrue(c.fun<Y>(y) == "C");
33 expectTrue(e.fun<Y>(y) == "E");
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698