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

Side by Side Diff: tests/language_strong/built_in_identifier_prefix_test.dart

Issue 2992903002: Fix a couple of things causing bot redness: (Closed)
Patch Set: Created 3 years, 4 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_2/language_2.status ('k') | tests/language_strong/built_in_identifier_test.dart » ('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) 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that built-in identifiers can be used as library prefixes.
6
7 // From The Dart Programming Language Specification, section 11.30
8 // "Identifier Reference":
9 //
10 // "A built-in identifier is one of the identifiers produced by the
11 // production BUILT IN IDENTIFIER. It is a compile-time error if a
12 // built-in identifier is used as the declared name of a class, type
13 // parameter or type alias. It is a compile-time error to use a
14 // built-in identifier other than dynamic as a type annotation."
15 //
16 // Observation: it is not illegal to use a built-in identifier as a library
17 // prefix.
18 //
19 // Observation: it is not legal to use a built-in identifier as a type
20 // annotation. A type annotation is not fully defined in the
21 // specification, so we assume this means that the grammar production
22 // "type" cannot match a built-in identifier. Unfortunately, this
23 // doesn't prevent us from using built-in identifiers *in* type
24 // annotations. For example, "final abstract foo;" is illegal as
25 // "abstract" is used as a type annotation. However, "final
26 // abstract<dynamic> foo;" is not illegal because "abstract" is used
27 // as a typeName.
28
29 import "package:expect/expect.dart";
30 import 'built_in_identifier_prefix_library_abstract.dart' as abstract;
31 import 'built_in_identifier_prefix_library_as.dart' as as;
32 import 'built_in_identifier_prefix_library_dynamic.dart' as dynamic;
33 import 'built_in_identifier_prefix_library_export.dart' as export;
34 import 'built_in_identifier_prefix_library_external.dart' as external;
35 import 'built_in_identifier_prefix_library_factory.dart' as factory;
36 import 'built_in_identifier_prefix_library_get.dart' as get;
37 import 'built_in_identifier_prefix_library_implements.dart' as implements;
38 import 'built_in_identifier_prefix_library_import.dart' as import;
39 import 'built_in_identifier_prefix_library_library.dart' as library;
40 import 'built_in_identifier_prefix_library_operator.dart' as operator;
41 import 'built_in_identifier_prefix_library_part.dart' as part;
42 import 'built_in_identifier_prefix_library_set.dart' as set;
43 import 'built_in_identifier_prefix_library_static.dart' as static;
44 import 'built_in_identifier_prefix_library_typedef.dart' as typedef;
45
46 abstract.A _abstract = new abstract.A();
47 as.A _as = new as.A();
48 dynamic.A _dynamic = new dynamic.A();
49 export.A _export = new export.A();
50 external.A _external = new external.A();
51 factory.A _factory = new factory.A();
52 get.A _get = new get.A();
53 implements.A _implements = new implements.A();
54 import.A _import = new import.A();
55 library.A _library = new library.A();
56 operator.A _operator = new operator.A();
57 part.A _part = new part.A();
58 set.A _set = new set.A();
59 static.A _static = new static.A();
60 typedef.A _typedef = new typedef.A();
61
62 abstract<dynamic> generic_abstract = new abstract.A();
63 as<dynamic> generic_as = new as.A();
64 dynamic<dynamic> generic_dynamic = new dynamic.A();
65 export<dynamic> generic_export = new export.A();
66 external<dynamic> generic_external = new external.A();
67 factory<dynamic> generic_factory = new factory.A();
68 get<dynamic> generic_get = new get.A();
69 implements<dynamic> generic_implements = new implements.A();
70 import<dynamic> generic_import = new import.A();
71 library<dynamic> generic_library = new library.A();
72 operator<dynamic> generic_operator = new operator.A();
73 part<dynamic> generic_part = new part.A();
74 set<dynamic> generic_set = new set.A();
75 static<dynamic> generic_static = new static.A();
76 typedef<dynamic> generic_typedef = new typedef.A();
77
78 abstract.B<dynamic> dynamic_B_abstract = new abstract.B();
79 as.B<dynamic> dynamic_B_as = new as.B();
80 dynamic.B<dynamic> dynamic_B_dynamic = new dynamic.B();
81 export.B<dynamic> dynamic_B_export = new export.B();
82 external.B<dynamic> dynamic_B_external = new external.B();
83 factory.B<dynamic> dynamic_B_factory = new factory.B();
84 get.B<dynamic> dynamic_B_get = new get.B();
85 implements.B<dynamic> dynamic_B_implements = new implements.B();
86 import.B<dynamic> dynamic_B_import = new import.B();
87 library.B<dynamic> dynamic_B_library = new library.B();
88 operator.B<dynamic> dynamic_B_operator = new operator.B();
89 part.B<dynamic> dynamic_B_part = new part.B();
90 set.B<dynamic> dynamic_B_set = new set.B();
91 static.B<dynamic> dynamic_B_static = new static.B();
92 typedef.B<dynamic> dynamic_B_typedef = new typedef.B();
93
94 abstract.B<abstract<dynamic>> parameterized_B_abstract = new abstract.B();
95 as.B<as<dynamic>> parameterized_B_as = new as.B();
96 dynamic.B<dynamic<dynamic>> parameterized_B_dynamic = new dynamic.B();
97 export.B<export<dynamic>> parameterized_B_export = new export.B();
98 external.B<external<dynamic>> parameterized_B_external = new external.B();
99 factory.B<factory<dynamic>> parameterized_B_factory = new factory.B();
100 get.B<get<dynamic>> parameterized_B_get = new get.B();
101 implements.B<implements<dynamic>> parameterized_B_implements =
102 new implements.B();
103 import.B<import<dynamic>> parameterized_B_import = new import.B();
104 library.B<library<dynamic>> parameterized_B_library = new library.B();
105 operator.B<operator<dynamic>> parameterized_B_operator = new operator.B();
106 part.B<part<dynamic>> parameterized_B_part = new part.B();
107 set.B<set<dynamic>> parameterized_B_set = new set.B();
108 static.B<static<dynamic>> parameterized_B_static = new static.B();
109 typedef.B<typedef<dynamic>> parameterized_B_typedef = new typedef.B();
110
111 class UseA {
112 abstract.A abstract = new abstract.A();
113 as.A as = new as.A();
114 dynamic.A dynamic = new dynamic.A();
115 export.A export = new export.A();
116 external.A external = new external.A();
117 factory.A factory = new factory.A();
118 get.A get = new get.A();
119 implements.A implements = new implements.A();
120 import.A import = new import.A();
121 library.A library = new library.A();
122 operator.A operator = new operator.A();
123 part.A part = new part.A();
124 set.A set = new set.A();
125 static.A static = new static.A();
126 typedef.A typedef = new typedef.A();
127 }
128
129 main() {
130 bool assertionsEnabled = false;
131 assert(assertionsEnabled = true);
132
133 Expect.isTrue(_abstract is abstract.A);
134 Expect.isTrue(_as is as.A);
135 Expect.isTrue(_dynamic is dynamic.A);
136 Expect.isTrue(_export is export.A);
137 Expect.isTrue(_external is external.A);
138 Expect.isTrue(_factory is factory.A);
139 Expect.isTrue(_get is get.A);
140 Expect.isTrue(_implements is implements.A);
141 Expect.isTrue(_import is import.A);
142 Expect.isTrue(_library is library.A);
143 Expect.isTrue(_operator is operator.A);
144 Expect.isTrue(_part is part.A);
145 Expect.isTrue(_set is set.A);
146 Expect.isTrue(_static is static.A);
147 Expect.isTrue(_typedef is typedef.A);
148
149 Expect.isTrue(dynamic_B_abstract is abstract.B);
150 Expect.isTrue(dynamic_B_as is as.B);
151 Expect.isTrue(dynamic_B_dynamic is dynamic.B);
152 Expect.isTrue(dynamic_B_export is export.B);
153 Expect.isTrue(dynamic_B_external is external.B);
154 Expect.isTrue(dynamic_B_factory is factory.B);
155 Expect.isTrue(dynamic_B_get is get.B);
156 Expect.isTrue(dynamic_B_implements is implements.B);
157 Expect.isTrue(dynamic_B_import is import.B);
158 Expect.isTrue(dynamic_B_library is library.B);
159 Expect.isTrue(dynamic_B_operator is operator.B);
160 Expect.isTrue(dynamic_B_part is part.B);
161 Expect.isTrue(dynamic_B_set is set.B);
162 Expect.isTrue(dynamic_B_static is static.B);
163 Expect.isTrue(dynamic_B_typedef is typedef.B);
164
165 var x = new UseA();
166 Expect.isTrue(x.abstract is abstract.A);
167 Expect.isTrue(x.as is as.A);
168 Expect.isTrue(x.dynamic is dynamic.A);
169 Expect.isTrue(x.export is export.A);
170 Expect.isTrue(x.external is external.A);
171 Expect.isTrue(x.factory is factory.A);
172 Expect.isTrue(x.get is get.A);
173 Expect.isTrue(x.implements is implements.A);
174 Expect.isTrue(x.import is import.A);
175 Expect.isTrue(x.library is library.A);
176 Expect.isTrue(x.operator is operator.A);
177 Expect.isTrue(x.part is part.A);
178 Expect.isTrue(x.set is set.A);
179 Expect.isTrue(x.static is static.A);
180 Expect.isTrue(x.typedef is typedef.A);
181
182 // Most of the following variables have malformed type annotations.
183 if (assertionsEnabled) return;
184
185 Expect.isTrue(generic_abstract is abstract.A);
186 Expect.isTrue(generic_as is as.A);
187 Expect.isTrue(generic_dynamic is dynamic.A);
188 Expect.isTrue(generic_export is export.A);
189 Expect.isTrue(generic_external is external.A);
190 Expect.isTrue(generic_factory is factory.A);
191 Expect.isTrue(generic_get is get.A);
192 Expect.isTrue(generic_implements is implements.A);
193 Expect.isTrue(generic_import is import.A);
194 Expect.isTrue(generic_library is library.A);
195 Expect.isTrue(generic_operator is operator.A);
196 Expect.isTrue(generic_part is part.A);
197 Expect.isTrue(generic_set is set.A);
198 Expect.isTrue(generic_static is static.A);
199 Expect.isTrue(generic_typedef is typedef.A);
200
201 Expect.isTrue(parameterized_B_abstract is abstract.B);
202 Expect.isTrue(parameterized_B_as is as.B);
203 Expect.isTrue(parameterized_B_dynamic is dynamic.B);
204 Expect.isTrue(parameterized_B_export is export.B);
205 Expect.isTrue(parameterized_B_external is external.B);
206 Expect.isTrue(parameterized_B_factory is factory.B);
207 Expect.isTrue(parameterized_B_get is get.B);
208 Expect.isTrue(parameterized_B_implements is implements.B);
209 Expect.isTrue(parameterized_B_import is import.B);
210 Expect.isTrue(parameterized_B_library is library.B);
211 Expect.isTrue(parameterized_B_operator is operator.B);
212 Expect.isTrue(parameterized_B_part is part.B);
213 Expect.isTrue(parameterized_B_set is set.B);
214 Expect.isTrue(parameterized_B_static is static.B);
215 Expect.isTrue(parameterized_B_typedef is typedef.B);
216 }
OLDNEW
« no previous file with comments | « tests/language_2/language_2.status ('k') | tests/language_strong/built_in_identifier_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698