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/type_no_hoisting_test.dart

Issue 2954523002: fix #27259, implement covariance checking for strong mode and DDC (Closed)
Patch Set: merged and fix an analysis error Created 3 years, 5 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
« no previous file with comments | « tests/language_strong/type_hoisting_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // compile options: --no-hoist-signature-types --no-hoist-instance-creation --na me-type-tests
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file.
5 import "package:expect/expect.dart";
6
7 class A<T> {
8 A(this.x, T z);
9 A.make();
10 void f(T x) {}
11 static String g(String x) {
12 return x;
13 }
14
15 T x;
16 }
17
18 class B extends A<int> {
19 B(int x, int z) : super(x, z);
20 B.make() : super.make();
21 void f(int x) {}
22 static int g(int x) {
23 return x;
24 }
25 }
26
27 class C {
28 C(this.x, int z);
29 void f(int x) {}
30 static int g(int x) {
31 return x;
32 }
33
34 int x = 0;
35 }
36
37 typedef void ToVoid<T>(T x);
38 typedef T Id<T>(T x);
39
40 void main() {
41 {
42 A<String> a = new A<String>("hello", "world");
43 Expect.isTrue(new A<String>.make() is! A<int>);
44 Expect.isTrue(new A.make() is A);
45 Expect.isTrue(a is! A<int>);
46 Expect.isTrue(a is A<String>);
47 Expect.isTrue(a.f is ToVoid<String>);
48 Expect.isTrue(A.g is Id<String>);
49 }
50 {
51 B b = new B(0, 1);
52 Expect.isTrue(new B.make() is B);
53 Expect.isTrue(new B.make() is A<int>);
54 Expect.isTrue(b is B);
55 Expect.isTrue(b.f is ToVoid<int>);
56 Expect.isTrue(B.g is Id<int>);
57 }
58 {
59 C c = new C(0, 1);
60 Expect.isTrue(c is C);
61 Expect.isTrue(c.f is ToVoid<int>);
62 Expect.isTrue(C.g is Id<int>);
63 }
64 }
OLDNEW
« no previous file with comments | « tests/language_strong/type_hoisting_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698