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

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

Issue 2756693002: Add generic-methods 'golden' tests for 'reify' transformation (Closed)
Patch Set: Mark tests with Crash/Fail in reify.status instead of excluding 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 that have bounds on type parameters can be
6 // overridden, and that type propagation can be used in such methods.
7
8 library generic_methods_overriding_type_propagation_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 F extends C {
23 String foobar(Z z) {
24 return "FZ";
25 }
26
27 String fun<T extends Y>(T t) {
28 if (t is Z) {
29 return this.foobar(t as Z);
30 }
31 return "FY";
32 }
33 }
34
35 main() {
36 Y y = new Y();
37 Z z = new Z();
38
39 C c = new C();
40 F f = new F();
41
42 expectTrue(c.fun<Y>(y) == "C");
43
44 expectTrue(f.fun<Y>(y) == "FY");
45 expectTrue(f.fun<Z>(z) == "FZ");
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698