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

Side by Side Diff: tests/language/factory_redirection_test.dart

Issue 34903006: Fix language tests for redirecting factories (issue 14297). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/parser.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class A<T> { 7 class A<T> {
8 A() : x = null; 8 A() : x = null;
9 9
10 const A.constant(this.x); 10 const A.constant(this.x);
(...skipping 18 matching lines...) Expand all
29 29
30 factory B.A() = A<T>; 30 factory B.A() = A<T>;
31 31
32 const factory B.A_constant(T x) = A<T>.constant; 32 const factory B.A_constant(T x) = A<T>.constant;
33 33
34 factory B.A_factory() = A<T>.factory; 34 factory B.A_factory() = A<T>.factory;
35 35
36 factory B.test04() = A.test04; /// 04: continued 36 factory B.test04() = A.test04; /// 04: continued
37 37
38 factory B.test05(int incompatible) = A<T>.factory; /// 05: runtime error 38 factory B.test05(int incompatible) = A<T>.factory; /// 05: runtime error
39
40 factory B.test05(int incompatible) = A<T>.factory; /// 06: runtime error
39 } 41 }
40 42
41 class C<K, V> extends B<V> { 43 class C<K, V> extends B<V> {
42 C(); 44 C();
43 45
44 factory C.A() = A<V>; 46 factory C.A() = A<V>;
45 47
46 factory C.A_factory() = A<V>.factory; 48 factory C.A_factory() = A<V>.factory;
47 49
48 const factory C.B_constant(V x) = B<V>.A_constant; 50 const factory C.B_constant(V x) = B<V>.A_constant;
49 51
50 factory C.test04() = B.test04; /// 04: continued 52 factory C.test04() = B.test04; /// 04: continued
51 53
52 factory C.test06(int incompatible) = B<K>.test05; /// 06: runtime error 54 factory C.test06(int incompatible) = B<K>.test05; /// 06: continued
53 55
54 const factory C.test07(V x) = B<V>.A; /// 07: compile-time error 56 const factory C.test07(V x) = B<V>.A; /// 07: compile-time error
55 } 57 }
56 58
57 main() { 59 main() {
58 new A<List>.test01(); /// 01: continued 60 new A<List>.test01(); /// 01: continued
59 new A<List>.test02(); /// 02: continued 61 new A<List>.test02(); /// 02: continued
60 new A<List>.test03(); /// 03: continued 62 new A<List>.test03(); /// 03: continued
61 new C.test04(); /// 04: continued 63 new C.test04(); /// 04: continued
62 new B.test05(0); /// 05: continued 64 new B.test05(0); /// 05: continued
63 new C.test06<int, int>(0); /// 06: continued 65 new C<int, int>.test06(0); /// 06: continued
64 new C.test07<int, int>(0); /// 07: continued 66 new C<int, int>.test07(0); /// 07: continued
65 Expect.isTrue(new A<List>() is A<List>); 67 Expect.isTrue(new A<List>() is A<List>);
66 Expect.isTrue(new A<bool>.constant(true).x); 68 Expect.isTrue(new A<bool>.constant(true).x);
67 Expect.isTrue(new A<Set>.factory() is B<Set>); 69 Expect.isTrue(new A<Set>.factory() is B<Set>);
68 Expect.isTrue(new B<List>.A() is A<List>); /// 08: dynamic type error 70 Expect.isTrue(new B<List>.A() is A<List>); /// 08: dynamic type error
69 Expect.isFalse(new B<List>.A() is A<Set>); /// 09: dynamic type error 71 Expect.isFalse(new B<List>.A() is A<Set>); /// 09: dynamic type error
70 Expect.isTrue(new B<bool>.A_constant(true).x); /// 10: dynamic type error 72 Expect.isTrue(new B<bool>.A_constant(true).x); /// 10: dynamic type error
71 Expect.isTrue(new B<List>.A_factory() is B<Set>); /// 11: dynamic type error 73 Expect.isTrue(new B<List>.A_factory() is B<Set>); /// 11: dynamic type error
72 Expect.isTrue(new C<String, num>.A() is A<num>); /// 12: dynamic type error 74 Expect.isTrue(new C<String, num>.A() is A<num>); /// 12: dynamic type error
73 Expect.isTrue(new C<String, num>.A_factory() is B<Set>); /// 13: dynamic type error 75 Expect.isTrue(new C<String, num>.A_factory() is B<Set>); /// 13: dynamic type error
74 Expect.isTrue(new C<String, bool>.B_constant(true).x); /// 14: dynamic type e rror 76 Expect.isTrue(new C<String, bool>.B_constant(true).x); /// 14: dynamic type e rror
75 } 77 }
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698