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

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

Issue 2980293002: Added test using void in new positions. (Closed)
Patch Set: 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 | « no previous file | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Testing that the reserved word `void` is allowed to occur as a type.
6
7 import 'package:expect/expect.dart';
8
9 class A<T> {
10 T t;
11 const A(this.t);
12 }
13
14 const void x1 = null;
15 const A<void> x2 = const A<void>(null);
16
17 final void x3 = null;
18 final A<void> x4 = new A<void>(null);
19
20 void x5 = null, x6;
21 A<void> x7 = new A<void>(null), x8;
22
23 void get g1 => null;
24 A<void> get g2 => new A<void>(null);
25 void set s1(void x) => null;
26 void set s2(A<void> x) => null;
27 void m1(void x, [void y]) => null;
28 void m2(void x, {void y}) => null;
29 A<void> m3(A<void> x, [A<void> y]) => new A<void>(null);
30 A<void> m4(A<void> x, {A<void> y}) => new A<void>(null);
31
32 class B<S, T> {}
33
34 class C extends A<void> with B<void, A<void>> implements A<void> {
35 static final void x1 = null;
36 static final A<void> x2 = new A<void>(null);
37
38 static const void x3 = null;
39 static const A<void> x4 = const A<void>(null);
40
41 final void x5 = null, x6;
42 final A<void> x7 = new A<void>(null), x8;
43
44 static void x9 = null, x10;
45 static A<void> x11 = new A<void>(null), x12;
46
47 covariant void x13 = null, x14;
48 covariant A<void> x15 = new A<void>(null), x16;
49
50 static void get g1 => null;
51 static A<void> get g2 => new A<void>(null);
52 static void set s1(void x) => null;
53 static void set s2(A<void> x) => null;
54 static void m1(void x, [void y]) => null;
55 static void m2(void x, {void y}) => null;
56 static A<void> m3(A<void> x, [A<void> y]) => null;
57 static A<void> m4(A<void> x, {A<void> y}) => null;
58
59 void get g3 => null;
60 A<void> get g4 => new A<void>(null);
61 void set s3(void x) => null;
62 void set s4(A<void> x) => null;
63 void m5(void x, [void y]) => null;
64 void m6(void x, {void y}) => null;
65 A<void> m7(A<void> x, [A<void> y]) => null;
66 A<void> m8(A<void> x, {A<void> y}) => null;
67
68 // Ensure that all members are used, and use `void` in expressions.
69 void run() {
70 var ignore = [x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14,
71 x15, x16, g1, g2, g3, g4];
72
73 s1 = null;
74 s2 = new A<void>(null);
75 s3 = null;
76 s4 = new A<void>(null);
77 m1(null, null);
78 m2(null, y: null);
79 m3(null, new A<void>(null));
80 m4(null, y: new A<void>(null));
81 m5(null, null);
82 m6(null, y: null);
83 m7(null, new A<void>(null));
84 m8(null, y: new A<void>(null));
85
86 void pretendToUse(dynamic x) => null;
87 pretendToUse(<void>[]);
88 pretendToUse(<void, void>{});
89 pretendToUse(<A<void>>[]);
90 pretendToUse(<A<void>, A<void>>{});
91 }
92 }
93
94 // Testing syntax, just enforce compilation.
95 main() {
96 var ignore = [x1, x2, x3, x4, x5, x6, x7, x8, g1, g2];
97
98 s1 = null;
99 s2 = new A<void>(null);
100 m1(null, null);
101 m2(null, y: null);
102 m3(null, null);
103 m4(null, y: null);
104 new C().run();
105 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698