OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library engine.error; | 5 library engine.error; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'java_core.dart'; | 8 |
9 import 'source.dart'; | |
10 import 'scanner.dart' show Token; | |
11 import 'ast.dart' show AstNode; | 9 import 'ast.dart' show AstNode; |
12 import 'element.dart'; | 10 import 'element.dart'; |
| 11 import 'java_core.dart'; |
| 12 import 'scanner.dart' show Token; |
| 13 import 'source.dart'; |
13 | 14 |
14 /** | 15 /** |
15 * Instances of the class `AnalysisError` represent an error discovered during t
he analysis of | 16 * Instances of the class `AnalysisError` represent an error discovered during t
he analysis of |
16 * some Dart code. | 17 * some Dart code. |
17 * | 18 * |
18 * See [AnalysisErrorListener]. | 19 * See [AnalysisErrorListener]. |
19 */ | 20 */ |
20 class AnalysisError { | 21 class AnalysisError { |
21 /** | 22 /** |
22 * An empty array of errors used when no errors are expected. | 23 * An empty array of errors used when no errors are expected. |
23 */ | 24 */ |
24 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[]; | 25 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[]; |
25 | 26 |
26 /** | 27 /** |
27 * A [Comparator] that sorts by the name of the file that the [AnalysisError]
was | 28 * A [Comparator] that sorts by the name of the file that the [AnalysisError]
was |
28 * found. | 29 * found. |
29 */ | 30 */ |
30 static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1, Analysis
Error o2) => o1.source.shortName.compareTo(o2.source.shortName); | 31 static Comparator<AnalysisError> FILE_COMPARATOR = |
| 32 (AnalysisError o1, AnalysisError o2) => |
| 33 o1.source.shortName.compareTo(o2.source.shortName); |
31 | 34 |
32 /** | 35 /** |
33 * A [Comparator] that sorts error codes first by their severity (errors first
, warnings | 36 * A [Comparator] that sorts error codes first by their severity (errors first
, warnings |
34 * second), and then by the the error code type. | 37 * second), and then by the the error code type. |
35 */ | 38 */ |
36 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = (AnalysisError o1, An
alysisError o2) { | 39 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = |
| 40 (AnalysisError o1, AnalysisError o2) { |
37 ErrorCode errorCode1 = o1.errorCode; | 41 ErrorCode errorCode1 = o1.errorCode; |
38 ErrorCode errorCode2 = o2.errorCode; | 42 ErrorCode errorCode2 = o2.errorCode; |
39 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity; | 43 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity; |
40 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity; | 44 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity; |
41 ErrorType errorType1 = errorCode1.type; | 45 ErrorType errorType1 = errorCode1.type; |
42 ErrorType errorType2 = errorCode2.type; | 46 ErrorType errorType2 = errorCode2.type; |
43 if (errorSeverity1 == errorSeverity2) { | 47 if (errorSeverity1 == errorSeverity2) { |
44 return errorType1.compareTo(errorType2); | 48 return errorType1.compareTo(errorType2); |
45 } else { | 49 } else { |
46 return errorSeverity2.compareTo(errorSeverity1); | 50 return errorSeverity2.compareTo(errorSeverity1); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 103 |
100 /** | 104 /** |
101 * Initialize a newly created analysis error for the specified source at the g
iven location. | 105 * Initialize a newly created analysis error for the specified source at the g
iven location. |
102 * | 106 * |
103 * @param source the source for which the exception occurred | 107 * @param source the source for which the exception occurred |
104 * @param offset the offset of the location of the error | 108 * @param offset the offset of the location of the error |
105 * @param length the length of the location of the error | 109 * @param length the length of the location of the error |
106 * @param errorCode the error code to be associated with this error | 110 * @param errorCode the error code to be associated with this error |
107 * @param arguments the arguments used to build the error message | 111 * @param arguments the arguments used to build the error message |
108 */ | 112 */ |
109 AnalysisError.con2(this.source, int offset, int length, this.errorCode, [List<
Object> arguments]) { | 113 AnalysisError.con2(this.source, int offset, int length, this.errorCode, |
| 114 [List<Object> arguments]) { |
110 this._offset = offset; | 115 this._offset = offset; |
111 this._length = length; | 116 this._length = length; |
112 this._message = formatList(errorCode.message, arguments); | 117 this._message = formatList(errorCode.message, arguments); |
113 String correctionTemplate = errorCode.correction; | 118 String correctionTemplate = errorCode.correction; |
114 if (correctionTemplate != null) { | 119 if (correctionTemplate != null) { |
115 this._correction = formatList(correctionTemplate, arguments); | 120 this._correction = formatList(correctionTemplate, arguments); |
116 } | 121 } |
117 } | 122 } |
118 | 123 |
119 @override | |
120 bool operator ==(Object obj) { | |
121 if (identical(obj, this)) { | |
122 return true; | |
123 } | |
124 // prepare other AnalysisError | |
125 if (obj is! AnalysisError) { | |
126 return false; | |
127 } | |
128 AnalysisError other = obj as AnalysisError; | |
129 // Quick checks. | |
130 if (!identical(errorCode, other.errorCode)) { | |
131 return false; | |
132 } | |
133 if (_offset != other._offset || _length != other._length) { | |
134 return false; | |
135 } | |
136 if (isStaticOnly != other.isStaticOnly) { | |
137 return false; | |
138 } | |
139 // Deep checks. | |
140 if (_message != other._message) { | |
141 return false; | |
142 } | |
143 if (source != other.source) { | |
144 return false; | |
145 } | |
146 // OK | |
147 return true; | |
148 } | |
149 | |
150 /** | 124 /** |
151 * Return the correction to be displayed for this error, or `null` if there is
no correction | 125 * Return the correction to be displayed for this error, or `null` if there is
no correction |
152 * information for this error. The correction should indicate how the user can
fix the error. | 126 * information for this error. The correction should indicate how the user can
fix the error. |
153 * | 127 * |
154 * @return the template used to create the correction to be displayed for this
error | 128 * @return the template used to create the correction to be displayed for this
error |
155 */ | 129 */ |
156 String get correction => _correction; | 130 String get correction => _correction; |
157 | 131 |
| 132 @override |
| 133 int get hashCode { |
| 134 int hashCode = _offset; |
| 135 hashCode ^= (_message != null) ? _message.hashCode : 0; |
| 136 hashCode ^= (source != null) ? source.hashCode : 0; |
| 137 return hashCode; |
| 138 } |
| 139 |
158 /** | 140 /** |
159 * Return the number of characters from the offset to the end of the source wh
ich encompasses the | 141 * Return the number of characters from the offset to the end of the source wh
ich encompasses the |
160 * compilation error. | 142 * compilation error. |
161 * | 143 * |
162 * @return the length of the error location | 144 * @return the length of the error location |
163 */ | 145 */ |
164 int get length => _length; | 146 int get length => _length; |
165 | 147 |
166 /** | 148 /** |
167 * Return the message to be displayed for this error. The message should indic
ate what is wrong | 149 * Return the message to be displayed for this error. The message should indic
ate what is wrong |
168 * and why it is wrong. | 150 * and why it is wrong. |
169 * | 151 * |
170 * @return the message to be displayed for this error | 152 * @return the message to be displayed for this error |
171 */ | 153 */ |
172 String get message => _message; | 154 String get message => _message; |
173 | 155 |
174 /** | 156 /** |
175 * Return the character offset from the beginning of the source (zero based) w
here the error | 157 * Return the character offset from the beginning of the source (zero based) w
here the error |
176 * occurred. | 158 * occurred. |
177 * | 159 * |
178 * @return the offset to the start of the error location | 160 * @return the offset to the start of the error location |
179 */ | 161 */ |
180 int get offset => _offset; | 162 int get offset => _offset; |
181 | 163 |
| 164 @override |
| 165 bool operator ==(Object obj) { |
| 166 if (identical(obj, this)) { |
| 167 return true; |
| 168 } |
| 169 // prepare other AnalysisError |
| 170 if (obj is! AnalysisError) { |
| 171 return false; |
| 172 } |
| 173 AnalysisError other = obj as AnalysisError; |
| 174 // Quick checks. |
| 175 if (!identical(errorCode, other.errorCode)) { |
| 176 return false; |
| 177 } |
| 178 if (_offset != other._offset || _length != other._length) { |
| 179 return false; |
| 180 } |
| 181 if (isStaticOnly != other.isStaticOnly) { |
| 182 return false; |
| 183 } |
| 184 // Deep checks. |
| 185 if (_message != other._message) { |
| 186 return false; |
| 187 } |
| 188 if (source != other.source) { |
| 189 return false; |
| 190 } |
| 191 // OK |
| 192 return true; |
| 193 } |
| 194 |
182 /** | 195 /** |
183 * Return the value of the given property, or `null` if the given property is
not defined | 196 * Return the value of the given property, or `null` if the given property is
not defined |
184 * for this error. | 197 * for this error. |
185 * | 198 * |
186 * @param property the property whose value is to be returned | 199 * @param property the property whose value is to be returned |
187 * @return the value of the given property | 200 * @return the value of the given property |
188 */ | 201 */ |
189 Object getProperty(ErrorProperty property) => null; | 202 Object getProperty(ErrorProperty property) => null; |
190 | 203 |
191 @override | 204 @override |
192 int get hashCode { | |
193 int hashCode = _offset; | |
194 hashCode ^= (_message != null) ? _message.hashCode : 0; | |
195 hashCode ^= (source != null) ? source.hashCode : 0; | |
196 return hashCode; | |
197 } | |
198 | |
199 @override | |
200 String toString() { | 205 String toString() { |
201 StringBuffer buffer = new StringBuffer(); | 206 StringBuffer buffer = new StringBuffer(); |
202 buffer.write((source != null) ? source.fullName : "<unknown source>"); | 207 buffer.write((source != null) ? source.fullName : "<unknown source>"); |
203 buffer.write("("); | 208 buffer.write("("); |
204 buffer.write(_offset); | 209 buffer.write(_offset); |
205 buffer.write(".."); | 210 buffer.write(".."); |
206 buffer.write(_offset + _length - 1); | 211 buffer.write(_offset + _length - 1); |
207 buffer.write("): "); | 212 buffer.write("): "); |
208 //buffer.write("(" + lineNumber + ":" + columnNumber + "): "); | 213 //buffer.write("(" + lineNumber + ":" + columnNumber + "): "); |
209 buffer.write(_message); | 214 buffer.write(_message); |
210 return buffer.toString(); | 215 return buffer.toString(); |
211 } | 216 } |
212 } | 217 } |
213 | 218 |
214 /** | 219 /** |
215 * The interface `AnalysisErrorListener` defines the behavior of objects that li
sten for | 220 * The interface `AnalysisErrorListener` defines the behavior of objects that li
sten for |
216 * [AnalysisError] being produced by the analysis engine. | 221 * [AnalysisError] being produced by the analysis engine. |
217 */ | 222 */ |
218 abstract class AnalysisErrorListener { | 223 abstract class AnalysisErrorListener { |
219 /** | 224 /** |
220 * An error listener that ignores errors that are reported to it. | 225 * An error listener that ignores errors that are reported to it. |
221 */ | 226 */ |
222 static final AnalysisErrorListener NULL_LISTENER = new AnalysisErrorListener_N
ULL_LISTENER(); | 227 static final AnalysisErrorListener NULL_LISTENER = |
| 228 new AnalysisErrorListener_NULL_LISTENER(); |
223 | 229 |
224 /** | 230 /** |
225 * This method is invoked when an error has been found by the analysis engine. | 231 * This method is invoked when an error has been found by the analysis engine. |
226 * | 232 * |
227 * @param error the error that was just found (not `null`) | 233 * @param error the error that was just found (not `null`) |
228 */ | 234 */ |
229 void onError(AnalysisError error); | 235 void onError(AnalysisError error); |
230 } | 236 } |
231 | 237 |
232 class AnalysisErrorListener_NULL_LISTENER implements AnalysisErrorListener { | 238 class AnalysisErrorListener_NULL_LISTENER implements AnalysisErrorListener { |
233 @override | 239 @override |
234 void onError(AnalysisError event) { | 240 void onError(AnalysisError event) { |
235 // Ignore errors | 241 // Ignore errors |
236 } | 242 } |
237 } | 243 } |
238 | 244 |
239 /** | 245 /** |
240 * Instances of the class `AnalysisErrorWithProperties` | 246 * Instances of the class `AnalysisErrorWithProperties` |
241 */ | 247 */ |
242 class AnalysisErrorWithProperties extends AnalysisError { | 248 class AnalysisErrorWithProperties extends AnalysisError { |
243 /** | 249 /** |
244 * The properties associated with this error. | 250 * The properties associated with this error. |
245 */ | 251 */ |
246 HashMap<ErrorProperty, Object> _propertyMap = new HashMap<ErrorProperty, Objec
t>(); | 252 HashMap<ErrorProperty, Object> _propertyMap = |
| 253 new HashMap<ErrorProperty, Object>(); |
247 | 254 |
248 /** | 255 /** |
249 * Initialize a newly created analysis error for the specified source. The err
or has no location | 256 * Initialize a newly created analysis error for the specified source. The err
or has no location |
250 * information. | 257 * information. |
251 * | 258 * |
252 * @param source the source for which the exception occurred | 259 * @param source the source for which the exception occurred |
253 * @param errorCode the error code to be associated with this error | 260 * @param errorCode the error code to be associated with this error |
254 * @param arguments the arguments used to build the error message | 261 * @param arguments the arguments used to build the error message |
255 */ | 262 */ |
256 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, List<Obje
ct> arguments) : super.con1(source, errorCode, arguments); | 263 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, |
| 264 List<Object> arguments) |
| 265 : super.con1(source, errorCode, arguments); |
257 | 266 |
258 /** | 267 /** |
259 * Initialize a newly created analysis error for the specified source at the g
iven location. | 268 * Initialize a newly created analysis error for the specified source at the g
iven location. |
260 * | 269 * |
261 * @param source the source for which the exception occurred | 270 * @param source the source for which the exception occurred |
262 * @param offset the offset of the location of the error | 271 * @param offset the offset of the location of the error |
263 * @param length the length of the location of the error | 272 * @param length the length of the location of the error |
264 * @param errorCode the error code to be associated with this error | 273 * @param errorCode the error code to be associated with this error |
265 * @param arguments the arguments used to build the error message | 274 * @param arguments the arguments used to build the error message |
266 */ | 275 */ |
267 AnalysisErrorWithProperties.con2(Source source, int offset, int length, ErrorC
ode errorCode, List<Object> arguments) : super.con2(source, offset, length, erro
rCode, arguments); | 276 AnalysisErrorWithProperties.con2(Source source, int offset, int length, |
| 277 ErrorCode errorCode, List<Object> arguments) |
| 278 : super.con2(source, offset, length, errorCode, arguments); |
268 | 279 |
269 @override | 280 @override |
270 Object getProperty(ErrorProperty property) => _propertyMap[property]; | 281 Object getProperty(ErrorProperty property) => _propertyMap[property]; |
271 | 282 |
272 /** | 283 /** |
273 * Set the value of the given property to the given value. Using a value of `n
ull` will | 284 * Set the value of the given property to the given value. Using a value of `n
ull` will |
274 * effectively remove the property from this error. | 285 * effectively remove the property from this error. |
275 * | 286 * |
276 * @param property the property whose value is to be returned | 287 * @param property the property whose value is to be returned |
277 * @param value the new value of the given property | 288 * @param value the new value of the given property |
278 */ | 289 */ |
279 void setProperty(ErrorProperty property, Object value) { | 290 void setProperty(ErrorProperty property, Object value) { |
280 _propertyMap[property] = value; | 291 _propertyMap[property] = value; |
281 } | 292 } |
282 } | 293 } |
283 | 294 |
284 /** | 295 /** |
285 * The enumeration `AngularCode` defines Angular specific problems. | 296 * The enumeration `AngularCode` defines Angular specific problems. |
286 */ | 297 */ |
287 class AngularCode extends ErrorCode { | 298 class AngularCode extends ErrorCode { |
288 static const AngularCode CANNOT_PARSE_SELECTOR | 299 static const AngularCode CANNOT_PARSE_SELECTOR = const AngularCode( |
289 = const AngularCode( | 300 'CANNOT_PARSE_SELECTOR', |
290 'CANNOT_PARSE_SELECTOR', | 301 "The selector '{0}' cannot be parsed"); |
291 "The selector '{0}' cannot be parsed"); | |
292 | 302 |
293 static const AngularCode INVALID_FORMATTER_NAME | 303 static const AngularCode INVALID_FORMATTER_NAME = const AngularCode( |
294 = const AngularCode( | 304 'INVALID_FORMATTER_NAME', |
295 'INVALID_FORMATTER_NAME', | 305 "Formatter name must be a simple identifier"); |
296 "Formatter name must be a simple identifier"); | |
297 | 306 |
298 static const AngularCode INVALID_PROPERTY_KIND | 307 static const AngularCode INVALID_PROPERTY_KIND = const AngularCode( |
299 = const AngularCode( | 308 'INVALID_PROPERTY_KIND', |
300 'INVALID_PROPERTY_KIND', | 309 "Unknown property binding kind '{0}', use one of the '@', '=>', '=>!' or '
<=>'"); |
301 "Unknown property binding kind '{0}', use one of the '@', '=>', '=>!'
or '<=>'"); | |
302 | 310 |
303 static const AngularCode INVALID_PROPERTY_FIELD | 311 static const AngularCode INVALID_PROPERTY_FIELD = |
304 = const AngularCode( | 312 const AngularCode('INVALID_PROPERTY_FIELD', "Unknown property field '{0}'"
); |
305 'INVALID_PROPERTY_FIELD', | |
306 "Unknown property field '{0}'"); | |
307 | 313 |
308 static const AngularCode INVALID_PROPERTY_MAP | 314 static const AngularCode INVALID_PROPERTY_MAP = const AngularCode( |
309 = const AngularCode( | 315 'INVALID_PROPERTY_MAP', |
310 'INVALID_PROPERTY_MAP', | 316 "Argument 'map' must be a constant map literal"); |
311 "Argument 'map' must be a constant map literal"); | |
312 | 317 |
313 static const AngularCode INVALID_PROPERTY_NAME | 318 static const AngularCode INVALID_PROPERTY_NAME = const AngularCode( |
314 = const AngularCode( | 319 'INVALID_PROPERTY_NAME', |
315 'INVALID_PROPERTY_NAME', | 320 "Property name must be a string literal"); |
316 "Property name must be a string literal"); | |
317 | 321 |
318 static const AngularCode INVALID_PROPERTY_SPEC | 322 static const AngularCode INVALID_PROPERTY_SPEC = const AngularCode( |
319 = const AngularCode( | 323 'INVALID_PROPERTY_SPEC', |
320 'INVALID_PROPERTY_SPEC', | 324 "Property binding specification must be a string literal"); |
321 "Property binding specification must be a string literal"); | |
322 | 325 |
323 static const AngularCode INVALID_REPEAT_SYNTAX | 326 static const AngularCode INVALID_REPEAT_SYNTAX = const AngularCode( |
324 = const AngularCode( | 327 'INVALID_REPEAT_SYNTAX', |
325 'INVALID_REPEAT_SYNTAX', | 328 "Expected statement in form '_item_ in _collection_ [tracked by _id_]'"); |
326 "Expected statement in form '_item_ in _collection_ [tracked by _id_]'
"); | |
327 | 329 |
328 static const AngularCode INVALID_REPEAT_ITEM_SYNTAX | 330 static const AngularCode INVALID_REPEAT_ITEM_SYNTAX = const AngularCode( |
329 = const AngularCode( | 331 'INVALID_REPEAT_ITEM_SYNTAX', |
330 'INVALID_REPEAT_ITEM_SYNTAX', | 332 "Item must by identifier or in '(_key_, _value_)' pair."); |
331 "Item must by identifier or in '(_key_, _value_)' pair."); | |
332 | 333 |
333 static const AngularCode INVALID_URI | 334 static const AngularCode INVALID_URI = |
334 = const AngularCode( | 335 const AngularCode('INVALID_URI', "Invalid URI syntax: '{0}'"); |
335 'INVALID_URI', | |
336 "Invalid URI syntax: '{0}'"); | |
337 | 336 |
338 static const AngularCode MISSING_FORMATTER_COLON | 337 static const AngularCode MISSING_FORMATTER_COLON = const AngularCode( |
339 = const AngularCode( | 338 'MISSING_FORMATTER_COLON', |
340 'MISSING_FORMATTER_COLON', | 339 "Missing ':' before formatter argument"); |
341 "Missing ':' before formatter argument"); | |
342 | 340 |
343 static const AngularCode MISSING_NAME | 341 static const AngularCode MISSING_NAME = |
344 = const AngularCode( | 342 const AngularCode('MISSING_NAME', "Argument 'name' must be provided"); |
345 'MISSING_NAME', | |
346 "Argument 'name' must be provided"); | |
347 | 343 |
348 static const AngularCode MISSING_PUBLISH_AS | 344 static const AngularCode MISSING_PUBLISH_AS = const AngularCode( |
349 = const AngularCode( | 345 'MISSING_PUBLISH_AS', |
350 'MISSING_PUBLISH_AS', | 346 "Argument 'publishAs' must be provided"); |
351 "Argument 'publishAs' must be provided"); | |
352 | 347 |
353 static const AngularCode MISSING_SELECTOR | 348 static const AngularCode MISSING_SELECTOR = |
354 = const AngularCode( | 349 const AngularCode('MISSING_SELECTOR', "Argument 'selector' must be provide
d"); |
355 'MISSING_SELECTOR', | |
356 "Argument 'selector' must be provided"); | |
357 | 350 |
358 static const AngularCode URI_DOES_NOT_EXIST | 351 static const AngularCode URI_DOES_NOT_EXIST = |
359 = const AngularCode( | 352 const AngularCode('URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0
}'"); |
360 'URI_DOES_NOT_EXIST', | |
361 "Target of URI does not exist: '{0}'"); | |
362 | 353 |
363 /** | 354 /** |
364 * Initialize a newly created error code to have the given [name]. The message | 355 * Initialize a newly created error code to have the given [name]. The message |
365 * associated with the error will be created from the given [message] | 356 * associated with the error will be created from the given [message] |
366 * template. The correction associated with the error will be created from the | 357 * template. The correction associated with the error will be created from the |
367 * given [correction] template. | 358 * given [correction] template. |
368 */ | 359 */ |
369 const AngularCode(String name, String message, [String correction]) | 360 const AngularCode(String name, String message, [String correction]) |
370 : super(name, message, correction); | 361 : super(name, message, correction); |
371 | 362 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 // clear to the user that the error is coming from constant evaluation (and | 403 // clear to the user that the error is coming from constant evaluation (and |
413 // hence the constant needs to be a subtype of the annotated type) as opposed | 404 // hence the constant needs to be a subtype of the annotated type) as opposed |
414 // to static type analysis (which only requires that the two types be | 405 // to static type analysis (which only requires that the two types be |
415 // assignable). Also consider populating the "correction" field for these | 406 // assignable). Also consider populating the "correction" field for these |
416 // errors. | 407 // errors. |
417 | 408 |
418 /** | 409 /** |
419 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 410 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
420 * object results in an uncaught exception being thrown. | 411 * object results in an uncaught exception being thrown. |
421 */ | 412 */ |
422 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_FIELD_TYPE_MISM
ATCH | 413 static const CheckedModeCompileTimeErrorCode |
423 = const CheckedModeCompileTimeErrorCode( | 414 CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH = |
| 415 const CheckedModeCompileTimeErrorCode( |
424 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH', | 416 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH', |
425 "The object type '{0}' cannot be assigned to the field '{1}', which ha
s type '{2}'"); | 417 "The object type '{0}' cannot be assigned to the field '{1}', which ha
s type '{2}'"); |
426 | 418 |
427 /** | 419 /** |
428 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 420 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
429 * object results in an uncaught exception being thrown. | 421 * object results in an uncaught exception being thrown. |
430 */ | 422 */ |
431 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_PARAM_TYPE_MISM
ATCH | 423 static const CheckedModeCompileTimeErrorCode |
432 = const CheckedModeCompileTimeErrorCode( | 424 CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH = |
| 425 const CheckedModeCompileTimeErrorCode( |
433 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH', | 426 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH', |
434 "The object type '{0}' cannot be assigned to a parameter of type '{1}'
"); | 427 "The object type '{0}' cannot be assigned to a parameter of type '{1}'
"); |
435 | 428 |
436 /** | 429 /** |
437 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error | 430 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error |
438 * if o is not <b>null</b> and the interface of the class of <i>o</i> is not a | 431 * if o is not <b>null</b> and the interface of the class of <i>o</i> is not a |
439 * subtype of the static type of the field <i>v</i>. | 432 * subtype of the static type of the field <i>v</i>. |
440 * | 433 * |
441 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 434 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
442 * object results in an uncaught exception being thrown. | 435 * object results in an uncaught exception being thrown. |
443 * | 436 * |
444 * @param initializerType the name of the type of the initializer expression | 437 * @param initializerType the name of the type of the initializer expression |
445 * @param fieldType the name of the type of the field | 438 * @param fieldType the name of the type of the field |
446 */ | 439 */ |
447 static const CheckedModeCompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIG
NABLE | 440 static const CheckedModeCompileTimeErrorCode |
448 = const CheckedModeCompileTimeErrorCode( | 441 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = |
| 442 const CheckedModeCompileTimeErrorCode( |
449 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', | 443 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', |
450 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); | 444 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); |
451 | 445 |
452 /** | 446 /** |
453 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> | 447 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> |
454 * ... <i>e<sub>n</sub></i>] is evaluated as follows: | 448 * ... <i>e<sub>n</sub></i>] is evaluated as follows: |
455 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and | 449 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and |
456 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> | 450 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> |
457 * | 451 * |
458 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 452 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
459 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 453 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
460 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 454 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
461 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 455 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
462 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, | 456 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, |
463 * 1 <= j <= m</i>. | 457 * 1 <= j <= m</i>. |
464 */ | 458 */ |
465 static const CheckedModeCompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE | 459 static const CheckedModeCompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE |
466 = const CheckedModeCompileTimeErrorCode( | 460 = |
| 461 const CheckedModeCompileTimeErrorCode( |
467 'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', | 462 'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', |
468 "The element type '{0}' cannot be assigned to the list type '{1}'"); | 463 "The element type '{0}' cannot be assigned to the list type '{1}'"); |
469 | 464 |
470 /** | 465 /** |
471 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 466 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
472 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : | 467 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : |
473 * <i>e<sub>n</sub></i>] is evaluated as follows: | 468 * <i>e<sub>n</sub></i>] is evaluated as follows: |
474 * * The operator []= is invoked on <i>m</i> with first argument | 469 * * The operator []= is invoked on <i>m</i> with first argument |
475 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 470 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
476 * i <= n</i> | 471 * i <= n</i> |
477 * | 472 * |
478 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 473 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
479 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 474 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
480 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 475 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
481 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 476 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
482 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 477 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
483 * <= j <= m</i>. | 478 * <= j <= m</i>. |
484 */ | 479 */ |
485 static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE | 480 static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = |
486 = const CheckedModeCompileTimeErrorCode( | 481 const CheckedModeCompileTimeErrorCode( |
487 'MAP_KEY_TYPE_NOT_ASSIGNABLE', | 482 'MAP_KEY_TYPE_NOT_ASSIGNABLE', |
488 "The element type '{0}' cannot be assigned to the map key type '{1}'")
; | 483 "The element type '{0}' cannot be assigned to the map key type '{1}'")
; |
489 | 484 |
490 /** | 485 /** |
491 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 486 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
492 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : | 487 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : |
493 * <i>e<sub>n</sub></i>] is evaluated as follows: | 488 * <i>e<sub>n</sub></i>] is evaluated as follows: |
494 * * The operator []= is invoked on <i>m</i> with first argument | 489 * * The operator []= is invoked on <i>m</i> with first argument |
495 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 490 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
496 * i <= n</i> | 491 * i <= n</i> |
497 * | 492 * |
498 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 493 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
499 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 494 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
500 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 495 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
501 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 496 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
502 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 497 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
503 * <= j <= m</i>. | 498 * <= j <= m</i>. |
504 */ | 499 */ |
505 static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE | 500 static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = |
506 = const CheckedModeCompileTimeErrorCode( | 501 const CheckedModeCompileTimeErrorCode( |
507 'MAP_VALUE_TYPE_NOT_ASSIGNABLE', | 502 'MAP_VALUE_TYPE_NOT_ASSIGNABLE', |
508 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); | 503 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); |
509 | 504 |
510 /** | 505 /** |
511 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 506 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
512 * object results in an uncaught exception being thrown. | 507 * object results in an uncaught exception being thrown. |
513 */ | 508 */ |
514 static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH | 509 static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH = |
515 = const CheckedModeCompileTimeErrorCode( | 510 const CheckedModeCompileTimeErrorCode( |
516 'VARIABLE_TYPE_MISMATCH', | 511 'VARIABLE_TYPE_MISMATCH', |
517 "The object type '{0}' cannot be assigned to a variable of type '{1}'"
); | 512 "The object type '{0}' cannot be assigned to a variable of type '{1}'"
); |
518 | 513 |
519 /** | 514 /** |
520 * Initialize a newly created error code to have the given [name]. The message | 515 * Initialize a newly created error code to have the given [name]. The message |
521 * associated with the error will be created from the given [message] | 516 * associated with the error will be created from the given [message] |
522 * template. The correction associated with the error will be created from the | 517 * template. The correction associated with the error will be created from the |
523 * given [correction] template. | 518 * given [correction] template. |
524 */ | 519 */ |
525 const CheckedModeCompileTimeErrorCode(String name, String message, [String cor
rection]) | 520 const CheckedModeCompileTimeErrorCode(String name, String message, |
| 521 [String correction]) |
526 : super(name, message, correction); | 522 : super(name, message, correction); |
527 | 523 |
528 @override | 524 @override |
529 ErrorSeverity get errorSeverity => ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR.s
everity; | 525 ErrorSeverity get errorSeverity => |
| 526 ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR.severity; |
530 | 527 |
531 @override | 528 @override |
532 ErrorType get type => ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR; | 529 ErrorType get type => ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR; |
533 } | 530 } |
534 | 531 |
535 /** | 532 /** |
536 * The enumeration `CompileTimeErrorCode` defines the error codes used for | 533 * The enumeration `CompileTimeErrorCode` defines the error codes used for |
537 * compile time errors. The convention for this class is for the name of the | 534 * compile time errors. The convention for this class is for the name of the |
538 * error code to indicate the problem that caused the error to be generated and | 535 * error code to indicate the problem that caused the error to be generated and |
539 * for the error message to explain what is wrong and, when appropriate, how the | 536 * for the error message to explain what is wrong and, when appropriate, how the |
540 * problem can be corrected. | 537 * problem can be corrected. |
541 */ | 538 */ |
542 class CompileTimeErrorCode extends ErrorCode { | 539 class CompileTimeErrorCode extends ErrorCode { |
543 /** | 540 /** |
544 * Enum proposal: It is also a compile-time error to explicitly instantiate an | 541 * Enum proposal: It is also a compile-time error to explicitly instantiate an |
545 * enum via 'new' or 'const' or to access its private fields. | 542 * enum via 'new' or 'const' or to access its private fields. |
546 */ | 543 */ |
547 static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD = const CompileTim
eErrorCode('ACCESS_PRIVATE_ENUM_FIELD', "The private fields of an enum cannot be
accessed, even within the same library"); | 544 static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD = |
| 545 const CompileTimeErrorCode( |
| 546 'ACCESS_PRIVATE_ENUM_FIELD', |
| 547 "The private fields of an enum cannot be accessed, even within the sam
e library"); |
548 | 548 |
549 /** | 549 /** |
550 * 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported | 550 * 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported |
551 * by a library <i>L</i> and <i>N</i> is introduced into the export namespace | 551 * by a library <i>L</i> and <i>N</i> is introduced into the export namespace |
552 * of <i>L</i> by more than one export, unless each all exports refer to same | 552 * of <i>L</i> by more than one export, unless each all exports refer to same |
553 * declaration for the name N. | 553 * declaration for the name N. |
554 * | 554 * |
555 * @param ambiguousElementName the name of the ambiguous element | 555 * @param ambiguousElementName the name of the ambiguous element |
556 * @param firstLibraryName the name of the first library that the type is | 556 * @param firstLibraryName the name of the first library that the type is |
557 * found | 557 * found |
558 * @param secondLibraryName the name of the second library that the type is | 558 * @param secondLibraryName the name of the second library that the type is |
559 * found | 559 * found |
560 */ | 560 */ |
561 static const CompileTimeErrorCode AMBIGUOUS_EXPORT = const CompileTimeErrorCod
e('AMBIGUOUS_EXPORT', "The name '{0}' is defined in the libraries '{1}' and '{2}
'"); | 561 static const CompileTimeErrorCode AMBIGUOUS_EXPORT = |
| 562 const CompileTimeErrorCode( |
| 563 'AMBIGUOUS_EXPORT', |
| 564 "The name '{0}' is defined in the libraries '{1}' and '{2}'"); |
562 | 565 |
563 /** | 566 /** |
564 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does | 567 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does |
565 * not denote a formal parameter. | 568 * not denote a formal parameter. |
566 * | 569 * |
567 * @param the name of the identifier in the argument definition test that is | 570 * @param the name of the identifier in the argument definition test that is |
568 * not a parameter | 571 * not a parameter |
569 */ | 572 */ |
570 static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = con
st CompileTimeErrorCode('ARGUMENT_DEFINITION_TEST_NON_PARAMETER', "'{0}' is not
a parameter"); | 573 static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = |
| 574 const CompileTimeErrorCode( |
| 575 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', |
| 576 "'{0}' is not a parameter"); |
571 | 577 |
572 /** | 578 /** |
573 * ?? Asynchronous For-in: It is a compile-time error if an asynchronous | 579 * ?? Asynchronous For-in: It is a compile-time error if an asynchronous |
574 * for-in statement appears inside a synchronous function. | 580 * for-in statement appears inside a synchronous function. |
575 */ | 581 */ |
576 static const CompileTimeErrorCode ASYNC_FOR_IN_WRONG_CONTEXT = const CompileTi
meErrorCode('ASYNC_FOR_IN_WRONG_CONTEXT', "The asynchronous for-in can only be u
sed in a function marked with async or async*"); | 582 static const CompileTimeErrorCode ASYNC_FOR_IN_WRONG_CONTEXT = |
| 583 const CompileTimeErrorCode( |
| 584 'ASYNC_FOR_IN_WRONG_CONTEXT', |
| 585 "The asynchronous for-in can only be used in a function marked with as
ync or async*"); |
577 | 586 |
578 /** | 587 /** |
579 * ??: It is a compile-time error if the function immediately enclosing a is | 588 * ??: It is a compile-time error if the function immediately enclosing a is |
580 * not declared asynchronous. | 589 * not declared asynchronous. |
581 */ | 590 */ |
582 static const CompileTimeErrorCode AWAIT_IN_WRONG_CONTEXT = const CompileTimeEr
rorCode('AWAIT_IN_WRONG_CONTEXT', "The await expression can only be used in a fu
nction marked as async or async*"); | 591 static const CompileTimeErrorCode AWAIT_IN_WRONG_CONTEXT = |
| 592 const CompileTimeErrorCode( |
| 593 'AWAIT_IN_WRONG_CONTEXT', |
| 594 "The await expression can only be used in a function marked as async o
r async*"); |
583 | 595 |
584 /** | 596 /** |
585 * 12.30 Identifier Reference: It is a compile-time error to use a built-in | 597 * 12.30 Identifier Reference: It is a compile-time error to use a built-in |
586 * identifier other than dynamic as a type annotation. | 598 * identifier other than dynamic as a type annotation. |
587 */ | 599 */ |
588 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = const CompileT
imeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE', "The built-in identifier '{0}' canno
t be as a type"); | 600 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = |
| 601 const CompileTimeErrorCode( |
| 602 'BUILT_IN_IDENTIFIER_AS_TYPE', |
| 603 "The built-in identifier '{0}' cannot be as a type"); |
589 | 604 |
590 /** | 605 /** |
591 * 12.30 Identifier Reference: It is a compile-time error if a built-in | 606 * 12.30 Identifier Reference: It is a compile-time error if a built-in |
592 * identifier is used as the declared name of a class, type parameter or type | 607 * identifier is used as the declared name of a class, type parameter or type |
593 * alias. | 608 * alias. |
594 */ | 609 */ |
595 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = const Com
pileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', "The built-in identifier '
{0}' cannot be used as a type name"); | 610 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = |
| 611 const CompileTimeErrorCode( |
| 612 'BUILT_IN_IDENTIFIER_AS_TYPE_NAME', |
| 613 "The built-in identifier '{0}' cannot be used as a type name"); |
596 | 614 |
597 /** | 615 /** |
598 * 12.30 Identifier Reference: It is a compile-time error if a built-in | 616 * 12.30 Identifier Reference: It is a compile-time error if a built-in |
599 * identifier is used as the declared name of a class, type parameter or type | 617 * identifier is used as the declared name of a class, type parameter or type |
600 * alias. | 618 * alias. |
601 */ | 619 */ |
602 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = const
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', "The built-in identi
fier '{0}' cannot be used as a type alias name"); | 620 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = |
| 621 const CompileTimeErrorCode( |
| 622 'BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', |
| 623 "The built-in identifier '{0}' cannot be used as a type alias name"); |
603 | 624 |
604 /** | 625 /** |
605 * 12.30 Identifier Reference: It is a compile-time error if a built-in | 626 * 12.30 Identifier Reference: It is a compile-time error if a built-in |
606 * identifier is used as the declared name of a class, type parameter or type | 627 * identifier is used as the declared name of a class, type parameter or type |
607 * alias. | 628 * alias. |
608 */ | 629 */ |
609 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME =
const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME', "The b
uilt-in identifier '{0}' cannot be used as a type parameter name"); | 630 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME = |
| 631 const CompileTimeErrorCode( |
| 632 'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME', |
| 633 "The built-in identifier '{0}' cannot be used as a type parameter name
"); |
610 | 634 |
611 /** | 635 /** |
612 * 13.9 Switch: It is a compile-time error if the class <i>C</i> implements | 636 * 13.9 Switch: It is a compile-time error if the class <i>C</i> implements |
613 * the operator <i>==</i>. | 637 * the operator <i>==</i>. |
614 */ | 638 */ |
615 static const CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = con
st CompileTimeErrorCode('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', "The switch ca
se expression type '{0}' cannot override the == operator"); | 639 static const CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = |
| 640 const CompileTimeErrorCode( |
| 641 'CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', |
| 642 "The switch case expression type '{0}' cannot override the == operator
"); |
616 | 643 |
617 /** | 644 /** |
618 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time | 645 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time |
619 * constant would raise | 646 * constant would raise |
620 * an exception. | 647 * an exception. |
621 */ | 648 */ |
622 static const CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = con
st CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', ""); | 649 static const CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = |
| 650 const CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', ""); |
623 | 651 |
624 /** | 652 /** |
625 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 653 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
626 * method with the same name. This restriction holds regardless of whether the | 654 * method with the same name. This restriction holds regardless of whether the |
627 * getter is defined explicitly or implicitly, or whether the getter or the | 655 * getter is defined explicitly or implicitly, or whether the getter or the |
628 * method are inherited or not. | 656 * method are inherited or not. |
629 */ | 657 */ |
630 static const CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD = const Compil
eTimeErrorCode('CONFLICTING_GETTER_AND_METHOD', "Class '{0}' cannot have both ge
tter '{1}.{2}' and method with the same name"); | 658 static const CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD = |
| 659 const CompileTimeErrorCode( |
| 660 'CONFLICTING_GETTER_AND_METHOD', |
| 661 "Class '{0}' cannot have both getter '{1}.{2}' and method with the sam
e name"); |
631 | 662 |
632 /** | 663 /** |
633 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 664 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
634 * method with the same name. This restriction holds regardless of whether the | 665 * method with the same name. This restriction holds regardless of whether the |
635 * getter is defined explicitly or implicitly, or whether the getter or the | 666 * getter is defined explicitly or implicitly, or whether the getter or the |
636 * method are inherited or not. | 667 * method are inherited or not. |
637 */ | 668 */ |
638 static const CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER = const Compil
eTimeErrorCode('CONFLICTING_METHOD_AND_GETTER', "Class '{0}' cannot have both me
thod '{1}.{2}' and getter with the same name"); | 669 static const CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER = |
| 670 const CompileTimeErrorCode( |
| 671 'CONFLICTING_METHOD_AND_GETTER', |
| 672 "Class '{0}' cannot have both method '{1}.{2}' and getter with the sam
e name"); |
639 | 673 |
640 /** | 674 /** |
641 * 7.6 Constructors: A constructor name always begins with the name of its | 675 * 7.6 Constructors: A constructor name always begins with the name of its |
642 * immediately enclosing class, and may optionally be followed by a dot and an | 676 * immediately enclosing class, and may optionally be followed by a dot and an |
643 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name | 677 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name |
644 * of a member declared in the immediately enclosing class. | 678 * of a member declared in the immediately enclosing class. |
645 */ | 679 */ |
646 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = con
st CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', "'{0}' cannot
be used to name a constructor and a field in this class"); | 680 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = |
| 681 const CompileTimeErrorCode( |
| 682 'CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', |
| 683 "'{0}' cannot be used to name a constructor and a field in this class"
); |
647 | 684 |
648 /** | 685 /** |
649 * 7.6 Constructors: A constructor name always begins with the name of its | 686 * 7.6 Constructors: A constructor name always begins with the name of its |
650 * immediately enclosing class, and may optionally be followed by a dot and an | 687 * immediately enclosing class, and may optionally be followed by a dot and an |
651 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name | 688 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name |
652 * of a member declared in the immediately enclosing class. | 689 * of a member declared in the immediately enclosing class. |
653 */ | 690 */ |
654 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = co
nst CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', "'{0}' canno
t be used to name a constructor and a method in this class"); | 691 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = |
| 692 const CompileTimeErrorCode( |
| 693 'CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', |
| 694 "'{0}' cannot be used to name a constructor and a method in this class
"); |
655 | 695 |
656 /** | 696 /** |
657 * 7. Classes: It is a compile time error if a generic class declares a type | 697 * 7. Classes: It is a compile time error if a generic class declares a type |
658 * variable with the same name as the class or any of its members or | 698 * variable with the same name as the class or any of its members or |
659 * constructors. | 699 * constructors. |
660 */ | 700 */ |
661 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS = const
CompileTimeErrorCode('CONFLICTING_TYPE_VARIABLE_AND_CLASS', "'{0}' cannot be use
d to name a type varaible in a class with the same name"); | 701 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS = |
| 702 const CompileTimeErrorCode( |
| 703 'CONFLICTING_TYPE_VARIABLE_AND_CLASS', |
| 704 "'{0}' cannot be used to name a type varaible in a class with the same
name"); |
662 | 705 |
663 /** | 706 /** |
664 * 7. Classes: It is a compile time error if a generic class declares a type | 707 * 7. Classes: It is a compile time error if a generic class declares a type |
665 * variable with the same name as the class or any of its members or | 708 * variable with the same name as the class or any of its members or |
666 * constructors. | 709 * constructors. |
667 */ | 710 */ |
668 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER = const
CompileTimeErrorCode('CONFLICTING_TYPE_VARIABLE_AND_MEMBER', "'{0}' cannot be u
sed to name a type varaible and member in this class"); | 711 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER = |
| 712 const CompileTimeErrorCode( |
| 713 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER', |
| 714 "'{0}' cannot be used to name a type varaible and member in this class
"); |
669 | 715 |
670 /** | 716 /** |
671 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 717 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
672 * object results in an uncaught exception being thrown. | 718 * object results in an uncaught exception being thrown. |
673 */ | 719 */ |
674 static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = const C
ompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION', "'const' constructors
cannot throw exceptions"); | 720 static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = |
| 721 const CompileTimeErrorCode( |
| 722 'CONST_CONSTRUCTOR_THROWS_EXCEPTION', |
| 723 "'const' constructors cannot throw exceptions"); |
675 | 724 |
676 /** | 725 /** |
677 * 10.6.3 Constant Constructors: It is a compile-time error if a constant | 726 * 10.6.3 Constant Constructors: It is a compile-time error if a constant |
678 * constructor is declared by a class C if any instance variable declared in C | 727 * constructor is declared by a class C if any instance variable declared in C |
679 * is initialized with an expression that is not a constant expression. | 728 * is initialized with an expression that is not a constant expression. |
680 */ | 729 */ |
681 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_
NON_CONST = const CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED
_BY_NON_CONST', "Can't define the 'const' constructor because the field '{0}' is
initialized with a non-constant value"); | 730 static const CompileTimeErrorCode |
| 731 CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST = |
| 732 const CompileTimeErrorCode( |
| 733 'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST', |
| 734 "Can't define the 'const' constructor because the field '{0}' is initi
alized with a non-constant value"); |
682 | 735 |
683 /** | 736 /** |
684 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly | 737 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly |
685 * or implicitly, in the initializer list of a constant constructor must | 738 * or implicitly, in the initializer list of a constant constructor must |
686 * specify a constant constructor of the superclass of the immediately | 739 * specify a constant constructor of the superclass of the immediately |
687 * enclosing class or a compile-time error occurs. | 740 * enclosing class or a compile-time error occurs. |
688 * | 741 * |
689 * 9 Mixins: For each generative constructor named ... an implicitly declared | 742 * 9 Mixins: For each generative constructor named ... an implicitly declared |
690 * constructor named ... is declared. | 743 * constructor named ... is declared. |
691 */ | 744 */ |
692 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN = const Compile
TimeErrorCode('CONST_CONSTRUCTOR_WITH_MIXIN', "Constant constructor cannot be de
clared for a class with a mixin"); | 745 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN = |
| 746 const CompileTimeErrorCode( |
| 747 'CONST_CONSTRUCTOR_WITH_MIXIN', |
| 748 "Constant constructor cannot be declared for a class with a mixin"); |
693 | 749 |
694 /** | 750 /** |
695 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly | 751 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly |
696 * or implicitly, in the initializer list of a constant constructor must | 752 * or implicitly, in the initializer list of a constant constructor must |
697 * specify a constant constructor of the superclass of the immediately | 753 * specify a constant constructor of the superclass of the immediately |
698 * enclosing class or a compile-time error occurs. | 754 * enclosing class or a compile-time error occurs. |
699 */ | 755 */ |
700 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER = con
st CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER', "Constant cons
tructor cannot call non-constant super constructor of '{0}'"); | 756 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER = |
| 757 const CompileTimeErrorCode( |
| 758 'CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER', |
| 759 "Constant constructor cannot call non-constant super constructor of '{
0}'"); |
701 | 760 |
702 /** | 761 /** |
703 * 7.6.3 Constant Constructors: It is a compile-time error if a constant | 762 * 7.6.3 Constant Constructors: It is a compile-time error if a constant |
704 * constructor is declared by a class that has a non-final instance variable. | 763 * constructor is declared by a class that has a non-final instance variable. |
705 * | 764 * |
706 * The above refers to both locally declared and inherited instance variables. | 765 * The above refers to both locally declared and inherited instance variables. |
707 */ | 766 */ |
708 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = con
st CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', "Cannot define
the 'const' constructor for a class with non-final fields"); | 767 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = |
| 768 const CompileTimeErrorCode( |
| 769 'CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', |
| 770 "Cannot define the 'const' constructor for a class with non-final fiel
ds"); |
709 | 771 |
710 /** | 772 /** |
711 * 12.12.2 Const: It is a compile-time error if <i>T</i> is a deferred type. | 773 * 12.12.2 Const: It is a compile-time error if <i>T</i> is a deferred type. |
712 */ | 774 */ |
713 static const CompileTimeErrorCode CONST_DEFERRED_CLASS = const CompileTimeErro
rCode('CONST_DEFERRED_CLASS', "Deferred classes cannot be created with 'const'")
; | 775 static const CompileTimeErrorCode CONST_DEFERRED_CLASS = |
| 776 const CompileTimeErrorCode( |
| 777 'CONST_DEFERRED_CLASS', |
| 778 "Deferred classes cannot be created with 'const'"); |
714 | 779 |
715 /** | 780 /** |
716 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is | 781 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is |
717 * declared as a constant variable. | 782 * declared as a constant variable. |
718 */ | 783 */ |
719 static const CompileTimeErrorCode CONST_FORMAL_PARAMETER = const CompileTimeEr
rorCode('CONST_FORMAL_PARAMETER', "Parameters cannot be 'const'"); | 784 static const CompileTimeErrorCode CONST_FORMAL_PARAMETER = |
| 785 const CompileTimeErrorCode( |
| 786 'CONST_FORMAL_PARAMETER', |
| 787 "Parameters cannot be 'const'"); |
720 | 788 |
721 /** | 789 /** |
722 * 5 Variables: A constant variable must be initialized to a compile-time | 790 * 5 Variables: A constant variable must be initialized to a compile-time |
723 * constant or a compile-time error occurs. | 791 * constant or a compile-time error occurs. |
724 */ | 792 */ |
725 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE =
const CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', "'const'
variables must be constant value"); | 793 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = |
| 794 const CompileTimeErrorCode( |
| 795 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', |
| 796 "'const' variables must be constant value"); |
726 | 797 |
727 /** | 798 /** |
728 * 5 Variables: A constant variable must be initialized to a compile-time | 799 * 5 Variables: A constant variable must be initialized to a compile-time |
729 * constant or a compile-time error occurs. | 800 * constant or a compile-time error occurs. |
730 * | 801 * |
731 * 12.1 Constants: A qualified reference to a static constant variable that is | 802 * 12.1 Constants: A qualified reference to a static constant variable that is |
732 * not qualified by a deferred prefix. | 803 * not qualified by a deferred prefix. |
733 */ | 804 */ |
734 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FR
OM_DEFERRED_LIBRARY = const CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CON
STANT_VALUE_FROM_DEFERRED_LIBRARY', "Constant values from a deferred library can
not be used to initialized a 'const' variable"); | 805 static const CompileTimeErrorCode |
| 806 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY = |
| 807 const CompileTimeErrorCode( |
| 808 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', |
| 809 "Constant values from a deferred library cannot be used to initialized
a 'const' variable"); |
735 | 810 |
736 /** | 811 /** |
737 * 7.5 Instance Variables: It is a compile-time error if an instance variable | 812 * 7.5 Instance Variables: It is a compile-time error if an instance variable |
738 * is declared to be constant. | 813 * is declared to be constant. |
739 */ | 814 */ |
740 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = const CompileTimeErro
rCode('CONST_INSTANCE_FIELD', "Only static fields can be declared as 'const'"); | 815 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = |
| 816 const CompileTimeErrorCode( |
| 817 'CONST_INSTANCE_FIELD', |
| 818 "Only static fields can be declared as 'const'"); |
741 | 819 |
742 /** | 820 /** |
743 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant | 821 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant |
744 * map literal is an instance of a class that implements the operator | 822 * map literal is an instance of a class that implements the operator |
745 * <i>==</i> unless the key is a string or integer. | 823 * <i>==</i> unless the key is a string or integer. |
746 */ | 824 */ |
747 static const CompileTimeErrorCode CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQU
ALS = const CompileTimeErrorCode('CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUAL
S', "The constant map entry key expression type '{0}' cannot override the == ope
rator"); | 825 static const CompileTimeErrorCode |
| 826 CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = |
| 827 const CompileTimeErrorCode( |
| 828 'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', |
| 829 "The constant map entry key expression type '{0}' cannot override the
== operator"); |
748 | 830 |
749 /** | 831 /** |
750 * 5 Variables: A constant variable must be initialized to a compile-time | 832 * 5 Variables: A constant variable must be initialized to a compile-time |
751 * constant (12.1) or a compile-time error occurs. | 833 * constant (12.1) or a compile-time error occurs. |
752 * | 834 * |
753 * @param name the name of the uninitialized final variable | 835 * @param name the name of the uninitialized final variable |
754 */ | 836 */ |
755 static const CompileTimeErrorCode CONST_NOT_INITIALIZED = const CompileTimeErr
orCode('CONST_NOT_INITIALIZED', "The const variable '{0}' must be initialized"); | 837 static const CompileTimeErrorCode CONST_NOT_INITIALIZED = |
| 838 const CompileTimeErrorCode( |
| 839 'CONST_NOT_INITIALIZED', |
| 840 "The const variable '{0}' must be initialized"); |
756 | 841 |
757 /** | 842 /** |
758 * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2, | 843 * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2, |
759 * where e, e1 and e2 are constant expressions that evaluate to a boolean | 844 * where e, e1 and e2 are constant expressions that evaluate to a boolean |
760 * value. | 845 * value. |
761 */ | 846 */ |
762 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = const CompileTimeErro
rCode('CONST_EVAL_TYPE_BOOL', "An expression of type 'bool' was expected"); | 847 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = |
| 848 const CompileTimeErrorCode( |
| 849 'CONST_EVAL_TYPE_BOOL', |
| 850 "An expression of type 'bool' was expected"); |
763 | 851 |
764 /** | 852 /** |
765 * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where | 853 * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where |
766 * e1 and e2 are constant expressions that evaluate to a numeric, string or | 854 * e1 and e2 are constant expressions that evaluate to a numeric, string or |
767 * boolean value or to null. | 855 * boolean value or to null. |
768 */ | 856 */ |
769 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = const Comp
ileTimeErrorCode('CONST_EVAL_TYPE_BOOL_NUM_STRING', "An expression of type 'bool
', 'num', 'String' or 'null' was expected"); | 857 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = |
| 858 const CompileTimeErrorCode( |
| 859 'CONST_EVAL_TYPE_BOOL_NUM_STRING', |
| 860 "An expression of type 'bool', 'num', 'String' or 'null' was expected"
); |
770 | 861 |
771 /** | 862 /** |
772 * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, | 863 * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, |
773 * e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions | 864 * e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions |
774 * that evaluate to an integer value or to null. | 865 * that evaluate to an integer value or to null. |
775 */ | 866 */ |
776 static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = const CompileTimeError
Code('CONST_EVAL_TYPE_INT', "An expression of type 'int' was expected"); | 867 static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = |
| 868 const CompileTimeErrorCode( |
| 869 'CONST_EVAL_TYPE_INT', |
| 870 "An expression of type 'int' was expected"); |
777 | 871 |
778 /** | 872 /** |
779 * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 * | 873 * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 * |
780 * e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, | 874 * e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, |
781 * where e, e1 and e2 are constant expressions that evaluate to a numeric | 875 * where e, e1 and e2 are constant expressions that evaluate to a numeric |
782 * value or to null. | 876 * value or to null. |
783 */ | 877 */ |
784 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = const CompileTimeError
Code('CONST_EVAL_TYPE_NUM', "An expression of type 'num' was expected"); | 878 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = |
| 879 const CompileTimeErrorCode( |
| 880 'CONST_EVAL_TYPE_NUM', |
| 881 "An expression of type 'num' was expected"); |
785 | 882 |
786 /** | 883 /** |
787 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 884 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
788 * object results in an uncaught exception being thrown. | 885 * object results in an uncaught exception being thrown. |
789 */ | 886 */ |
790 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = const CompileT
imeErrorCode('CONST_EVAL_THROWS_EXCEPTION', "Evaluation of this constant express
ion causes exception"); | 887 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = |
| 888 const CompileTimeErrorCode( |
| 889 'CONST_EVAL_THROWS_EXCEPTION', |
| 890 "Evaluation of this constant expression causes exception"); |
791 | 891 |
792 /** | 892 /** |
793 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 893 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
794 * object results in an uncaught exception being thrown. | 894 * object results in an uncaught exception being thrown. |
795 */ | 895 */ |
796 static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = const CompileTimeE
rrorCode('CONST_EVAL_THROWS_IDBZE', "Evaluation of this constant expression thro
ws IntegerDivisionByZeroException"); | 896 static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = |
| 897 const CompileTimeErrorCode( |
| 898 'CONST_EVAL_THROWS_IDBZE', |
| 899 "Evaluation of this constant expression throws IntegerDivisionByZeroEx
ception"); |
797 | 900 |
798 /** | 901 /** |
799 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, | 902 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, |
800 * …, U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time | 903 * …, U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time |
801 * error if <i>S</i> is not a generic type with <i>m</i> type parameters. | 904 * error if <i>S</i> is not a generic type with <i>m</i> type parameters. |
802 * | 905 * |
803 * @param typeName the name of the type being referenced (<i>S</i>) | 906 * @param typeName the name of the type being referenced (<i>S</i>) |
804 * @param parameterCount the number of type parameters that were declared | 907 * @param parameterCount the number of type parameters that were declared |
805 * @param argumentCount the number of type arguments provided | 908 * @param argumentCount the number of type arguments provided |
806 * See [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS], and | 909 * See [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS], and |
807 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. | 910 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. |
808 */ | 911 */ |
809 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = const C
ompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', "The type '{0}' is dec
lared with {1} type parameters, but {2} type arguments were given"); | 912 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = |
| 913 const CompileTimeErrorCode( |
| 914 'CONST_WITH_INVALID_TYPE_PARAMETERS', |
| 915 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); |
810 | 916 |
811 /** | 917 /** |
812 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, | 918 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, |
813 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, | 919 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, |
814 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if the | 920 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if the |
815 * type <i>T</i> does not declare a constant constructor with the same name as | 921 * type <i>T</i> does not declare a constant constructor with the same name as |
816 * the declaration of <i>T</i>. | 922 * the declaration of <i>T</i>. |
817 */ | 923 */ |
818 static const CompileTimeErrorCode CONST_WITH_NON_CONST = const CompileTimeErro
rCode('CONST_WITH_NON_CONST', "The constructor being called is not a 'const' con
structor"); | 924 static const CompileTimeErrorCode CONST_WITH_NON_CONST = |
| 925 const CompileTimeErrorCode( |
| 926 'CONST_WITH_NON_CONST', |
| 927 "The constructor being called is not a 'const' constructor"); |
819 | 928 |
820 /** | 929 /** |
821 * 12.11.2 Const: In all of the above cases, it is a compile-time error if | 930 * 12.11.2 Const: In all of the above cases, it is a compile-time error if |
822 * <i>a<sub>i</sub>, 1 <= i <= n + k</i>, is not a compile-time constant | 931 * <i>a<sub>i</sub>, 1 <= i <= n + k</i>, is not a compile-time constant |
823 * expression. | 932 * expression. |
824 */ | 933 */ |
825 static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = const Com
pileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', "Arguments of a constant c
reation must be constant expressions"); | 934 static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = |
| 935 const CompileTimeErrorCode( |
| 936 'CONST_WITH_NON_CONSTANT_ARGUMENT', |
| 937 "Arguments of a constant creation must be constant expressions"); |
826 | 938 |
827 /** | 939 /** |
828 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class | 940 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class |
829 * accessible in the current scope, optionally followed by type arguments. | 941 * accessible in the current scope, optionally followed by type arguments. |
830 * | 942 * |
831 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, | 943 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, |
832 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, … | 944 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, … |
833 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if | 945 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if |
834 * <i>T</i> is not a class accessible in the current scope, optionally | 946 * <i>T</i> is not a class accessible in the current scope, optionally |
835 * followed by type arguments. | 947 * followed by type arguments. |
836 * | 948 * |
837 * @param name the name of the non-type element | 949 * @param name the name of the non-type element |
838 */ | 950 */ |
839 static const CompileTimeErrorCode CONST_WITH_NON_TYPE = const CompileTimeError
Code('CONST_WITH_NON_TYPE', "The name '{0}' is not a class"); | 951 static const CompileTimeErrorCode CONST_WITH_NON_TYPE = |
| 952 const CompileTimeErrorCode( |
| 953 'CONST_WITH_NON_TYPE', |
| 954 "The name '{0}' is not a class"); |
840 | 955 |
841 /** | 956 /** |
842 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type | 957 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type |
843 * parameters. | 958 * parameters. |
844 */ | 959 */ |
845 static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = const CompileTi
meErrorCode('CONST_WITH_TYPE_PARAMETERS', "The constant creation cannot use a ty
pe parameter"); | 960 static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = |
| 961 const CompileTimeErrorCode( |
| 962 'CONST_WITH_TYPE_PARAMETERS', |
| 963 "The constant creation cannot use a type parameter"); |
846 | 964 |
847 /** | 965 /** |
848 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of | 966 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of |
849 * a constant constructor declared by the type <i>T</i>. | 967 * a constant constructor declared by the type <i>T</i>. |
850 * | 968 * |
851 * @param typeName the name of the type | 969 * @param typeName the name of the type |
852 * @param constructorName the name of the requested constant constructor | 970 * @param constructorName the name of the requested constant constructor |
853 */ | 971 */ |
854 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = const Com
pileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', "The class '{0}' does not
have a constant constructor '{1}'"); | 972 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = |
| 973 const CompileTimeErrorCode( |
| 974 'CONST_WITH_UNDEFINED_CONSTRUCTOR', |
| 975 "The class '{0}' does not have a constant constructor '{1}'"); |
855 | 976 |
856 /** | 977 /** |
857 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of | 978 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of |
858 * a constant constructor declared by the type <i>T</i>. | 979 * a constant constructor declared by the type <i>T</i>. |
859 * | 980 * |
860 * @param typeName the name of the type | 981 * @param typeName the name of the type |
861 */ | 982 */ |
862 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = c
onst CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', "The class
'{0}' does not have a default constant constructor"); | 983 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = |
| 984 const CompileTimeErrorCode( |
| 985 'CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', |
| 986 "The class '{0}' does not have a default constant constructor"); |
863 | 987 |
864 /** | 988 /** |
865 * 15.3.1 Typedef: It is a compile-time error if any default values are | 989 * 15.3.1 Typedef: It is a compile-time error if any default values are |
866 * specified in the signature of a function type alias. | 990 * specified in the signature of a function type alias. |
867 */ | 991 */ |
868 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = const
CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', "Default values ar
en't allowed in typedefs"); | 992 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = |
| 993 const CompileTimeErrorCode( |
| 994 'DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', |
| 995 "Default values aren't allowed in typedefs"); |
869 | 996 |
870 /** | 997 /** |
871 * 6.2.1 Required Formals: By means of a function signature that names the | 998 * 6.2.1 Required Formals: By means of a function signature that names the |
872 * parameter and describes its type as a function type. It is a compile-time | 999 * parameter and describes its type as a function type. It is a compile-time |
873 * error if any default values are specified in the signature of such a | 1000 * error if any default values are specified in the signature of such a |
874 * function type. | 1001 * function type. |
875 */ | 1002 */ |
876 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER =
const CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', "Default
values aren't allowed in function type parameters"); | 1003 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = |
| 1004 const CompileTimeErrorCode( |
| 1005 'DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', |
| 1006 "Default values aren't allowed in function type parameters"); |
877 | 1007 |
878 /** | 1008 /** |
879 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly | 1009 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly |
880 * specifies a default value for an optional parameter. | 1010 * specifies a default value for an optional parameter. |
881 */ | 1011 */ |
882 static const CompileTimeErrorCode DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRU
CTOR = const CompileTimeErrorCode('DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUC
TOR', "Default values aren't allowed in factory constructors that redirect to an
other constructor"); | 1012 static const CompileTimeErrorCode |
| 1013 DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR = |
| 1014 const CompileTimeErrorCode( |
| 1015 'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR', |
| 1016 "Default values aren't allowed in factory constructors that redirect t
o another constructor"); |
883 | 1017 |
884 /** | 1018 /** |
885 * 3.1 Scoping: It is a compile-time error if there is more than one entity | 1019 * 3.1 Scoping: It is a compile-time error if there is more than one entity |
886 * with the same name declared in the same scope. | 1020 * with the same name declared in the same scope. |
887 */ | 1021 */ |
888 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = const Compil
eTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT', "The default constructor is alre
ady defined"); | 1022 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = |
| 1023 const CompileTimeErrorCode( |
| 1024 'DUPLICATE_CONSTRUCTOR_DEFAULT', |
| 1025 "The default constructor is already defined"); |
889 | 1026 |
890 /** | 1027 /** |
891 * 3.1 Scoping: It is a compile-time error if there is more than one entity | 1028 * 3.1 Scoping: It is a compile-time error if there is more than one entity |
892 * with the same name declared in the same scope. | 1029 * with the same name declared in the same scope. |
893 * | 1030 * |
894 * @param duplicateName the name of the duplicate entity | 1031 * @param duplicateName the name of the duplicate entity |
895 */ | 1032 */ |
896 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = const CompileTi
meErrorCode('DUPLICATE_CONSTRUCTOR_NAME', "The constructor with name '{0}' is al
ready defined"); | 1033 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = |
| 1034 const CompileTimeErrorCode( |
| 1035 'DUPLICATE_CONSTRUCTOR_NAME', |
| 1036 "The constructor with name '{0}' is already defined"); |
897 | 1037 |
898 /** | 1038 /** |
899 * 3.1 Scoping: It is a compile-time error if there is more than one entity | 1039 * 3.1 Scoping: It is a compile-time error if there is more than one entity |
900 * with the same name declared in the same scope. | 1040 * with the same name declared in the same scope. |
901 * | 1041 * |
902 * 7 Classes: It is a compile-time error if a class declares two members of | 1042 * 7 Classes: It is a compile-time error if a class declares two members of |
903 * the same name. | 1043 * the same name. |
904 * | 1044 * |
905 * 7 Classes: It is a compile-time error if a class has an instance member and | 1045 * 7 Classes: It is a compile-time error if a class has an instance member and |
906 * a static member with the same name. | 1046 * a static member with the same name. |
907 * | 1047 * |
908 * @param duplicateName the name of the duplicate entity | 1048 * @param duplicateName the name of the duplicate entity |
909 */ | 1049 */ |
910 static const CompileTimeErrorCode DUPLICATE_DEFINITION = const CompileTimeErro
rCode('DUPLICATE_DEFINITION', "The name '{0}' is already defined"); | 1050 static const CompileTimeErrorCode DUPLICATE_DEFINITION = |
| 1051 const CompileTimeErrorCode( |
| 1052 'DUPLICATE_DEFINITION', |
| 1053 "The name '{0}' is already defined"); |
911 | 1054 |
912 /** | 1055 /** |
913 * 7. Classes: It is a compile-time error if a class has an instance member | 1056 * 7. Classes: It is a compile-time error if a class has an instance member |
914 * and a static member with the same name. | 1057 * and a static member with the same name. |
915 * | 1058 * |
916 * This covers the additional duplicate definition cases where inheritance has | 1059 * This covers the additional duplicate definition cases where inheritance has |
917 * to be considered. | 1060 * to be considered. |
918 * | 1061 * |
919 * @param className the name of the class that has conflicting instance/static | 1062 * @param className the name of the class that has conflicting instance/static |
920 * members | 1063 * members |
921 * @param name the name of the conflicting members | 1064 * @param name the name of the conflicting members |
922 * See [DUPLICATE_DEFINITION]. | 1065 * See [DUPLICATE_DEFINITION]. |
923 */ | 1066 */ |
924 static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = const Com
pileTimeErrorCode('DUPLICATE_DEFINITION_INHERITANCE', "The name '{0}' is already
defined in '{1}'"); | 1067 static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = |
| 1068 const CompileTimeErrorCode( |
| 1069 'DUPLICATE_DEFINITION_INHERITANCE', |
| 1070 "The name '{0}' is already defined in '{1}'"); |
925 | 1071 |
926 /** | 1072 /** |
927 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if | 1073 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if |
928 * <i>q<sub>i</sub> = q<sub>j</sub></i> for any <i>i != j</i> [where | 1074 * <i>q<sub>i</sub> = q<sub>j</sub></i> for any <i>i != j</i> [where |
929 * <i>q<sub>i</sub></i> is the label for a named argument]. | 1075 * <i>q<sub>i</sub></i> is the label for a named argument]. |
930 */ | 1076 */ |
931 static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = const CompileTime
ErrorCode('DUPLICATE_NAMED_ARGUMENT', "The argument for the named parameter '{0}
' was already specified"); | 1077 static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = |
| 1078 const CompileTimeErrorCode( |
| 1079 'DUPLICATE_NAMED_ARGUMENT', |
| 1080 "The argument for the named parameter '{0}' was already specified"); |
932 | 1081 |
933 /** | 1082 /** |
934 * SDK implementation libraries can be exported only by other SDK libraries. | 1083 * SDK implementation libraries can be exported only by other SDK libraries. |
935 * | 1084 * |
936 * @param uri the uri pointing to a library | 1085 * @param uri the uri pointing to a library |
937 */ | 1086 */ |
938 static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = const CompileTimeE
rrorCode('EXPORT_INTERNAL_LIBRARY', "The library '{0}' is internal and cannot be
exported"); | 1087 static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = |
| 1088 const CompileTimeErrorCode( |
| 1089 'EXPORT_INTERNAL_LIBRARY', |
| 1090 "The library '{0}' is internal and cannot be exported"); |
939 | 1091 |
940 /** | 1092 /** |
941 * 14.2 Exports: It is a compile-time error if the compilation unit found at | 1093 * 14.2 Exports: It is a compile-time error if the compilation unit found at |
942 * the specified URI is not a library declaration. | 1094 * the specified URI is not a library declaration. |
943 * | 1095 * |
944 * @param uri the uri pointing to a non-library declaration | 1096 * @param uri the uri pointing to a non-library declaration |
945 */ | 1097 */ |
946 static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = const CompileTimeErr
orCode('EXPORT_OF_NON_LIBRARY', "The exported library '{0}' must not have a part
-of directive"); | 1098 static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = |
| 1099 const CompileTimeErrorCode( |
| 1100 'EXPORT_OF_NON_LIBRARY', |
| 1101 "The exported library '{0}' must not have a part-of directive"); |
947 | 1102 |
948 /** | 1103 /** |
949 * Enum proposal: It is a compile-time error to subclass, mix-in or implement | 1104 * Enum proposal: It is a compile-time error to subclass, mix-in or implement |
950 * an enum. | 1105 * an enum. |
951 */ | 1106 */ |
952 static const CompileTimeErrorCode EXTENDS_ENUM = const CompileTimeErrorCode('E
XTENDS_ENUM', "Classes cannot extend an enum"); | 1107 static const CompileTimeErrorCode EXTENDS_ENUM = |
| 1108 const CompileTimeErrorCode('EXTENDS_ENUM', "Classes cannot extend an enum"
); |
953 | 1109 |
954 /** | 1110 /** |
955 * 7.9 Superclasses: It is a compile-time error if the extends clause of a | 1111 * 7.9 Superclasses: It is a compile-time error if the extends clause of a |
956 * class <i>C</i> includes a type expression that does not denote a class | 1112 * class <i>C</i> includes a type expression that does not denote a class |
957 * available in the lexical scope of <i>C</i>. | 1113 * available in the lexical scope of <i>C</i>. |
958 * | 1114 * |
959 * @param typeName the name of the superclass that was not found | 1115 * @param typeName the name of the superclass that was not found |
960 */ | 1116 */ |
961 static const CompileTimeErrorCode EXTENDS_NON_CLASS = const CompileTimeErrorCo
de('EXTENDS_NON_CLASS', "Classes can only extend other classes"); | 1117 static const CompileTimeErrorCode EXTENDS_NON_CLASS = |
| 1118 const CompileTimeErrorCode( |
| 1119 'EXTENDS_NON_CLASS', |
| 1120 "Classes can only extend other classes"); |
962 | 1121 |
963 /** | 1122 /** |
964 * 12.2 Null: It is a compile-time error for a class to attempt to extend or | 1123 * 12.2 Null: It is a compile-time error for a class to attempt to extend or |
965 * implement Null. | 1124 * implement Null. |
966 * | 1125 * |
967 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1126 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
968 * or implement int. | 1127 * or implement int. |
969 * | 1128 * |
970 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1129 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
971 * or implement double. | 1130 * or implement double. |
972 * | 1131 * |
973 * 12.3 Numbers: It is a compile-time error for any type other than the types | 1132 * 12.3 Numbers: It is a compile-time error for any type other than the types |
974 * int and double to | 1133 * int and double to |
975 * attempt to extend or implement num. | 1134 * attempt to extend or implement num. |
976 * | 1135 * |
977 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend | 1136 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend |
978 * or implement bool. | 1137 * or implement bool. |
979 * | 1138 * |
980 * 12.5 Strings: It is a compile-time error for a class to attempt to extend | 1139 * 12.5 Strings: It is a compile-time error for a class to attempt to extend |
981 * or implement String. | 1140 * or implement String. |
982 * | 1141 * |
983 * @param typeName the name of the type that cannot be extended | 1142 * @param typeName the name of the type that cannot be extended |
984 * See [IMPLEMENTS_DISALLOWED_CLASS]. | 1143 * See [IMPLEMENTS_DISALLOWED_CLASS]. |
985 */ | 1144 */ |
986 static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = const CompileTime
ErrorCode('EXTENDS_DISALLOWED_CLASS', "Classes cannot extend '{0}'"); | 1145 static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = |
| 1146 const CompileTimeErrorCode( |
| 1147 'EXTENDS_DISALLOWED_CLASS', |
| 1148 "Classes cannot extend '{0}'"); |
987 | 1149 |
988 /** | 1150 /** |
989 * 7.9 Superclasses: It is a compile-time error if the extends clause of a | 1151 * 7.9 Superclasses: It is a compile-time error if the extends clause of a |
990 * class <i>C</i> includes a deferred type expression. | 1152 * class <i>C</i> includes a deferred type expression. |
991 * | 1153 * |
992 * @param typeName the name of the type that cannot be extended | 1154 * @param typeName the name of the type that cannot be extended |
993 * See [IMPLEMENTS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. | 1155 * See [IMPLEMENTS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. |
994 */ | 1156 */ |
995 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = const CompileTimeEr
rorCode('EXTENDS_DEFERRED_CLASS', "This class cannot extend the deferred class '
{0}'"); | 1157 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = |
| 1158 const CompileTimeErrorCode( |
| 1159 'EXTENDS_DEFERRED_CLASS', |
| 1160 "This class cannot extend the deferred class '{0}'"); |
996 | 1161 |
997 /** | 1162 /** |
998 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < | 1163 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < |
999 * h</i> or if <i>m > n</i>. | 1164 * h</i> or if <i>m > n</i>. |
1000 * | 1165 * |
1001 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 1166 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
1002 * object results in an uncaught exception being thrown. | 1167 * object results in an uncaught exception being thrown. |
1003 * | 1168 * |
1004 * @param requiredCount the maximum number of positional arguments | 1169 * @param requiredCount the maximum number of positional arguments |
1005 * @param argumentCount the actual number of positional arguments given | 1170 * @param argumentCount the actual number of positional arguments given |
1006 */ | 1171 */ |
1007 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = const CompileTi
meErrorCode('EXTRA_POSITIONAL_ARGUMENTS', "{0} positional arguments expected, bu
t {1} found"); | 1172 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = |
| 1173 const CompileTimeErrorCode( |
| 1174 'EXTRA_POSITIONAL_ARGUMENTS', |
| 1175 "{0} positional arguments expected, but {1} found"); |
1008 | 1176 |
1009 /** | 1177 /** |
1010 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1178 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1011 * is a compile time error if more than one initializer corresponding to a | 1179 * is a compile time error if more than one initializer corresponding to a |
1012 * given instance variable appears in <i>k</i>'s list. | 1180 * given instance variable appears in <i>k</i>'s list. |
1013 */ | 1181 */ |
1014 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS =
const CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', "The f
ield '{0}' cannot be initialized twice in the same constructor"); | 1182 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = |
| 1183 const CompileTimeErrorCode( |
| 1184 'FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', |
| 1185 "The field '{0}' cannot be initialized twice in the same constructor")
; |
1015 | 1186 |
1016 /** | 1187 /** |
1017 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1188 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1018 * is a compile time error if <i>k</i>'s initializer list contains an | 1189 * is a compile time error if <i>k</i>'s initializer list contains an |
1019 * initializer for a variable that is initialized by means of an initializing | 1190 * initializer for a variable that is initialized by means of an initializing |
1020 * formal of <i>k</i>. | 1191 * formal of <i>k</i>. |
1021 */ | 1192 */ |
1022 static const CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZ
ER = const CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER'
, "Fields cannot be initialized in both the parameter list and the initializers"
); | 1193 static const CompileTimeErrorCode |
| 1194 FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = |
| 1195 const CompileTimeErrorCode( |
| 1196 'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', |
| 1197 "Fields cannot be initialized in both the parameter list and the initi
alizers"); |
1023 | 1198 |
1024 /** | 1199 /** |
1025 * 5 Variables: It is a compile-time error if a final instance variable that | 1200 * 5 Variables: It is a compile-time error if a final instance variable that |
1026 * has is initialized by means of an initializing formal of a constructor is | 1201 * has is initialized by means of an initializing formal of a constructor is |
1027 * also initialized elsewhere in the same constructor. | 1202 * also initialized elsewhere in the same constructor. |
1028 * | 1203 * |
1029 * @param name the name of the field in question | 1204 * @param name the name of the field in question |
1030 */ | 1205 */ |
1031 static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = const Com
pileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', "'{0}' is a final field an
d so can only be set once"); | 1206 static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = |
| 1207 const CompileTimeErrorCode( |
| 1208 'FINAL_INITIALIZED_MULTIPLE_TIMES', |
| 1209 "'{0}' is a final field and so can only be set once"); |
1032 | 1210 |
1033 /** | 1211 /** |
1034 * 7.6.1 Generative Constructors: It is a compile-time error if an | 1212 * 7.6.1 Generative Constructors: It is a compile-time error if an |
1035 * initializing formal is used by a function other than a non-redirecting | 1213 * initializing formal is used by a function other than a non-redirecting |
1036 * generative constructor. | 1214 * generative constructor. |
1037 */ | 1215 */ |
1038 static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = cons
t CompileTimeErrorCode('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', "Initializing fo
rmal fields cannot be used in factory constructors"); | 1216 static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = |
| 1217 const CompileTimeErrorCode( |
| 1218 'FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', |
| 1219 "Initializing formal fields cannot be used in factory constructors"); |
1039 | 1220 |
1040 /** | 1221 /** |
1041 * 7.6.1 Generative Constructors: It is a compile-time error if an | 1222 * 7.6.1 Generative Constructors: It is a compile-time error if an |
1042 * initializing formal is used by a function other than a non-redirecting | 1223 * initializing formal is used by a function other than a non-redirecting |
1043 * generative constructor. | 1224 * generative constructor. |
1044 */ | 1225 */ |
1045 static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = cons
t CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', "Initializing fo
rmal fields can only be used in constructors"); | 1226 static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = |
| 1227 const CompileTimeErrorCode( |
| 1228 'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', |
| 1229 "Initializing formal fields can only be used in constructors"); |
1046 | 1230 |
1047 /** | 1231 /** |
1048 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 1232 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
1049 * in which case its only action is to invoke another generative constructor. | 1233 * in which case its only action is to invoke another generative constructor. |
1050 * | 1234 * |
1051 * 7.6.1 Generative Constructors: It is a compile-time error if an | 1235 * 7.6.1 Generative Constructors: It is a compile-time error if an |
1052 * initializing formal is used by a function other than a non-redirecting | 1236 * initializing formal is used by a function other than a non-redirecting |
1053 * generative constructor. | 1237 * generative constructor. |
1054 */ | 1238 */ |
1055 static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR =
const CompileTimeErrorCode('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', "The red
irecting constructor cannot have a field initializer"); | 1239 static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = |
| 1240 const CompileTimeErrorCode( |
| 1241 'FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', |
| 1242 "The redirecting constructor cannot have a field initializer"); |
1056 | 1243 |
1057 /** | 1244 /** |
1058 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 1245 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
1059 * method with the same name. | 1246 * method with the same name. |
1060 * | 1247 * |
1061 * @param name the conflicting name of the getter and method | 1248 * @param name the conflicting name of the getter and method |
1062 */ | 1249 */ |
1063 static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = const Com
pileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', "'{0}' cannot be used to n
ame a getter, there is already a method with the same name"); | 1250 static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = |
| 1251 const CompileTimeErrorCode( |
| 1252 'GETTER_AND_METHOD_WITH_SAME_NAME', |
| 1253 "'{0}' cannot be used to name a getter, there is already a method with
the same name"); |
1064 | 1254 |
1065 /** | 1255 /** |
1066 * 7.10 Superinterfaces: It is a compile-time error if the implements clause | 1256 * 7.10 Superinterfaces: It is a compile-time error if the implements clause |
1067 * of a class <i>C</i> specifies a malformed type or deferred type as a | 1257 * of a class <i>C</i> specifies a malformed type or deferred type as a |
1068 * superinterface. | 1258 * superinterface. |
1069 * | 1259 * |
1070 * @param typeName the name of the type that cannot be extended | 1260 * @param typeName the name of the type that cannot be extended |
1071 * See [EXTENDS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. | 1261 * See [EXTENDS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. |
1072 */ | 1262 */ |
1073 static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS = const CompileTim
eErrorCode('IMPLEMENTS_DEFERRED_CLASS', "This class cannot implement the deferre
d class '{0}'"); | 1263 static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS = |
| 1264 const CompileTimeErrorCode( |
| 1265 'IMPLEMENTS_DEFERRED_CLASS', |
| 1266 "This class cannot implement the deferred class '{0}'"); |
1074 | 1267 |
1075 /** | 1268 /** |
1076 * 12.2 Null: It is a compile-time error for a class to attempt to extend or | 1269 * 12.2 Null: It is a compile-time error for a class to attempt to extend or |
1077 * implement Null. | 1270 * implement Null. |
1078 * | 1271 * |
1079 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1272 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1080 * or implement int. | 1273 * or implement int. |
1081 * | 1274 * |
1082 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1275 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1083 * or implement double. | 1276 * or implement double. |
1084 * | 1277 * |
1085 * 12.3 Numbers: It is a compile-time error for any type other than the types | 1278 * 12.3 Numbers: It is a compile-time error for any type other than the types |
1086 * int and double to | 1279 * int and double to |
1087 * attempt to extend or implement num. | 1280 * attempt to extend or implement num. |
1088 * | 1281 * |
1089 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend | 1282 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend |
1090 * or implement bool. | 1283 * or implement bool. |
1091 * | 1284 * |
1092 * 12.5 Strings: It is a compile-time error for a class to attempt to extend | 1285 * 12.5 Strings: It is a compile-time error for a class to attempt to extend |
1093 * or implement String. | 1286 * or implement String. |
1094 * | 1287 * |
1095 * @param typeName the name of the type that cannot be implemented | 1288 * @param typeName the name of the type that cannot be implemented |
1096 * See [EXTENDS_DISALLOWED_CLASS]. | 1289 * See [EXTENDS_DISALLOWED_CLASS]. |
1097 */ | 1290 */ |
1098 static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = const CompileT
imeErrorCode('IMPLEMENTS_DISALLOWED_CLASS', "Classes cannot implement '{0}'"); | 1291 static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = |
| 1292 const CompileTimeErrorCode( |
| 1293 'IMPLEMENTS_DISALLOWED_CLASS', |
| 1294 "Classes cannot implement '{0}'"); |
1099 | 1295 |
1100 /** | 1296 /** |
1101 * 7.10 Superinterfaces: It is a compile-time error if the implements clause | 1297 * 7.10 Superinterfaces: It is a compile-time error if the implements clause |
1102 * of a class includes type dynamic. | 1298 * of a class includes type dynamic. |
1103 */ | 1299 */ |
1104 static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC = const CompileTimeErrorC
ode('IMPLEMENTS_DYNAMIC', "Classes cannot implement 'dynamic'"); | 1300 static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC = |
| 1301 const CompileTimeErrorCode( |
| 1302 'IMPLEMENTS_DYNAMIC', |
| 1303 "Classes cannot implement 'dynamic'"); |
1105 | 1304 |
1106 /** | 1305 /** |
1107 * Enum proposal: It is a compile-time error to subclass, mix-in or implement | 1306 * Enum proposal: It is a compile-time error to subclass, mix-in or implement |
1108 * an enum. | 1307 * an enum. |
1109 */ | 1308 */ |
1110 static const CompileTimeErrorCode IMPLEMENTS_ENUM = const CompileTimeErrorCode
('IMPLEMENTS_ENUM', "Classes cannot implement an enum"); | 1309 static const CompileTimeErrorCode IMPLEMENTS_ENUM = |
| 1310 const CompileTimeErrorCode( |
| 1311 'IMPLEMENTS_ENUM', |
| 1312 "Classes cannot implement an enum"); |
1111 | 1313 |
1112 /** | 1314 /** |
1113 * 7.10 Superinterfaces: It is a compile-time error if the implements clause | 1315 * 7.10 Superinterfaces: It is a compile-time error if the implements clause |
1114 * of a class <i>C</i> includes a type expression that does not denote a class | 1316 * of a class <i>C</i> includes a type expression that does not denote a class |
1115 * available in the lexical scope of <i>C</i>. | 1317 * available in the lexical scope of <i>C</i>. |
1116 * | 1318 * |
1117 * @param typeName the name of the interface that was not found | 1319 * @param typeName the name of the interface that was not found |
1118 */ | 1320 */ |
1119 static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = const CompileTimeErro
rCode('IMPLEMENTS_NON_CLASS', "Classes can only implement other classes"); | 1321 static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = |
| 1322 const CompileTimeErrorCode( |
| 1323 'IMPLEMENTS_NON_CLASS', |
| 1324 "Classes can only implement other classes"); |
1120 | 1325 |
1121 /** | 1326 /** |
1122 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears | 1327 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears |
1123 * more than once in the implements clause of a class. | 1328 * more than once in the implements clause of a class. |
1124 * | 1329 * |
1125 * @param className the name of the class that is implemented more than once | 1330 * @param className the name of the class that is implemented more than once |
1126 */ | 1331 */ |
1127 static const CompileTimeErrorCode IMPLEMENTS_REPEATED = const CompileTimeError
Code('IMPLEMENTS_REPEATED', "'{0}' can only be implemented once"); | 1332 static const CompileTimeErrorCode IMPLEMENTS_REPEATED = |
| 1333 const CompileTimeErrorCode( |
| 1334 'IMPLEMENTS_REPEATED', |
| 1335 "'{0}' can only be implemented once"); |
1128 | 1336 |
1129 /** | 1337 /** |
1130 * 7.10 Superinterfaces: It is a compile-time error if the superclass of a | 1338 * 7.10 Superinterfaces: It is a compile-time error if the superclass of a |
1131 * class <i>C</i> appears in the implements clause of <i>C</i>. | 1339 * class <i>C</i> appears in the implements clause of <i>C</i>. |
1132 * | 1340 * |
1133 * @param className the name of the class that appears in both "extends" and | 1341 * @param className the name of the class that appears in both "extends" and |
1134 * "implements" clauses | 1342 * "implements" clauses |
1135 */ | 1343 */ |
1136 static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = const CompileTimeEr
rorCode('IMPLEMENTS_SUPER_CLASS', "'{0}' cannot be used in both 'extends' and 'i
mplements' clauses"); | 1344 static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = |
| 1345 const CompileTimeErrorCode( |
| 1346 'IMPLEMENTS_SUPER_CLASS', |
| 1347 "'{0}' cannot be used in both 'extends' and 'implements' clauses"); |
1137 | 1348 |
1138 /** | 1349 /** |
1139 * 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the | 1350 * 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the |
1140 * right hand side of an initializer. | 1351 * right hand side of an initializer. |
1141 * | 1352 * |
1142 * 12.10 This: It is a compile-time error if this appears in a top-level | 1353 * 12.10 This: It is a compile-time error if this appears in a top-level |
1143 * function or variable initializer, in a factory constructor, or in a static | 1354 * function or variable initializer, in a factory constructor, or in a static |
1144 * method or variable initializer, or in the initializer of an instance | 1355 * method or variable initializer, or in the initializer of an instance |
1145 * variable. | 1356 * variable. |
1146 * | 1357 * |
1147 * @param name the name of the type in question | 1358 * @param name the name of the type in question |
1148 */ | 1359 */ |
1149 static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = con
st CompileTimeErrorCode('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', "Only static m
embers can be accessed in initializers"); | 1360 static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = |
| 1361 const CompileTimeErrorCode( |
| 1362 'IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', |
| 1363 "Only static members can be accessed in initializers"); |
1150 | 1364 |
1151 /** | 1365 /** |
1152 * SDK implementation libraries can be imported only by other SDK libraries. | 1366 * SDK implementation libraries can be imported only by other SDK libraries. |
1153 * | 1367 * |
1154 * @param uri the uri pointing to a library | 1368 * @param uri the uri pointing to a library |
1155 */ | 1369 */ |
1156 static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = const CompileTimeE
rrorCode('IMPORT_INTERNAL_LIBRARY', "The library '{0}' is internal and cannot be
imported"); | 1370 static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = |
| 1371 const CompileTimeErrorCode( |
| 1372 'IMPORT_INTERNAL_LIBRARY', |
| 1373 "The library '{0}' is internal and cannot be imported"); |
1157 | 1374 |
1158 /** | 1375 /** |
1159 * 14.1 Imports: It is a compile-time error if the specified URI of an | 1376 * 14.1 Imports: It is a compile-time error if the specified URI of an |
1160 * immediate import does not refer to a library declaration. | 1377 * immediate import does not refer to a library declaration. |
1161 * | 1378 * |
1162 * @param uri the uri pointing to a non-library declaration | 1379 * @param uri the uri pointing to a non-library declaration |
1163 * See [StaticWarningCode.IMPORT_OF_NON_LIBRARY]. | 1380 * See [StaticWarningCode.IMPORT_OF_NON_LIBRARY]. |
1164 */ | 1381 */ |
1165 static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = const CompileTimeErr
orCode('IMPORT_OF_NON_LIBRARY', "The imported library '{0}' must not have a part
-of directive"); | 1382 static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = |
| 1383 const CompileTimeErrorCode( |
| 1384 'IMPORT_OF_NON_LIBRARY', |
| 1385 "The imported library '{0}' must not have a part-of directive"); |
1166 | 1386 |
1167 /** | 1387 /** |
1168 * 13.9 Switch: It is a compile-time error if values of the expressions | 1388 * 13.9 Switch: It is a compile-time error if values of the expressions |
1169 * <i>e<sub>k</sub></i> are not instances of the same class <i>C</i>, for all | 1389 * <i>e<sub>k</sub></i> are not instances of the same class <i>C</i>, for all |
1170 * <i>1 <= k <= n</i>. | 1390 * <i>1 <= k <= n</i>. |
1171 * | 1391 * |
1172 * @param expressionSource the expression source code that is the unexpected | 1392 * @param expressionSource the expression source code that is the unexpected |
1173 * type | 1393 * type |
1174 * @param expectedType the name of the expected type | 1394 * @param expectedType the name of the expected type |
1175 */ | 1395 */ |
1176 static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = const C
ompileTimeErrorCode('INCONSISTENT_CASE_EXPRESSION_TYPES', "Case expressions must
have the same types, '{0}' is not a '{1}'"); | 1396 static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = |
| 1397 const CompileTimeErrorCode( |
| 1398 'INCONSISTENT_CASE_EXPRESSION_TYPES', |
| 1399 "Case expressions must have the same types, '{0}' is not a '{1}'"); |
1177 | 1400 |
1178 /** | 1401 /** |
1179 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1402 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1180 * is a compile-time error if <i>k</i>'s initializer list contains an | 1403 * is a compile-time error if <i>k</i>'s initializer list contains an |
1181 * initializer for a variable that is not an instance variable declared in the | 1404 * initializer for a variable that is not an instance variable declared in the |
1182 * immediately surrounding class. | 1405 * immediately surrounding class. |
1183 * | 1406 * |
1184 * @param id the name of the initializing formal that is not an instance | 1407 * @param id the name of the initializing formal that is not an instance |
1185 * variable in the immediately enclosing class | 1408 * variable in the immediately enclosing class |
1186 * See [INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]. | 1409 * See [INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]. |
1187 */ | 1410 */ |
1188 static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTENT_FIELD = const C
ompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTENT_FIELD', "'{0}' is not a variab
le in the enclosing class"); | 1411 static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTENT_FIELD = |
| 1412 const CompileTimeErrorCode( |
| 1413 'INITIALIZER_FOR_NON_EXISTENT_FIELD', |
| 1414 "'{0}' is not a variable in the enclosing class"); |
1189 | 1415 |
1190 /** | 1416 /** |
1191 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1417 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1192 * is a compile-time error if <i>k</i>'s initializer list contains an | 1418 * is a compile-time error if <i>k</i>'s initializer list contains an |
1193 * initializer for a variable that is not an instance variable declared in the | 1419 * initializer for a variable that is not an instance variable declared in the |
1194 * immediately surrounding class. | 1420 * immediately surrounding class. |
1195 * | 1421 * |
1196 * @param id the name of the initializing formal that is a static variable in | 1422 * @param id the name of the initializing formal that is a static variable in |
1197 * the immediately enclosing class | 1423 * the immediately enclosing class |
1198 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD]. | 1424 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD]. |
1199 */ | 1425 */ |
1200 static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = const Compile
TimeErrorCode('INITIALIZER_FOR_STATIC_FIELD', "'{0}' is a static variable in the
enclosing class, variables initialized in a constructor cannot be static"); | 1426 static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = |
| 1427 const CompileTimeErrorCode( |
| 1428 'INITIALIZER_FOR_STATIC_FIELD', |
| 1429 "'{0}' is a static variable in the enclosing class, variables initiali
zed in a constructor cannot be static"); |
1201 | 1430 |
1202 /** | 1431 /** |
1203 * 7.6.1 Generative Constructors: An initializing formal has the form | 1432 * 7.6.1 Generative Constructors: An initializing formal has the form |
1204 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of | 1433 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of |
1205 * an instance variable of the immediately enclosing class. | 1434 * an instance variable of the immediately enclosing class. |
1206 * | 1435 * |
1207 * @param id the name of the initializing formal that is not an instance | 1436 * @param id the name of the initializing formal that is not an instance |
1208 * variable in the immediately enclosing class | 1437 * variable in the immediately enclosing class |
1209 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD], and | 1438 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD], and |
1210 * [INITIALIZER_FOR_NON_EXISTENT_FIELD]. | 1439 * [INITIALIZER_FOR_NON_EXISTENT_FIELD]. |
1211 */ | 1440 */ |
1212 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD =
const CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD', "'{0}'
is not a variable in the enclosing class"); | 1441 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD = |
| 1442 const CompileTimeErrorCode( |
| 1443 'INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD', |
| 1444 "'{0}' is not a variable in the enclosing class"); |
1213 | 1445 |
1214 /** | 1446 /** |
1215 * 7.6.1 Generative Constructors: An initializing formal has the form | 1447 * 7.6.1 Generative Constructors: An initializing formal has the form |
1216 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of | 1448 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of |
1217 * an instance variable of the immediately enclosing class. | 1449 * an instance variable of the immediately enclosing class. |
1218 * | 1450 * |
1219 * @param id the name of the initializing formal that is a static variable in | 1451 * @param id the name of the initializing formal that is a static variable in |
1220 * the immediately enclosing class | 1452 * the immediately enclosing class |
1221 * See [INITIALIZER_FOR_STATIC_FIELD]. | 1453 * See [INITIALIZER_FOR_STATIC_FIELD]. |
1222 */ | 1454 */ |
1223 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = const
CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_STATIC_FIELD', "'{0}' is a static
field in the enclosing class, fields initialized in a constructor cannot be sta
tic"); | 1455 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = |
| 1456 const CompileTimeErrorCode( |
| 1457 'INITIALIZING_FORMAL_FOR_STATIC_FIELD', |
| 1458 "'{0}' is a static field in the enclosing class, fields initialized in
a constructor cannot be static"); |
1224 | 1459 |
1225 /** | 1460 /** |
1226 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property | 1461 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property |
1227 * extraction <b>this</b>.<i>id</i>. | 1462 * extraction <b>this</b>.<i>id</i>. |
1228 */ | 1463 */ |
1229 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY = const
CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_FACTORY', "Instance members ca
nnot be accessed from a factory constructor"); | 1464 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY = |
| 1465 const CompileTimeErrorCode( |
| 1466 'INSTANCE_MEMBER_ACCESS_FROM_FACTORY', |
| 1467 "Instance members cannot be accessed from a factory constructor"); |
1230 | 1468 |
1231 /** | 1469 /** |
1232 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property | 1470 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property |
1233 * extraction <b>this</b>.<i>id</i>. | 1471 * extraction <b>this</b>.<i>id</i>. |
1234 */ | 1472 */ |
1235 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = const C
ompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_STATIC', "Instance members cann
ot be accessed from a static method"); | 1473 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = |
| 1474 const CompileTimeErrorCode( |
| 1475 'INSTANCE_MEMBER_ACCESS_FROM_STATIC', |
| 1476 "Instance members cannot be accessed from a static method"); |
1236 | 1477 |
1237 /** | 1478 /** |
1238 * Enum proposal: It is also a compile-time error to explicitly instantiate an | 1479 * Enum proposal: It is also a compile-time error to explicitly instantiate an |
1239 * enum via 'new' or 'const' or to access its private fields. | 1480 * enum via 'new' or 'const' or to access its private fields. |
1240 */ | 1481 */ |
1241 static const CompileTimeErrorCode INSTANTIATE_ENUM = const CompileTimeErrorCod
e('INSTANTIATE_ENUM', "Enums cannot be instantiated"); | 1482 static const CompileTimeErrorCode INSTANTIATE_ENUM = |
| 1483 const CompileTimeErrorCode('INSTANTIATE_ENUM', "Enums cannot be instantiat
ed"); |
1242 | 1484 |
1243 /** | 1485 /** |
1244 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1486 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1245 * begin with the character @, followed by a constant expression that must be | 1487 * begin with the character @, followed by a constant expression that must be |
1246 * either a reference to a compile-time constant variable, or a call to a | 1488 * either a reference to a compile-time constant variable, or a call to a |
1247 * constant constructor. | 1489 * constant constructor. |
1248 */ | 1490 */ |
1249 static const CompileTimeErrorCode INVALID_ANNOTATION = const CompileTimeErrorC
ode('INVALID_ANNOTATION', "Annotation can be only constant variable or constant
constructor invocation"); | 1491 static const CompileTimeErrorCode INVALID_ANNOTATION = |
| 1492 const CompileTimeErrorCode( |
| 1493 'INVALID_ANNOTATION', |
| 1494 "Annotation can be only constant variable or constant constructor invo
cation"); |
1250 | 1495 |
1251 /** | 1496 /** |
1252 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1497 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1253 * begin with the character @, followed by a constant expression that must be | 1498 * begin with the character @, followed by a constant expression that must be |
1254 * either a reference to a compile-time constant variable, or a call to a | 1499 * either a reference to a compile-time constant variable, or a call to a |
1255 * constant constructor. | 1500 * constant constructor. |
1256 * | 1501 * |
1257 * 12.1 Constants: A qualified reference to a static constant variable that is | 1502 * 12.1 Constants: A qualified reference to a static constant variable that is |
1258 * not qualified by a deferred prefix. | 1503 * not qualified by a deferred prefix. |
1259 */ | 1504 */ |
1260 static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY = c
onst CompileTimeErrorCode('INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY', "Constant
values from a deferred library cannot be used as annotations"); | 1505 static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY = |
| 1506 const CompileTimeErrorCode( |
| 1507 'INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY', |
| 1508 "Constant values from a deferred library cannot be used as annotations
"); |
1261 | 1509 |
1262 /** | 1510 /** |
1263 * 15.31 Identifier Reference: It is a compile-time error if any of the | 1511 * 15.31 Identifier Reference: It is a compile-time error if any of the |
1264 * identifiers async, await or yield is used as an identifier in a function | 1512 * identifiers async, await or yield is used as an identifier in a function |
1265 * body marked with either async, async* or sync*. | 1513 * body marked with either async, async* or sync*. |
1266 */ | 1514 */ |
1267 static const CompileTimeErrorCode INVALID_IDENTIFIER_IN_ASYNC = const CompileT
imeErrorCode('INVALID_IDENTIFIER_IN_ASYNC', "The identifier '{0}' cannot be used
in a function marked with async, async* or sync*"); | 1515 static const CompileTimeErrorCode INVALID_IDENTIFIER_IN_ASYNC = |
| 1516 const CompileTimeErrorCode( |
| 1517 'INVALID_IDENTIFIER_IN_ASYNC', |
| 1518 "The identifier '{0}' cannot be used in a function marked with async,
async* or sync*"); |
1268 | 1519 |
1269 /** | 1520 /** |
1270 * 9. Functions: It is a compile-time error if an async, async* or sync* | 1521 * 9. Functions: It is a compile-time error if an async, async* or sync* |
1271 * modifier is attached to the body of a setter or constructor. | 1522 * modifier is attached to the body of a setter or constructor. |
1272 */ | 1523 */ |
1273 static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR = const Comp
ileTimeErrorCode('INVALID_MODIFIER_ON_CONSTRUCTOR', "The modifier '{0}' cannot b
e applied to the body of a constructor"); | 1524 static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR = |
| 1525 const CompileTimeErrorCode( |
| 1526 'INVALID_MODIFIER_ON_CONSTRUCTOR', |
| 1527 "The modifier '{0}' cannot be applied to the body of a constructor"); |
1274 | 1528 |
1275 /** | 1529 /** |
1276 * 9. Functions: It is a compile-time error if an async, async* or sync* | 1530 * 9. Functions: It is a compile-time error if an async, async* or sync* |
1277 * modifier is attached to the body of a setter or constructor. | 1531 * modifier is attached to the body of a setter or constructor. |
1278 */ | 1532 */ |
1279 static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER = const CompileTi
meErrorCode('INVALID_MODIFIER_ON_SETTER', "The modifier '{0}' cannot be applied
to the body of a setter"); | 1533 static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER = |
| 1534 const CompileTimeErrorCode( |
| 1535 'INVALID_MODIFIER_ON_SETTER', |
| 1536 "The modifier '{0}' cannot be applied to the body of a setter"); |
1280 | 1537 |
1281 /** | 1538 /** |
1282 * TODO(brianwilkerson) Remove this when we have decided on how to report | 1539 * TODO(brianwilkerson) Remove this when we have decided on how to report |
1283 * errors in compile-time constants. Until then, this acts as a placeholder | 1540 * errors in compile-time constants. Until then, this acts as a placeholder |
1284 * for more informative errors. | 1541 * for more informative errors. |
1285 * | 1542 * |
1286 * See TODOs in ConstantVisitor | 1543 * See TODOs in ConstantVisitor |
1287 */ | 1544 */ |
1288 static const CompileTimeErrorCode INVALID_CONSTANT = const CompileTimeErrorCod
e('INVALID_CONSTANT', "Invalid constant value"); | 1545 static const CompileTimeErrorCode INVALID_CONSTANT = |
| 1546 const CompileTimeErrorCode('INVALID_CONSTANT', "Invalid constant value"); |
1289 | 1547 |
1290 /** | 1548 /** |
1291 * 7.6 Constructors: It is a compile-time error if the name of a constructor | 1549 * 7.6 Constructors: It is a compile-time error if the name of a constructor |
1292 * is not a constructor name. | 1550 * is not a constructor name. |
1293 */ | 1551 */ |
1294 static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = const CompileTime
ErrorCode('INVALID_CONSTRUCTOR_NAME', "Invalid constructor name"); | 1552 static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = |
| 1553 const CompileTimeErrorCode( |
| 1554 'INVALID_CONSTRUCTOR_NAME', |
| 1555 "Invalid constructor name"); |
1295 | 1556 |
1296 /** | 1557 /** |
1297 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of | 1558 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of |
1298 * the immediately enclosing class. | 1559 * the immediately enclosing class. |
1299 */ | 1560 */ |
1300 static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = const Com
pileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', "The name of the immediate
ly enclosing class expected"); | 1561 static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = |
| 1562 const CompileTimeErrorCode( |
| 1563 'INVALID_FACTORY_NAME_NOT_A_CLASS', |
| 1564 "The name of the immediately enclosing class expected"); |
1301 | 1565 |
1302 /** | 1566 /** |
1303 * 12.10 This: It is a compile-time error if this appears in a top-level | 1567 * 12.10 This: It is a compile-time error if this appears in a top-level |
1304 * function or variable initializer, in a factory constructor, or in a static | 1568 * function or variable initializer, in a factory constructor, or in a static |
1305 * method or variable initializer, or in the initializer of an instance | 1569 * method or variable initializer, or in the initializer of an instance |
1306 * variable. | 1570 * variable. |
1307 */ | 1571 */ |
1308 static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = const CompileTim
eErrorCode('INVALID_REFERENCE_TO_THIS', "Invalid reference to 'this' expression"
); | 1572 static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = |
| 1573 const CompileTimeErrorCode( |
| 1574 'INVALID_REFERENCE_TO_THIS', |
| 1575 "Invalid reference to 'this' expression"); |
1309 | 1576 |
1310 /** | 1577 /** |
1311 * 12.6 Lists: It is a compile time error if the type argument of a constant | 1578 * 12.6 Lists: It is a compile time error if the type argument of a constant |
1312 * list literal includes a type parameter. | 1579 * list literal includes a type parameter. |
1313 * | 1580 * |
1314 * @name the name of the type parameter | 1581 * @name the name of the type parameter |
1315 */ | 1582 */ |
1316 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = const
CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', "Constant list liter
als cannot include a type parameter as a type argument, such as '{0}'"); | 1583 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = |
| 1584 const CompileTimeErrorCode( |
| 1585 'INVALID_TYPE_ARGUMENT_IN_CONST_LIST', |
| 1586 "Constant list literals cannot include a type parameter as a type argu
ment, such as '{0}'"); |
1317 | 1587 |
1318 /** | 1588 /** |
1319 * 12.7 Maps: It is a compile time error if the type arguments of a constant | 1589 * 12.7 Maps: It is a compile time error if the type arguments of a constant |
1320 * map literal include a type parameter. | 1590 * map literal include a type parameter. |
1321 * | 1591 * |
1322 * @name the name of the type parameter | 1592 * @name the name of the type parameter |
1323 */ | 1593 */ |
1324 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = const C
ompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', "Constant map literals
cannot include a type parameter as a type argument, such as '{0}'"); | 1594 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = |
| 1595 const CompileTimeErrorCode( |
| 1596 'INVALID_TYPE_ARGUMENT_IN_CONST_MAP', |
| 1597 "Constant map literals cannot include a type parameter as a type argum
ent, such as '{0}'"); |
1325 | 1598 |
1326 /** | 1599 /** |
1327 * 14.2 Exports: It is a compile-time error if the compilation unit found at | 1600 * 14.2 Exports: It is a compile-time error if the compilation unit found at |
1328 * the specified URI is not a library declaration. | 1601 * the specified URI is not a library declaration. |
1329 * | 1602 * |
1330 * 14.1 Imports: It is a compile-time error if the compilation unit found at | 1603 * 14.1 Imports: It is a compile-time error if the compilation unit found at |
1331 * the specified URI is not a library declaration. | 1604 * the specified URI is not a library declaration. |
1332 * | 1605 * |
1333 * 14.3 Parts: It is a compile time error if the contents of the URI are not a | 1606 * 14.3 Parts: It is a compile time error if the contents of the URI are not a |
1334 * valid part declaration. | 1607 * valid part declaration. |
1335 * | 1608 * |
1336 * @param uri the URI that is invalid | 1609 * @param uri the URI that is invalid |
1337 * See [URI_DOES_NOT_EXIST]. | 1610 * See [URI_DOES_NOT_EXIST]. |
1338 */ | 1611 */ |
1339 static const CompileTimeErrorCode INVALID_URI = const CompileTimeErrorCode('IN
VALID_URI', "Invalid URI syntax: '{0}'"); | 1612 static const CompileTimeErrorCode INVALID_URI = |
| 1613 const CompileTimeErrorCode('INVALID_URI', "Invalid URI syntax: '{0}'"); |
1340 | 1614 |
1341 /** | 1615 /** |
1342 * 13.13 Break: It is a compile-time error if no such statement | 1616 * 13.13 Break: It is a compile-time error if no such statement |
1343 * <i>s<sub>E</sub></i> exists within the innermost function in which | 1617 * <i>s<sub>E</sub></i> exists within the innermost function in which |
1344 * <i>s<sub>b</sub></i> occurs. | 1618 * <i>s<sub>b</sub></i> occurs. |
1345 * | 1619 * |
1346 * 13.14 Continue: It is a compile-time error if no such statement or case | 1620 * 13.14 Continue: It is a compile-time error if no such statement or case |
1347 * clause <i>s<sub>E</sub></i> exists within the innermost function in which | 1621 * clause <i>s<sub>E</sub></i> exists within the innermost function in which |
1348 * <i>s<sub>c</sub></i> occurs. | 1622 * <i>s<sub>c</sub></i> occurs. |
1349 * | 1623 * |
1350 * @param labelName the name of the unresolvable label | 1624 * @param labelName the name of the unresolvable label |
1351 */ | 1625 */ |
1352 static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = const CompileTimeErro
rCode('LABEL_IN_OUTER_SCOPE', "Cannot reference label '{0}' declared in an outer
method"); | 1626 static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = |
| 1627 const CompileTimeErrorCode( |
| 1628 'LABEL_IN_OUTER_SCOPE', |
| 1629 "Cannot reference label '{0}' declared in an outer method"); |
1353 | 1630 |
1354 /** | 1631 /** |
1355 * 13.13 Break: It is a compile-time error if no such statement | 1632 * 13.13 Break: It is a compile-time error if no such statement |
1356 * <i>s<sub>E</sub></i> exists within the innermost function in which | 1633 * <i>s<sub>E</sub></i> exists within the innermost function in which |
1357 * <i>s<sub>b</sub></i> occurs. | 1634 * <i>s<sub>b</sub></i> occurs. |
1358 * | 1635 * |
1359 * 13.14 Continue: It is a compile-time error if no such statement or case | 1636 * 13.14 Continue: It is a compile-time error if no such statement or case |
1360 * clause <i>s<sub>E</sub></i> exists within the innermost function in which | 1637 * clause <i>s<sub>E</sub></i> exists within the innermost function in which |
1361 * <i>s<sub>c</sub></i> occurs. | 1638 * <i>s<sub>c</sub></i> occurs. |
1362 * | 1639 * |
1363 * @param labelName the name of the unresolvable label | 1640 * @param labelName the name of the unresolvable label |
1364 */ | 1641 */ |
1365 static const CompileTimeErrorCode LABEL_UNDEFINED = const CompileTimeErrorCode
('LABEL_UNDEFINED', "Cannot reference undefined label '{0}'"); | 1642 static const CompileTimeErrorCode LABEL_UNDEFINED = |
| 1643 const CompileTimeErrorCode( |
| 1644 'LABEL_UNDEFINED', |
| 1645 "Cannot reference undefined label '{0}'"); |
1366 | 1646 |
1367 /** | 1647 /** |
1368 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member | 1648 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member |
1369 * with the same name as <i>C</i>. | 1649 * with the same name as <i>C</i>. |
1370 */ | 1650 */ |
1371 static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = const CompileTimeEr
rorCode('MEMBER_WITH_CLASS_NAME', "Class members cannot have the same name as th
e enclosing class"); | 1651 static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = |
| 1652 const CompileTimeErrorCode( |
| 1653 'MEMBER_WITH_CLASS_NAME', |
| 1654 "Class members cannot have the same name as the enclosing class"); |
1372 | 1655 |
1373 /** | 1656 /** |
1374 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 1657 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
1375 * method with the same name. | 1658 * method with the same name. |
1376 * | 1659 * |
1377 * @param name the conflicting name of the getter and method | 1660 * @param name the conflicting name of the getter and method |
1378 */ | 1661 */ |
1379 static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = const Com
pileTimeErrorCode('METHOD_AND_GETTER_WITH_SAME_NAME', "'{0}' cannot be used to n
ame a method, there is already a getter with the same name"); | 1662 static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = |
| 1663 const CompileTimeErrorCode( |
| 1664 'METHOD_AND_GETTER_WITH_SAME_NAME', |
| 1665 "'{0}' cannot be used to name a method, there is already a getter with
the same name"); |
1380 | 1666 |
1381 /** | 1667 /** |
1382 * 12.1 Constants: A constant expression is ... a constant list literal. | 1668 * 12.1 Constants: A constant expression is ... a constant list literal. |
1383 */ | 1669 */ |
1384 static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = const Compil
eTimeErrorCode('MISSING_CONST_IN_LIST_LITERAL', "List literals must be prefixed
with 'const' when used as a constant expression"); | 1670 static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = |
| 1671 const CompileTimeErrorCode( |
| 1672 'MISSING_CONST_IN_LIST_LITERAL', |
| 1673 "List literals must be prefixed with 'const' when used as a constant e
xpression"); |
1385 | 1674 |
1386 /** | 1675 /** |
1387 * 12.1 Constants: A constant expression is ... a constant map literal. | 1676 * 12.1 Constants: A constant expression is ... a constant map literal. |
1388 */ | 1677 */ |
1389 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = const Compile
TimeErrorCode('MISSING_CONST_IN_MAP_LITERAL', "Map literals must be prefixed wit
h 'const' when used as a constant expression"); | 1678 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = |
| 1679 const CompileTimeErrorCode( |
| 1680 'MISSING_CONST_IN_MAP_LITERAL', |
| 1681 "Map literals must be prefixed with 'const' when used as a constant ex
pression"); |
1390 | 1682 |
1391 /** | 1683 /** |
1392 * Enum proposal: It is a static warning if all of the following conditions | 1684 * Enum proposal: It is a static warning if all of the following conditions |
1393 * hold: | 1685 * hold: |
1394 * * The switch statement does not have a 'default' clause. | 1686 * * The switch statement does not have a 'default' clause. |
1395 * * The static type of <i>e</i> is an enumerated typed with elements | 1687 * * The static type of <i>e</i> is an enumerated typed with elements |
1396 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. | 1688 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. |
1397 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and | 1689 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and |
1398 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the same
. | 1690 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the same
. |
1399 * | 1691 * |
1400 * @param constantName the name of the constant that is missing | 1692 * @param constantName the name of the constant that is missing |
1401 */ | 1693 */ |
1402 static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH = const Comp
ileTimeErrorCode('MISSING_ENUM_CONSTANT_IN_SWITCH', "Missing case clause for '{0
}'", "Add a case clause for the missing constant or add a default clause."); | 1694 static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH = |
| 1695 const CompileTimeErrorCode( |
| 1696 'MISSING_ENUM_CONSTANT_IN_SWITCH', |
| 1697 "Missing case clause for '{0}'", |
| 1698 "Add a case clause for the missing constant or add a default clause.")
; |
1403 | 1699 |
1404 /** | 1700 /** |
1405 * 9 Mixins: It is a compile-time error if a declared or derived mixin | 1701 * 9 Mixins: It is a compile-time error if a declared or derived mixin |
1406 * explicitly declares a constructor. | 1702 * explicitly declares a constructor. |
1407 * | 1703 * |
1408 * @param typeName the name of the mixin that is invalid | 1704 * @param typeName the name of the mixin that is invalid |
1409 */ | 1705 */ |
1410 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = const CompileTi
meErrorCode('MIXIN_DECLARES_CONSTRUCTOR', "The class '{0}' cannot be used as a m
ixin because it declares a constructor"); | 1706 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = |
| 1707 const CompileTimeErrorCode( |
| 1708 'MIXIN_DECLARES_CONSTRUCTOR', |
| 1709 "The class '{0}' cannot be used as a mixin because it declares a const
ructor"); |
1411 | 1710 |
1412 /** | 1711 /** |
1413 * 9.1 Mixin Application: It is a compile-time error if the with clause of a | 1712 * 9.1 Mixin Application: It is a compile-time error if the with clause of a |
1414 * mixin application <i>C</i> includes a deferred type expression. | 1713 * mixin application <i>C</i> includes a deferred type expression. |
1415 * | 1714 * |
1416 * @param typeName the name of the type that cannot be extended | 1715 * @param typeName the name of the type that cannot be extended |
1417 * See [EXTENDS_DEFERRED_CLASS], and [IMPLEMENTS_DEFERRED_CLASS]. | 1716 * See [EXTENDS_DEFERRED_CLASS], and [IMPLEMENTS_DEFERRED_CLASS]. |
1418 */ | 1717 */ |
1419 static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = const CompileTimeErro
rCode('MIXIN_DEFERRED_CLASS', "This class cannot mixin the deferred class '{0}'"
); | 1718 static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = |
| 1719 const CompileTimeErrorCode( |
| 1720 'MIXIN_DEFERRED_CLASS', |
| 1721 "This class cannot mixin the deferred class '{0}'"); |
1420 | 1722 |
1421 /** | 1723 /** |
1422 * Not yet in the spec, but consistent with VM behavior. It is a | 1724 * Not yet in the spec, but consistent with VM behavior. It is a |
1423 * compile-time error if all of the constructors of a mixin's base class have | 1725 * compile-time error if all of the constructors of a mixin's base class have |
1424 * at least one optional parameter (since only constructors that lack | 1726 * at least one optional parameter (since only constructors that lack |
1425 * optional parameters can be forwarded to the mixin). See | 1727 * optional parameters can be forwarded to the mixin). See |
1426 * https://code.google.com/p/dart/issues/detail?id=15101#c4 | 1728 * https://code.google.com/p/dart/issues/detail?id=15101#c4 |
1427 */ | 1729 */ |
1428 static const CompileTimeErrorCode MIXIN_HAS_NO_CONSTRUCTORS = | 1730 static const CompileTimeErrorCode MIXIN_HAS_NO_CONSTRUCTORS = |
1429 const CompileTimeErrorCode('MIXIN_HAS_NO_CONSTRUCTORS', | 1731 const CompileTimeErrorCode( |
| 1732 'MIXIN_HAS_NO_CONSTRUCTORS', |
1430 "This mixin application is invalid because all of the constructors " | 1733 "This mixin application is invalid because all of the constructors " |
1431 "in the base class '{0}' have optional parameters."); | 1734 "in the base class '{0}' have optional parameters."); |
1432 | 1735 |
1433 /** | 1736 /** |
1434 * 9 Mixins: It is a compile-time error if a mixin is derived from a class | 1737 * 9 Mixins: It is a compile-time error if a mixin is derived from a class |
1435 * whose superclass is not Object. | 1738 * whose superclass is not Object. |
1436 * | 1739 * |
1437 * @param typeName the name of the mixin that is invalid | 1740 * @param typeName the name of the mixin that is invalid |
1438 */ | 1741 */ |
1439 static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = const Compi
leTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', "The class '{0}' cannot be use
d as a mixin because it extends a class other than Object"); | 1742 static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = |
| 1743 const CompileTimeErrorCode( |
| 1744 'MIXIN_INHERITS_FROM_NOT_OBJECT', |
| 1745 "The class '{0}' cannot be used as a mixin because it extends a class
other than Object"); |
1440 | 1746 |
1441 /** | 1747 /** |
1442 * 12.2 Null: It is a compile-time error for a class to attempt to extend or | 1748 * 12.2 Null: It is a compile-time error for a class to attempt to extend or |
1443 * implement Null. | 1749 * implement Null. |
1444 * | 1750 * |
1445 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1751 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1446 * or implement int. | 1752 * or implement int. |
1447 * | 1753 * |
1448 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1754 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1449 * or implement double. | 1755 * or implement double. |
1450 * | 1756 * |
1451 * 12.3 Numbers: It is a compile-time error for any type other than the types | 1757 * 12.3 Numbers: It is a compile-time error for any type other than the types |
1452 * int and double to attempt to extend or implement num. | 1758 * int and double to attempt to extend or implement num. |
1453 * | 1759 * |
1454 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend | 1760 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend |
1455 * or implement bool. | 1761 * or implement bool. |
1456 * | 1762 * |
1457 * 12.5 Strings: It is a compile-time error for a class to attempt to extend | 1763 * 12.5 Strings: It is a compile-time error for a class to attempt to extend |
1458 * or implement String. | 1764 * or implement String. |
1459 * | 1765 * |
1460 * @param typeName the name of the type that cannot be extended | 1766 * @param typeName the name of the type that cannot be extended |
1461 * See [IMPLEMENTS_DISALLOWED_CLASS]. | 1767 * See [IMPLEMENTS_DISALLOWED_CLASS]. |
1462 */ | 1768 */ |
1463 static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = const CompileTim
eErrorCode('MIXIN_OF_DISALLOWED_CLASS', "Classes cannot mixin '{0}'"); | 1769 static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = |
| 1770 const CompileTimeErrorCode( |
| 1771 'MIXIN_OF_DISALLOWED_CLASS', |
| 1772 "Classes cannot mixin '{0}'"); |
1464 | 1773 |
1465 /** | 1774 /** |
1466 * Enum proposal: It is a compile-time error to subclass, mix-in or implement | 1775 * Enum proposal: It is a compile-time error to subclass, mix-in or implement |
1467 * an enum. | 1776 * an enum. |
1468 */ | 1777 */ |
1469 static const CompileTimeErrorCode MIXIN_OF_ENUM = const CompileTimeErrorCode('
MIXIN_OF_ENUM', "Classes cannot mixin an enum"); | 1778 static const CompileTimeErrorCode MIXIN_OF_ENUM = |
| 1779 const CompileTimeErrorCode('MIXIN_OF_ENUM', "Classes cannot mixin an enum"
); |
1470 | 1780 |
1471 /** | 1781 /** |
1472 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not | 1782 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not |
1473 * denote a class or mixin available in the immediately enclosing scope. | 1783 * denote a class or mixin available in the immediately enclosing scope. |
1474 */ | 1784 */ |
1475 static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = const CompileTimeErrorC
ode('MIXIN_OF_NON_CLASS', "Classes can only mixin other classes"); | 1785 static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = |
| 1786 const CompileTimeErrorCode( |
| 1787 'MIXIN_OF_NON_CLASS', |
| 1788 "Classes can only mixin other classes"); |
1476 | 1789 |
1477 /** | 1790 /** |
1478 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers | 1791 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers |
1479 * to super. | 1792 * to super. |
1480 */ | 1793 */ |
1481 static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER = const CompileTimeEr
rorCode('MIXIN_REFERENCES_SUPER', "The class '{0}' cannot be used as a mixin bec
ause it references 'super'"); | 1794 static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER = |
| 1795 const CompileTimeErrorCode( |
| 1796 'MIXIN_REFERENCES_SUPER', |
| 1797 "The class '{0}' cannot be used as a mixin because it references 'supe
r'"); |
1482 | 1798 |
1483 /** | 1799 /** |
1484 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not | 1800 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not |
1485 * denote a class available in the immediately enclosing scope. | 1801 * denote a class available in the immediately enclosing scope. |
1486 */ | 1802 */ |
1487 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = const Comp
ileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', "Mixin can only be applied t
o class"); | 1803 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = |
| 1804 const CompileTimeErrorCode( |
| 1805 'MIXIN_WITH_NON_CLASS_SUPERCLASS', |
| 1806 "Mixin can only be applied to class"); |
1488 | 1807 |
1489 /** | 1808 /** |
1490 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 1809 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
1491 * in which case its only action is to invoke another generative constructor. | 1810 * in which case its only action is to invoke another generative constructor. |
1492 */ | 1811 */ |
1493 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS
= const CompileTimeErrorCode('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', "C
onstructor may have at most one 'this' redirection"); | 1812 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS |
| 1813 = |
| 1814 const CompileTimeErrorCode( |
| 1815 'MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', |
| 1816 "Constructor may have at most one 'this' redirection"); |
1494 | 1817 |
1495 /** | 1818 /** |
1496 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. | 1819 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. |
1497 * Then <i>k</i> may include at most one superinitializer in its initializer | 1820 * Then <i>k</i> may include at most one superinitializer in its initializer |
1498 * list or a compile time error occurs. | 1821 * list or a compile time error occurs. |
1499 */ | 1822 */ |
1500 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = const CompileT
imeErrorCode('MULTIPLE_SUPER_INITIALIZERS', "Constructor may have at most one 's
uper' initializer"); | 1823 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = |
| 1824 const CompileTimeErrorCode( |
| 1825 'MULTIPLE_SUPER_INITIALIZERS', |
| 1826 "Constructor may have at most one 'super' initializer"); |
1501 | 1827 |
1502 /** | 1828 /** |
1503 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1829 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1504 * begin with the character @, followed by a constant expression that must be | 1830 * begin with the character @, followed by a constant expression that must be |
1505 * either a reference to a compile-time constant variable, or a call to a | 1831 * either a reference to a compile-time constant variable, or a call to a |
1506 * constant constructor. | 1832 * constant constructor. |
1507 */ | 1833 */ |
1508 static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = const
CompileTimeErrorCode('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', "Annotation creation
must have arguments"); | 1834 static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = |
| 1835 const CompileTimeErrorCode( |
| 1836 'NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', |
| 1837 "Annotation creation must have arguments"); |
1509 | 1838 |
1510 /** | 1839 /** |
1511 * 7.6.1 Generative Constructors: If no superinitializer is provided, an | 1840 * 7.6.1 Generative Constructors: If no superinitializer is provided, an |
1512 * implicit superinitializer of the form <b>super</b>() is added at the end of | 1841 * implicit superinitializer of the form <b>super</b>() is added at the end of |
1513 * <i>k</i>'s initializer list, unless the enclosing class is class | 1842 * <i>k</i>'s initializer list, unless the enclosing class is class |
1514 * <i>Object</i>. | 1843 * <i>Object</i>. |
1515 * | 1844 * |
1516 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> | 1845 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> |
1517 * does not declare a generative constructor named <i>S</i> (respectively | 1846 * does not declare a generative constructor named <i>S</i> (respectively |
1518 * <i>S.id</i>) | 1847 * <i>S.id</i>) |
1519 */ | 1848 */ |
1520 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = cons
t CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', "The class '{0}'
does not have a default constructor"); | 1849 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = |
| 1850 const CompileTimeErrorCode( |
| 1851 'NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', |
| 1852 "The class '{0}' does not have a default constructor"); |
1521 | 1853 |
1522 /** | 1854 /** |
1523 * 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it | 1855 * 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it |
1524 * implicitly has a default constructor C() : <b>super<b>() {}, unless | 1856 * implicitly has a default constructor C() : <b>super<b>() {}, unless |
1525 * <i>C</i> is class <i>Object</i>. | 1857 * <i>C</i> is class <i>Object</i>. |
1526 * | 1858 * |
1527 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> | 1859 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> |
1528 * does not declare a generative constructor named <i>S</i> (respectively | 1860 * does not declare a generative constructor named <i>S</i> (respectively |
1529 * <i>S.id</i>) | 1861 * <i>S.id</i>) |
1530 */ | 1862 */ |
1531 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = cons
t CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', "The class '{0}'
does not have a default constructor"); | 1863 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = |
| 1864 const CompileTimeErrorCode( |
| 1865 'NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', |
| 1866 "The class '{0}' does not have a default constructor"); |
1532 | 1867 |
1533 /** | 1868 /** |
1534 * 13.2 Expression Statements: It is a compile-time error if a non-constant | 1869 * 13.2 Expression Statements: It is a compile-time error if a non-constant |
1535 * map literal that has no explicit type arguments appears in a place where a | 1870 * map literal that has no explicit type arguments appears in a place where a |
1536 * statement is expected. | 1871 * statement is expected. |
1537 */ | 1872 */ |
1538 static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = cons
t CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', "A non-constant
map literal without type arguments cannot be used as an expression statement"); | 1873 static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = |
| 1874 const CompileTimeErrorCode( |
| 1875 'NON_CONST_MAP_AS_EXPRESSION_STATEMENT', |
| 1876 "A non-constant map literal without type arguments cannot be used as a
n expression statement"); |
1539 | 1877 |
1540 /** | 1878 /** |
1541 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { | 1879 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { |
1542 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: | 1880 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: |
1543 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case | 1881 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case |
1544 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form | 1882 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form |
1545 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case | 1883 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case |
1546 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … | 1884 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … |
1547 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a | 1885 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a |
1548 * compile-time error if the expressions <i>e<sub>k</sub></i> are not | 1886 * compile-time error if the expressions <i>e<sub>k</sub></i> are not |
1549 * compile-time constants, for all <i>1 <= k <= n</i>. | 1887 * compile-time constants, for all <i>1 <= k <= n</i>. |
1550 */ | 1888 */ |
1551 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = const Compile
TimeErrorCode('NON_CONSTANT_CASE_EXPRESSION', "Case expressions must be constant
"); | 1889 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = |
| 1890 const CompileTimeErrorCode( |
| 1891 'NON_CONSTANT_CASE_EXPRESSION', |
| 1892 "Case expressions must be constant"); |
1552 | 1893 |
1553 /** | 1894 /** |
1554 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { | 1895 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { |
1555 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: | 1896 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: |
1556 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case | 1897 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case |
1557 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form | 1898 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form |
1558 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case | 1899 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case |
1559 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … | 1900 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … |
1560 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a | 1901 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a |
1561 * compile-time error if the expressions <i>e<sub>k</sub></i> are not | 1902 * compile-time error if the expressions <i>e<sub>k</sub></i> are not |
1562 * compile-time constants, for all <i>1 <= k <= n</i>. | 1903 * compile-time constants, for all <i>1 <= k <= n</i>. |
1563 * | 1904 * |
1564 * 12.1 Constants: A qualified reference to a static constant variable that is | 1905 * 12.1 Constants: A qualified reference to a static constant variable that is |
1565 * not qualified by a deferred prefix. | 1906 * not qualified by a deferred prefix. |
1566 */ | 1907 */ |
1567 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_L
IBRARY = const CompileTimeErrorCode('NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_
LIBRARY', "Constant values from a deferred library cannot be used as a case expr
ession"); | 1908 static const CompileTimeErrorCode |
| 1909 NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY = |
| 1910 const CompileTimeErrorCode( |
| 1911 'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY', |
| 1912 "Constant values from a deferred library cannot be used as a case expr
ession"); |
1568 | 1913 |
1569 /** | 1914 /** |
1570 * 6.2.2 Optional Formals: It is a compile-time error if the default value of | 1915 * 6.2.2 Optional Formals: It is a compile-time error if the default value of |
1571 * an optional parameter is not a compile-time constant. | 1916 * an optional parameter is not a compile-time constant. |
1572 */ | 1917 */ |
1573 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = const CompileTi
meErrorCode('NON_CONSTANT_DEFAULT_VALUE', "Default values of an optional paramet
er must be constant"); | 1918 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = |
| 1919 const CompileTimeErrorCode( |
| 1920 'NON_CONSTANT_DEFAULT_VALUE', |
| 1921 "Default values of an optional parameter must be constant"); |
1574 | 1922 |
1575 /** | 1923 /** |
1576 * 6.2.2 Optional Formals: It is a compile-time error if the default value of | 1924 * 6.2.2 Optional Formals: It is a compile-time error if the default value of |
1577 * an optional parameter is not a compile-time constant. | 1925 * an optional parameter is not a compile-time constant. |
1578 * | 1926 * |
1579 * 12.1 Constants: A qualified reference to a static constant variable that is | 1927 * 12.1 Constants: A qualified reference to a static constant variable that is |
1580 * not qualified by a deferred prefix. | 1928 * not qualified by a deferred prefix. |
1581 */ | 1929 */ |
1582 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIB
RARY = const CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBR
ARY', "Constant values from a deferred library cannot be used as a default param
eter value"); | 1930 static const CompileTimeErrorCode |
| 1931 NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY = |
| 1932 const CompileTimeErrorCode( |
| 1933 'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY', |
| 1934 "Constant values from a deferred library cannot be used as a default p
arameter value"); |
1583 | 1935 |
1584 /** | 1936 /** |
1585 * 12.6 Lists: It is a compile time error if an element of a constant list | 1937 * 12.6 Lists: It is a compile time error if an element of a constant list |
1586 * literal is not a compile-time constant. | 1938 * literal is not a compile-time constant. |
1587 */ | 1939 */ |
1588 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = const CompileTim
eErrorCode('NON_CONSTANT_LIST_ELEMENT', "'const' lists must have all constant va
lues"); | 1940 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = |
| 1941 const CompileTimeErrorCode( |
| 1942 'NON_CONSTANT_LIST_ELEMENT', |
| 1943 "'const' lists must have all constant values"); |
1589 | 1944 |
1590 /** | 1945 /** |
1591 * 12.6 Lists: It is a compile time error if an element of a constant list | 1946 * 12.6 Lists: It is a compile time error if an element of a constant list |
1592 * literal is not a compile-time constant. | 1947 * literal is not a compile-time constant. |
1593 * | 1948 * |
1594 * 12.1 Constants: A qualified reference to a static constant variable that is | 1949 * 12.1 Constants: A qualified reference to a static constant variable that is |
1595 * not qualified by a deferred prefix. | 1950 * not qualified by a deferred prefix. |
1596 */ | 1951 */ |
1597 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBR
ARY = const CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRAR
Y', "Constant values from a deferred library cannot be used as values in a 'cons
t' list"); | 1952 static const CompileTimeErrorCode |
| 1953 NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY = |
| 1954 const CompileTimeErrorCode( |
| 1955 'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY', |
| 1956 "Constant values from a deferred library cannot be used as values in a
'const' list"); |
1598 | 1957 |
1599 /** | 1958 /** |
1600 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1959 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1601 * entry in a constant map literal is not a compile-time constant. | 1960 * entry in a constant map literal is not a compile-time constant. |
1602 */ | 1961 */ |
1603 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = const CompileTimeErro
rCode('NON_CONSTANT_MAP_KEY', "The keys in a map must be constant"); | 1962 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = |
| 1963 const CompileTimeErrorCode( |
| 1964 'NON_CONSTANT_MAP_KEY', |
| 1965 "The keys in a map must be constant"); |
1604 | 1966 |
1605 /** | 1967 /** |
1606 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1968 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1607 * entry in a constant map literal is not a compile-time constant. | 1969 * entry in a constant map literal is not a compile-time constant. |
1608 * | 1970 * |
1609 * 12.1 Constants: A qualified reference to a static constant variable that is | 1971 * 12.1 Constants: A qualified reference to a static constant variable that is |
1610 * not qualified by a deferred prefix. | 1972 * not qualified by a deferred prefix. |
1611 */ | 1973 */ |
1612 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode('NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY', "Const
ant values from a deferred library cannot be used as keys in a map"); | 1974 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY = |
| 1975 const CompileTimeErrorCode( |
| 1976 'NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY', |
| 1977 "Constant values from a deferred library cannot be used as keys in a m
ap"); |
1613 | 1978 |
1614 /** | 1979 /** |
1615 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1980 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1616 * entry in a constant map literal is not a compile-time constant. | 1981 * entry in a constant map literal is not a compile-time constant. |
1617 */ | 1982 */ |
1618 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = const CompileTimeEr
rorCode('NON_CONSTANT_MAP_VALUE', "The values in a 'const' map must be constant"
); | 1983 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = |
| 1984 const CompileTimeErrorCode( |
| 1985 'NON_CONSTANT_MAP_VALUE', |
| 1986 "The values in a 'const' map must be constant"); |
1619 | 1987 |
1620 /** | 1988 /** |
1621 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1989 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1622 * entry in a constant map literal is not a compile-time constant. | 1990 * entry in a constant map literal is not a compile-time constant. |
1623 * | 1991 * |
1624 * 12.1 Constants: A qualified reference to a static constant variable that is | 1992 * 12.1 Constants: A qualified reference to a static constant variable that is |
1625 * not qualified by a deferred prefix. | 1993 * not qualified by a deferred prefix. |
1626 */ | 1994 */ |
1627 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY
= const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY', "C
onstant values from a deferred library cannot be used as values in a 'const' map
"); | 1995 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY |
| 1996 = |
| 1997 const CompileTimeErrorCode( |
| 1998 'NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY', |
| 1999 "Constant values from a deferred library cannot be used as values in a
'const' map"); |
1628 | 2000 |
1629 /** | 2001 /** |
1630 * 11 Metadata: Metadata consists of a series of annotations, each of which | 2002 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1631 * begin with the character @, followed by a constant expression that must be | 2003 * begin with the character @, followed by a constant expression that must be |
1632 * either a reference to a compile-time constant variable, or a call to a | 2004 * either a reference to a compile-time constant variable, or a call to a |
1633 * constant constructor. | 2005 * constant constructor. |
1634 * | 2006 * |
1635 * "From deferred library" case is covered by | 2007 * "From deferred library" case is covered by |
1636 * [CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY]. | 2008 * [CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY]. |
1637 */ | 2009 */ |
1638 static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = const
CompileTimeErrorCode('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', "Annotation creation
can use only 'const' constructor"); | 2010 static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = |
| 2011 const CompileTimeErrorCode( |
| 2012 'NON_CONSTANT_ANNOTATION_CONSTRUCTOR', |
| 2013 "Annotation creation can use only 'const' constructor"); |
1639 | 2014 |
1640 /** | 2015 /** |
1641 * 7.6.3 Constant Constructors: Any expression that appears within the | 2016 * 7.6.3 Constant Constructors: Any expression that appears within the |
1642 * initializer list of a constant constructor must be a potentially constant | 2017 * initializer list of a constant constructor must be a potentially constant |
1643 * expression, or a compile-time error occurs. | 2018 * expression, or a compile-time error occurs. |
1644 */ | 2019 */ |
1645 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = const Co
mpileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', "Initializer expressions
in constant constructors must be constants"); | 2020 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = |
| 2021 const CompileTimeErrorCode( |
| 2022 'NON_CONSTANT_VALUE_IN_INITIALIZER', |
| 2023 "Initializer expressions in constant constructors must be constants"); |
1646 | 2024 |
1647 /** | 2025 /** |
1648 * 7.6.3 Constant Constructors: Any expression that appears within the | 2026 * 7.6.3 Constant Constructors: Any expression that appears within the |
1649 * initializer list of a constant constructor must be a potentially constant | 2027 * initializer list of a constant constructor must be a potentially constant |
1650 * expression, or a compile-time error occurs. | 2028 * expression, or a compile-time error occurs. |
1651 * | 2029 * |
1652 * 12.1 Constants: A qualified reference to a static constant variable that is | 2030 * 12.1 Constants: A qualified reference to a static constant variable that is |
1653 * not qualified by a deferred prefix. | 2031 * not qualified by a deferred prefix. |
1654 */ | 2032 */ |
1655 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFER
RED_LIBRARY = const CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER_FROM
_DEFERRED_LIBRARY', "Constant values from a deferred library cannot be used as c
onstant initializers"); | 2033 static const CompileTimeErrorCode |
| 2034 NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY = |
| 2035 const CompileTimeErrorCode( |
| 2036 'NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY', |
| 2037 "Constant values from a deferred library cannot be used as constant in
itializers"); |
1656 | 2038 |
1657 /** | 2039 /** |
1658 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> | 2040 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> |
1659 * or if <i>m > n</i>. | 2041 * or if <i>m > n</i>. |
1660 * | 2042 * |
1661 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 2043 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
1662 * object results in an uncaught exception being thrown. | 2044 * object results in an uncaught exception being thrown. |
1663 * | 2045 * |
1664 * @param requiredCount the expected number of required arguments | 2046 * @param requiredCount the expected number of required arguments |
1665 * @param argumentCount the actual number of positional arguments given | 2047 * @param argumentCount the actual number of positional arguments given |
1666 */ | 2048 */ |
1667 static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const Compil
eTimeErrorCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', "{0} required argument(s) expect
ed, but {1} found"); | 2049 static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = |
| 2050 const CompileTimeErrorCode( |
| 2051 'NOT_ENOUGH_REQUIRED_ARGUMENTS', |
| 2052 "{0} required argument(s) expected, but {1} found"); |
1668 | 2053 |
1669 /** | 2054 /** |
1670 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the | 2055 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the |
1671 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. | 2056 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. |
1672 * Let <i>k</i> be a generative constructor. It is a compile-time error if | 2057 * Let <i>k</i> be a generative constructor. It is a compile-time error if |
1673 * class <i>S</i> does not declare a generative constructor named <i>S</i> | 2058 * class <i>S</i> does not declare a generative constructor named <i>S</i> |
1674 * (respectively <i>S.id</i>) | 2059 * (respectively <i>S.id</i>) |
1675 */ | 2060 */ |
1676 static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = const CompileTi
meErrorCode('NON_GENERATIVE_CONSTRUCTOR', "The generative constructor '{0}' expe
cted, but factory found"); | 2061 static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = |
| 2062 const CompileTimeErrorCode( |
| 2063 'NON_GENERATIVE_CONSTRUCTOR', |
| 2064 "The generative constructor '{0}' expected, but factory found"); |
1677 | 2065 |
1678 /** | 2066 /** |
1679 * 7.9 Superclasses: It is a compile-time error to specify an extends clause | 2067 * 7.9 Superclasses: It is a compile-time error to specify an extends clause |
1680 * for class Object. | 2068 * for class Object. |
1681 */ | 2069 */ |
1682 static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = const C
ompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', ""); | 2070 static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = |
| 2071 const CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', ""); |
1683 | 2072 |
1684 /** | 2073 /** |
1685 * 7.1.1 Operators: It is a compile-time error to declare an optional | 2074 * 7.1.1 Operators: It is a compile-time error to declare an optional |
1686 * parameter in an operator. | 2075 * parameter in an operator. |
1687 */ | 2076 */ |
1688 static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = const Compi
leTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', "Optional parameters are not a
llowed when defining an operator"); | 2077 static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = |
| 2078 const CompileTimeErrorCode( |
| 2079 'OPTIONAL_PARAMETER_IN_OPERATOR', |
| 2080 "Optional parameters are not allowed when defining an operator"); |
1689 | 2081 |
1690 /** | 2082 /** |
1691 * 14.3 Parts: It is a compile time error if the contents of the URI are not a | 2083 * 14.3 Parts: It is a compile time error if the contents of the URI are not a |
1692 * valid part declaration. | 2084 * valid part declaration. |
1693 * | 2085 * |
1694 * @param uri the uri pointing to a non-library declaration | 2086 * @param uri the uri pointing to a non-library declaration |
1695 */ | 2087 */ |
1696 static const CompileTimeErrorCode PART_OF_NON_PART = const CompileTimeErrorCod
e('PART_OF_NON_PART', "The included part '{0}' must have a part-of directive"); | 2088 static const CompileTimeErrorCode PART_OF_NON_PART = |
| 2089 const CompileTimeErrorCode( |
| 2090 'PART_OF_NON_PART', |
| 2091 "The included part '{0}' must have a part-of directive"); |
1697 | 2092 |
1698 /** | 2093 /** |
1699 * 14.1 Imports: It is a compile-time error if the current library declares a | 2094 * 14.1 Imports: It is a compile-time error if the current library declares a |
1700 * top-level member named <i>p</i>. | 2095 * top-level member named <i>p</i>. |
1701 */ | 2096 */ |
1702 static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = cons
t CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', "The name '{0}'
is already used as an import prefix and cannot be used to name a top-level eleme
nt"); | 2097 static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = |
| 2098 const CompileTimeErrorCode( |
| 2099 'PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', |
| 2100 "The name '{0}' is already used as an import prefix and cannot be used
to name a top-level element"); |
1703 | 2101 |
1704 /** | 2102 /** |
1705 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named | 2103 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named |
1706 * optional parameter begins with an '_' character. | 2104 * optional parameter begins with an '_' character. |
1707 */ | 2105 */ |
1708 static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = const CompileTi
meErrorCode('PRIVATE_OPTIONAL_PARAMETER', "Named optional parameters cannot star
t with an underscore"); | 2106 static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = |
| 2107 const CompileTimeErrorCode( |
| 2108 'PRIVATE_OPTIONAL_PARAMETER', |
| 2109 "Named optional parameters cannot start with an underscore"); |
1709 | 2110 |
1710 /** | 2111 /** |
1711 * 12.1 Constants: It is a compile-time error if the value of a compile-time | 2112 * 12.1 Constants: It is a compile-time error if the value of a compile-time |
1712 * constant expression depends on itself. | 2113 * constant expression depends on itself. |
1713 */ | 2114 */ |
1714 static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = const Comp
ileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', ""); | 2115 static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = |
| 2116 const CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', ""); |
1715 | 2117 |
1716 /** | 2118 /** |
1717 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 2119 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
1718 * in which case its only action is to invoke another generative constructor. | 2120 * in which case its only action is to invoke another generative constructor. |
1719 * | 2121 * |
1720 * TODO(scheglov) review this later, there are no explicit "it is a | 2122 * TODO(scheglov) review this later, there are no explicit "it is a |
1721 * compile-time error" in specification. But it was added to the co19 and | 2123 * compile-time error" in specification. But it was added to the co19 and |
1722 * there is same error for factories. | 2124 * there is same error for factories. |
1723 * | 2125 * |
1724 * https://code.google.com/p/dart/issues/detail?id=954 | 2126 * https://code.google.com/p/dart/issues/detail?id=954 |
1725 */ | 2127 */ |
1726 static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = const Compi
leTimeErrorCode('RECURSIVE_CONSTRUCTOR_REDIRECT', "Cycle in redirecting generati
ve constructors"); | 2128 static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = |
| 2129 const CompileTimeErrorCode( |
| 2130 'RECURSIVE_CONSTRUCTOR_REDIRECT', |
| 2131 "Cycle in redirecting generative constructors"); |
1727 | 2132 |
1728 /** | 2133 /** |
1729 * 7.6.2 Factories: It is a compile-time error if a redirecting factory | 2134 * 7.6.2 Factories: It is a compile-time error if a redirecting factory |
1730 * constructor redirects to itself, either directly or indirectly via a | 2135 * constructor redirects to itself, either directly or indirectly via a |
1731 * sequence of redirections. | 2136 * sequence of redirections. |
1732 */ | 2137 */ |
1733 static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = const CompileTi
meErrorCode('RECURSIVE_FACTORY_REDIRECT', "Cycle in redirecting factory construc
tors"); | 2138 static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = |
| 2139 const CompileTimeErrorCode( |
| 2140 'RECURSIVE_FACTORY_REDIRECT', |
| 2141 "Cycle in redirecting factory constructors"); |
1734 | 2142 |
1735 /** | 2143 /** |
1736 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 2144 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
1737 * class <i>C</i> is a superinterface of itself. | 2145 * class <i>C</i> is a superinterface of itself. |
1738 * | 2146 * |
1739 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 2147 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
1740 * superinterface of itself. | 2148 * superinterface of itself. |
1741 * | 2149 * |
1742 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 2150 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
1743 * superclass of itself. | 2151 * superclass of itself. |
1744 * | 2152 * |
1745 * @param className the name of the class that implements itself recursively | 2153 * @param className the name of the class that implements itself recursively |
1746 * @param strImplementsPath a string representation of the implements loop | 2154 * @param strImplementsPath a string representation of the implements loop |
1747 */ | 2155 */ |
1748 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = const Comp
ileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', "'{0}' cannot be a superinte
rface of itself: {1}"); | 2156 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = |
| 2157 const CompileTimeErrorCode( |
| 2158 'RECURSIVE_INTERFACE_INHERITANCE', |
| 2159 "'{0}' cannot be a superinterface of itself: {1}"); |
1749 | 2160 |
1750 /** | 2161 /** |
1751 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 2162 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
1752 * class <i>C</i> is a superinterface of itself. | 2163 * class <i>C</i> is a superinterface of itself. |
1753 * | 2164 * |
1754 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 2165 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
1755 * superinterface of itself. | 2166 * superinterface of itself. |
1756 * | 2167 * |
1757 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 2168 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
1758 * superclass of itself. | 2169 * superclass of itself. |
1759 * | 2170 * |
1760 * @param className the name of the class that implements itself recursively | 2171 * @param className the name of the class that implements itself recursively |
1761 */ | 2172 */ |
1762 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EX
TENDS = const CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EX
TENDS', "'{0}' cannot extend itself"); | 2173 static const CompileTimeErrorCode |
| 2174 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS = |
| 2175 const CompileTimeErrorCode( |
| 2176 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', |
| 2177 "'{0}' cannot extend itself"); |
1763 | 2178 |
1764 /** | 2179 /** |
1765 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 2180 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
1766 * class <i>C</i> is a superinterface of itself. | 2181 * class <i>C</i> is a superinterface of itself. |
1767 * | 2182 * |
1768 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 2183 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
1769 * superinterface of itself. | 2184 * superinterface of itself. |
1770 * | 2185 * |
1771 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 2186 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
1772 * superclass of itself. | 2187 * superclass of itself. |
1773 * | 2188 * |
1774 * @param className the name of the class that implements itself recursively | 2189 * @param className the name of the class that implements itself recursively |
1775 */ | 2190 */ |
1776 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IM
PLEMENTS = const CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_IMPLEMENTS', "'{0}' cannot implement itself"); | 2191 static const CompileTimeErrorCode |
| 2192 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS = |
| 2193 const CompileTimeErrorCode( |
| 2194 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', |
| 2195 "'{0}' cannot implement itself"); |
1777 | 2196 |
1778 /** | 2197 /** |
1779 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 2198 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
1780 * class <i>C</i> is a superinterface of itself. | 2199 * class <i>C</i> is a superinterface of itself. |
1781 * | 2200 * |
1782 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 2201 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
1783 * superinterface of itself. | 2202 * superinterface of itself. |
1784 * | 2203 * |
1785 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 2204 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
1786 * superclass of itself. | 2205 * superclass of itself. |
1787 * | 2206 * |
1788 * @param className the name of the class that implements itself recursively | 2207 * @param className the name of the class that implements itself recursively |
1789 */ | 2208 */ |
1790 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WI
TH = const CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH'
, "'{0}' cannot use itself as a mixin"); | 2209 static const CompileTimeErrorCode |
| 2210 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH = |
| 2211 const CompileTimeErrorCode( |
| 2212 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH', |
| 2213 "'{0}' cannot use itself as a mixin"); |
1791 | 2214 |
1792 /** | 2215 /** |
1793 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with | 2216 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with |
1794 * the const modifier but <i>k'</i> is not a constant constructor. | 2217 * the const modifier but <i>k'</i> is not a constant constructor. |
1795 */ | 2218 */ |
1796 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = const Comp
ileTimeErrorCode('REDIRECT_TO_MISSING_CONSTRUCTOR', "The constructor '{0}' could
not be found in '{1}'"); | 2219 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = |
| 2220 const CompileTimeErrorCode( |
| 2221 'REDIRECT_TO_MISSING_CONSTRUCTOR', |
| 2222 "The constructor '{0}' could not be found in '{1}'"); |
1797 | 2223 |
1798 /** | 2224 /** |
1799 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with | 2225 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with |
1800 * the const modifier but <i>k'</i> is not a constant constructor. | 2226 * the const modifier but <i>k'</i> is not a constant constructor. |
1801 */ | 2227 */ |
1802 static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS = const CompileTimeErr
orCode('REDIRECT_TO_NON_CLASS', "The name '{0}' is not a type and cannot be used
in a redirected constructor"); | 2228 static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS = |
| 2229 const CompileTimeErrorCode( |
| 2230 'REDIRECT_TO_NON_CLASS', |
| 2231 "The name '{0}' is not a type and cannot be used in a redirected const
ructor"); |
1803 | 2232 |
1804 /** | 2233 /** |
1805 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with | 2234 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with |
1806 * the const modifier but <i>k'</i> is not a constant constructor. | 2235 * the const modifier but <i>k'</i> is not a constant constructor. |
1807 */ | 2236 */ |
1808 static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = const Co
mpileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', "Constant factory constr
uctor cannot delegate to a non-constant constructor"); | 2237 static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = |
| 2238 const CompileTimeErrorCode( |
| 2239 'REDIRECT_TO_NON_CONST_CONSTRUCTOR', |
| 2240 "Constant factory constructor cannot delegate to a non-constant constr
uctor"); |
1809 | 2241 |
1810 /** | 2242 /** |
1811 * 7.6.1 Generative constructors: A generative constructor may be | 2243 * 7.6.1 Generative constructors: A generative constructor may be |
1812 * <i>redirecting</i>, in which case its only action is to invoke another | 2244 * <i>redirecting</i>, in which case its only action is to invoke another |
1813 * generative constructor. | 2245 * generative constructor. |
1814 */ | 2246 */ |
1815 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR =
const CompileTimeErrorCode('REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR', "The c
onstructor '{0}' could not be found in '{1}'"); | 2247 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR = |
| 2248 const CompileTimeErrorCode( |
| 2249 'REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR', |
| 2250 "The constructor '{0}' could not be found in '{1}'"); |
1816 | 2251 |
1817 /** | 2252 /** |
1818 * 7.6.1 Generative constructors: A generative constructor may be | 2253 * 7.6.1 Generative constructors: A generative constructor may be |
1819 * <i>redirecting</i>, in which case its only action is to invoke another | 2254 * <i>redirecting</i>, in which case its only action is to invoke another |
1820 * generative constructor. | 2255 * generative constructor. |
1821 */ | 2256 */ |
1822 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTR
UCTOR = const CompileTimeErrorCode('REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTR
UCTOR', "Generative constructor cannot redirect to a factory constructor"); | 2257 static const CompileTimeErrorCode |
| 2258 REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR = |
| 2259 const CompileTimeErrorCode( |
| 2260 'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR', |
| 2261 "Generative constructor cannot redirect to a factory constructor"); |
1823 | 2262 |
1824 /** | 2263 /** |
1825 * 5 Variables: A local variable may only be referenced at a source code | 2264 * 5 Variables: A local variable may only be referenced at a source code |
1826 * location that is after its initializer, if any, is complete, or a | 2265 * location that is after its initializer, if any, is complete, or a |
1827 * compile-time error occurs. | 2266 * compile-time error occurs. |
1828 */ | 2267 */ |
1829 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = const Compil
eTimeErrorCode('REFERENCED_BEFORE_DECLARATION', "Local variables cannot be refer
enced before they are declared"); | 2268 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = |
| 2269 const CompileTimeErrorCode( |
| 2270 'REFERENCED_BEFORE_DECLARATION', |
| 2271 "Local variables cannot be referenced before they are declared"); |
1830 | 2272 |
1831 /** | 2273 /** |
1832 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form | 2274 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form |
1833 * <i>rethrow;</i> is not enclosed within a on-catch clause. | 2275 * <i>rethrow;</i> is not enclosed within a on-catch clause. |
1834 */ | 2276 */ |
1835 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = const CompileTimeErr
orCode('RETHROW_OUTSIDE_CATCH', "rethrow must be inside of a catch clause"); | 2277 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = |
| 2278 const CompileTimeErrorCode( |
| 2279 'RETHROW_OUTSIDE_CATCH', |
| 2280 "rethrow must be inside of a catch clause"); |
1836 | 2281 |
1837 /** | 2282 /** |
1838 * 13.12 Return: It is a compile-time error if a return statement of the form | 2283 * 13.12 Return: It is a compile-time error if a return statement of the form |
1839 * <i>return e;</i> appears in a generative constructor. | 2284 * <i>return e;</i> appears in a generative constructor. |
1840 */ | 2285 */ |
1841 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = const Com
pileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', "Constructors cannot retur
n a value"); | 2286 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = |
| 2287 const CompileTimeErrorCode( |
| 2288 'RETURN_IN_GENERATIVE_CONSTRUCTOR', |
| 2289 "Constructors cannot return a value"); |
1842 | 2290 |
1843 /** | 2291 /** |
1844 * 13.12 Return: It is a compile-time error if a return statement of the form | 2292 * 13.12 Return: It is a compile-time error if a return statement of the form |
1845 * <i>return e;</i> appears in a generator function. | 2293 * <i>return e;</i> appears in a generator function. |
1846 */ | 2294 */ |
1847 static const CompileTimeErrorCode RETURN_IN_GENERATOR = const CompileTimeError
Code('RETURN_IN_GENERATOR', "Cannot return a value from a generator function (on
e marked with either 'async*' or 'sync*')"); | 2295 static const CompileTimeErrorCode RETURN_IN_GENERATOR = |
| 2296 const CompileTimeErrorCode( |
| 2297 'RETURN_IN_GENERATOR', |
| 2298 "Cannot return a value from a generator function (one marked with eith
er 'async*' or 'sync*')"); |
1848 | 2299 |
1849 /** | 2300 /** |
1850 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred | 2301 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred |
1851 * import is used in another import clause. | 2302 * import is used in another import clause. |
1852 */ | 2303 */ |
1853 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = const CompileTimeEr
rorCode('SHARED_DEFERRED_PREFIX', "The prefix of a deferred import cannot be use
d in other import directives"); | 2304 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = |
| 2305 const CompileTimeErrorCode( |
| 2306 'SHARED_DEFERRED_PREFIX', |
| 2307 "The prefix of a deferred import cannot be used in other import direct
ives"); |
1854 | 2308 |
1855 /** | 2309 /** |
1856 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 2310 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
1857 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 2311 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
1858 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 2312 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
1859 * compile-time error if a super method invocation occurs in a top-level | 2313 * compile-time error if a super method invocation occurs in a top-level |
1860 * function or variable initializer, in an instance variable initializer or | 2314 * function or variable initializer, in an instance variable initializer or |
1861 * initializer list, in class Object, in a factory constructor, or in a static | 2315 * initializer list, in class Object, in a factory constructor, or in a static |
1862 * method or variable initializer. | 2316 * method or variable initializer. |
1863 */ | 2317 */ |
1864 static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = const CompileTime
ErrorCode('SUPER_IN_INVALID_CONTEXT', "Invalid context for 'super' invocation"); | 2318 static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = |
| 2319 const CompileTimeErrorCode( |
| 2320 'SUPER_IN_INVALID_CONTEXT', |
| 2321 "Invalid context for 'super' invocation"); |
1865 | 2322 |
1866 /** | 2323 /** |
1867 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 2324 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
1868 * in which case its only action is to invoke another generative constructor. | 2325 * in which case its only action is to invoke another generative constructor. |
1869 */ | 2326 */ |
1870 static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = const Com
pileTimeErrorCode('SUPER_IN_REDIRECTING_CONSTRUCTOR', "The redirecting construct
or cannot have a 'super' initializer"); | 2327 static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = |
| 2328 const CompileTimeErrorCode( |
| 2329 'SUPER_IN_REDIRECTING_CONSTRUCTOR', |
| 2330 "The redirecting constructor cannot have a 'super' initializer"); |
1871 | 2331 |
1872 /** | 2332 /** |
1873 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 2333 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1874 * is a compile-time error if a generative constructor of class Object | 2334 * is a compile-time error if a generative constructor of class Object |
1875 * includes a superinitializer. | 2335 * includes a superinitializer. |
1876 */ | 2336 */ |
1877 static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = const CompileT
imeErrorCode('SUPER_INITIALIZER_IN_OBJECT', ""); | 2337 static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = |
| 2338 const CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', ""); |
1878 | 2339 |
1879 /** | 2340 /** |
1880 * 12.11 Instance Creation: It is a static type warning if any of the type | 2341 * 12.11 Instance Creation: It is a static type warning if any of the type |
1881 * arguments to a constructor of a generic type <i>G</i> invoked by a new | 2342 * arguments to a constructor of a generic type <i>G</i> invoked by a new |
1882 * expression or a constant object expression are not subtypes of the bounds | 2343 * expression or a constant object expression are not subtypes of the bounds |
1883 * of the corresponding formal type parameters of <i>G</i>. | 2344 * of the corresponding formal type parameters of <i>G</i>. |
1884 * | 2345 * |
1885 * 12.11.1 New: If T is malformed a dynamic error occurs. In checked mode, if | 2346 * 12.11.1 New: If T is malformed a dynamic error occurs. In checked mode, if |
1886 * T is mal-bounded a dynamic error occurs. | 2347 * T is mal-bounded a dynamic error occurs. |
1887 * | 2348 * |
1888 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time | 2349 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time |
1889 * constant would raise an exception. | 2350 * constant would raise an exception. |
1890 * | 2351 * |
1891 * @param boundedTypeName the name of the type used in the instance creation | 2352 * @param boundedTypeName the name of the type used in the instance creation |
1892 * that should be limited by the bound as specified in the class | 2353 * that should be limited by the bound as specified in the class |
1893 * declaration | 2354 * declaration |
1894 * @param boundingTypeName the name of the bounding type | 2355 * @param boundingTypeName the name of the bounding type |
1895 * See [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. | 2356 * See [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. |
1896 */ | 2357 */ |
1897 static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const Co
mpileTimeErrorCode('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' does not extend '
{1}'"); | 2358 static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = |
| 2359 const CompileTimeErrorCode( |
| 2360 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', |
| 2361 "'{0}' does not extend '{1}'"); |
1898 | 2362 |
1899 /** | 2363 /** |
1900 * 15.3.1 Typedef: Any self reference, either directly, or recursively via | 2364 * 15.3.1 Typedef: Any self reference, either directly, or recursively via |
1901 * another typedef, is a compile time error. | 2365 * another typedef, is a compile time error. |
1902 */ | 2366 */ |
1903 static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = const C
ompileTimeErrorCode('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', "Type alias cannot ref
erence itself directly or recursively via another typedef"); | 2367 static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = |
| 2368 const CompileTimeErrorCode( |
| 2369 'TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', |
| 2370 "Type alias cannot reference itself directly or recursively via anothe
r typedef"); |
1904 | 2371 |
1905 /** | 2372 /** |
1906 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class | 2373 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class |
1907 * accessible in the current scope, optionally followed by type arguments. | 2374 * accessible in the current scope, optionally followed by type arguments. |
1908 */ | 2375 */ |
1909 static const CompileTimeErrorCode UNDEFINED_CLASS = const CompileTimeErrorCode
('UNDEFINED_CLASS', "Undefined class '{0}'"); | 2376 static const CompileTimeErrorCode UNDEFINED_CLASS = |
| 2377 const CompileTimeErrorCode('UNDEFINED_CLASS', "Undefined class '{0}'"); |
1910 | 2378 |
1911 /** | 2379 /** |
1912 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the | 2380 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the |
1913 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. | 2381 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. |
1914 * Let <i>k</i> be a generative constructor. It is a compile-time error if | 2382 * Let <i>k</i> be a generative constructor. It is a compile-time error if |
1915 * class <i>S</i> does not declare a generative constructor named <i>S</i> | 2383 * class <i>S</i> does not declare a generative constructor named <i>S</i> |
1916 * (respectively <i>S.id</i>) | 2384 * (respectively <i>S.id</i>) |
1917 */ | 2385 */ |
1918 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = const
CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', "The class '{0}' d
oes not have a generative constructor '{1}'"); | 2386 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = |
| 2387 const CompileTimeErrorCode( |
| 2388 'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', |
| 2389 "The class '{0}' does not have a generative constructor '{1}'"); |
1919 | 2390 |
1920 /** | 2391 /** |
1921 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the | 2392 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the |
1922 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. | 2393 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. |
1923 * Let <i>k</i> be a generative constructor. It is a compile-time error if | 2394 * Let <i>k</i> be a generative constructor. It is a compile-time error if |
1924 * class <i>S</i> does not declare a generative constructor named <i>S</i> | 2395 * class <i>S</i> does not declare a generative constructor named <i>S</i> |
1925 * (respectively <i>S.id</i>) | 2396 * (respectively <i>S.id</i>) |
1926 */ | 2397 */ |
1927 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT
= const CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', "T
he class '{0}' does not have a default generative constructor"); | 2398 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT |
| 2399 = |
| 2400 const CompileTimeErrorCode( |
| 2401 'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', |
| 2402 "The class '{0}' does not have a default generative constructor"); |
1928 | 2403 |
1929 /** | 2404 /** |
1930 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, | 2405 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, |
1931 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set | 2406 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set |
1932 * {<i>p<sub>n+1</sub></i> ... <i>p<sub>n+k</sub></i>} or a static warning | 2407 * {<i>p<sub>n+1</sub></i> ... <i>p<sub>n+k</sub></i>} or a static warning |
1933 * occurs. | 2408 * occurs. |
1934 * | 2409 * |
1935 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 2410 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
1936 * object results in an uncaught exception being thrown. | 2411 * object results in an uncaught exception being thrown. |
1937 * | 2412 * |
1938 * @param name the name of the requested named parameter | 2413 * @param name the name of the requested named parameter |
1939 */ | 2414 */ |
1940 static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = const CompileTim
eErrorCode('UNDEFINED_NAMED_PARAMETER', "The named parameter '{0}' is not define
d"); | 2415 static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = |
| 2416 const CompileTimeErrorCode( |
| 2417 'UNDEFINED_NAMED_PARAMETER', |
| 2418 "The named parameter '{0}' is not defined"); |
1941 | 2419 |
1942 /** | 2420 /** |
1943 * 14.2 Exports: It is a compile-time error if the compilation unit found at | 2421 * 14.2 Exports: It is a compile-time error if the compilation unit found at |
1944 * the specified URI is not a library declaration. | 2422 * the specified URI is not a library declaration. |
1945 * | 2423 * |
1946 * 14.1 Imports: It is a compile-time error if the compilation unit found at | 2424 * 14.1 Imports: It is a compile-time error if the compilation unit found at |
1947 * the specified URI is not a library declaration. | 2425 * the specified URI is not a library declaration. |
1948 * | 2426 * |
1949 * 14.3 Parts: It is a compile time error if the contents of the URI are not a | 2427 * 14.3 Parts: It is a compile time error if the contents of the URI are not a |
1950 * valid part declaration. | 2428 * valid part declaration. |
1951 * | 2429 * |
1952 * @param uri the URI pointing to a non-existent file | 2430 * @param uri the URI pointing to a non-existent file |
1953 * See [INVALID_URI]. | 2431 * See [INVALID_URI]. |
1954 */ | 2432 */ |
1955 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = const CompileTimeErrorC
ode('URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0}'"); | 2433 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = |
| 2434 const CompileTimeErrorCode( |
| 2435 'URI_DOES_NOT_EXIST', |
| 2436 "Target of URI does not exist: '{0}'"); |
1956 | 2437 |
1957 /** | 2438 /** |
1958 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time | 2439 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time |
1959 * constant, or if <i>x</i> involves string interpolation. | 2440 * constant, or if <i>x</i> involves string interpolation. |
1960 * | 2441 * |
1961 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time | 2442 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time |
1962 * constant, or if <i>s</i> involves string interpolation. | 2443 * constant, or if <i>s</i> involves string interpolation. |
1963 * | 2444 * |
1964 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that | 2445 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that |
1965 * describes a URI is not a compile-time constant, or if <i>x</i> involves | 2446 * describes a URI is not a compile-time constant, or if <i>x</i> involves |
1966 * string interpolation. | 2447 * string interpolation. |
1967 */ | 2448 */ |
1968 static const CompileTimeErrorCode URI_WITH_INTERPOLATION = const CompileTimeEr
rorCode('URI_WITH_INTERPOLATION', "URIs cannot use string interpolation"); | 2449 static const CompileTimeErrorCode URI_WITH_INTERPOLATION = |
| 2450 const CompileTimeErrorCode( |
| 2451 'URI_WITH_INTERPOLATION', |
| 2452 "URIs cannot use string interpolation"); |
1969 | 2453 |
1970 /** | 2454 /** |
1971 * 7.1.1 Operators: It is a compile-time error if the arity of the | 2455 * 7.1.1 Operators: It is a compile-time error if the arity of the |
1972 * user-declared operator []= is not 2. It is a compile time error if the | 2456 * user-declared operator []= is not 2. It is a compile time error if the |
1973 * arity of a user-declared operator with one of the names: <, >, <=, | 2457 * arity of a user-declared operator with one of the names: <, >, <=, |
1974 * >=, ==, +, /, ~/, *, %, |, ^, &, <<, >>, [] is not 1. It is | 2458 * >=, ==, +, /, ~/, *, %, |, ^, &, <<, >>, [] is not 1. It is |
1975 * a compile time error if the arity of the user-declared operator - is not 0 | 2459 * a compile time error if the arity of the user-declared operator - is not 0 |
1976 * or 1. It is a compile time error if the arity of the user-declared operator | 2460 * or 1. It is a compile time error if the arity of the user-declared operator |
1977 * ~ is not 0. | 2461 * ~ is not 0. |
1978 * | 2462 * |
1979 * @param operatorName the name of the declared operator | 2463 * @param operatorName the name of the declared operator |
1980 * @param expectedNumberOfParameters the number of parameters expected | 2464 * @param expectedNumberOfParameters the number of parameters expected |
1981 * @param actualNumberOfParameters the number of parameters found in the | 2465 * @param actualNumberOfParameters the number of parameters found in the |
1982 * operator declaration | 2466 * operator declaration |
1983 */ | 2467 */ |
1984 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = co
nst CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', "Operator '{
0}' should declare exactly {1} parameter(s), but {2} found"); | 2468 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = |
| 2469 const CompileTimeErrorCode( |
| 2470 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', |
| 2471 "Operator '{0}' should declare exactly {1} parameter(s), but {2} found
"); |
1985 | 2472 |
1986 /** | 2473 /** |
1987 * 7.1.1 Operators: It is a compile time error if the arity of the | 2474 * 7.1.1 Operators: It is a compile time error if the arity of the |
1988 * user-declared operator - is not 0 or 1. | 2475 * user-declared operator - is not 0 or 1. |
1989 * | 2476 * |
1990 * @param actualNumberOfParameters the number of parameters found in the | 2477 * @param actualNumberOfParameters the number of parameters found in the |
1991 * operator declaration | 2478 * operator declaration |
1992 */ | 2479 */ |
1993 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINU
S = const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS',
"Operator '-' should declare 0 or 1 parameter, but {0} found"); | 2480 static const CompileTimeErrorCode |
| 2481 WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS = |
| 2482 const CompileTimeErrorCode( |
| 2483 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS', |
| 2484 "Operator '-' should declare 0 or 1 parameter, but {0} found"); |
1994 | 2485 |
1995 /** | 2486 /** |
1996 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list | 2487 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list |
1997 * does not include exactly one required formal parameter <i>p</i>. | 2488 * does not include exactly one required formal parameter <i>p</i>. |
1998 */ | 2489 */ |
1999 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = cons
t CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', "Setters should
declare exactly one required parameter"); | 2490 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = |
| 2491 const CompileTimeErrorCode( |
| 2492 'WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', |
| 2493 "Setters should declare exactly one required parameter"); |
2000 | 2494 |
2001 /** | 2495 /** |
2002 * ?? Yield: It is a compile-time error if a yield statement appears in a | 2496 * ?? Yield: It is a compile-time error if a yield statement appears in a |
2003 * function that is not a generator function. | 2497 * function that is not a generator function. |
2004 */ | 2498 */ |
2005 static const CompileTimeErrorCode YIELD_EACH_IN_NON_GENERATOR = const CompileT
imeErrorCode('YIELD_EACH_IN_NON_GENERATOR', "Yield-each statements must be in a
generator function (one marked with either 'async*' or 'sync*')"); | 2499 static const CompileTimeErrorCode YIELD_EACH_IN_NON_GENERATOR = |
| 2500 const CompileTimeErrorCode( |
| 2501 'YIELD_EACH_IN_NON_GENERATOR', |
| 2502 "Yield-each statements must be in a generator function (one marked wit
h either 'async*' or 'sync*')"); |
2006 | 2503 |
2007 /** | 2504 /** |
2008 * ?? Yield: It is a compile-time error if a yield statement appears in a | 2505 * ?? Yield: It is a compile-time error if a yield statement appears in a |
2009 * function that is not a generator function. | 2506 * function that is not a generator function. |
2010 */ | 2507 */ |
2011 static const CompileTimeErrorCode YIELD_IN_NON_GENERATOR = const CompileTimeEr
rorCode('YIELD_IN_NON_GENERATOR', "Yield statements must be in a generator funct
ion (one marked with either 'async*' or 'sync*')"); | 2508 static const CompileTimeErrorCode YIELD_IN_NON_GENERATOR = |
| 2509 const CompileTimeErrorCode( |
| 2510 'YIELD_IN_NON_GENERATOR', |
| 2511 "Yield statements must be in a generator function (one marked with eit
her 'async*' or 'sync*')"); |
2012 | 2512 |
2013 /** | 2513 /** |
2014 * Initialize a newly created error code to have the given [name]. The message | 2514 * Initialize a newly created error code to have the given [name]. The message |
2015 * associated with the error will be created from the given [message] | 2515 * associated with the error will be created from the given [message] |
2016 * template. The correction associated with the error will be created from the | 2516 * template. The correction associated with the error will be created from the |
2017 * given [correction] template. | 2517 * given [correction] template. |
2018 */ | 2518 */ |
2019 const CompileTimeErrorCode(String name, String message, [String correction]) :
super(name, message, correction); | 2519 const CompileTimeErrorCode(String name, String message, [String correction]) |
| 2520 : super(name, message, correction); |
2020 | 2521 |
2021 @override | 2522 @override |
2022 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity; | 2523 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity; |
2023 | 2524 |
2024 @override | 2525 @override |
2025 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; | 2526 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
2026 } | 2527 } |
2027 | 2528 |
2028 /** | 2529 /** |
2029 * An `ErrorCode` represents an error code associated with an [AnalysisError]. | 2530 * An `ErrorCode` represents an error code associated with an [AnalysisError]. |
2030 * | 2531 * |
2031 * Generally, we want to provide messages that consist of three sentences. From | 2532 * Generally, we want to provide messages that consist of three sentences. From |
2032 * the user's perspective these sentences should explain: | 2533 * the user's perspective these sentences should explain: |
2033 * 1. what is wrong, | 2534 * 1. what is wrong, |
2034 * 2. why is it wrong, and | 2535 * 2. why is it wrong, and |
2035 * 3. how do I fix it. | 2536 * 3. how do I fix it. |
2036 * However, we combine the first two in the [message] and the last in the | 2537 * However, we combine the first two in the [message] and the last in the |
2037 * [correction]. | 2538 * [correction]. |
2038 */ | 2539 */ |
2039 abstract class ErrorCode { | 2540 abstract class ErrorCode { |
2040 /** | 2541 /** |
| 2542 * An empty list of error codes. |
| 2543 */ |
| 2544 static const List<ErrorCode> EMPTY_LIST = const <ErrorCode>[]; |
| 2545 |
| 2546 /** |
2041 * The name of the error code. | 2547 * The name of the error code. |
2042 */ | 2548 */ |
2043 final String name; | 2549 final String name; |
2044 | 2550 |
2045 /** | 2551 /** |
2046 * The template used to create the message to be displayed for this error. The | 2552 * The template used to create the message to be displayed for this error. The |
2047 * message should indicate what is wrong and why it is wrong. | 2553 * message should indicate what is wrong and why it is wrong. |
2048 */ | 2554 */ |
2049 final String message; | 2555 final String message; |
2050 | 2556 |
2051 /** | 2557 /** |
2052 * The template used to create the correction to be displayed for this error, | 2558 * The template used to create the correction to be displayed for this error, |
2053 * or `null` if there is no correction information for this error. The | 2559 * or `null` if there is no correction information for this error. The |
2054 * correction should indicate how the user can fix the error. | 2560 * correction should indicate how the user can fix the error. |
2055 */ | 2561 */ |
2056 final String correction; | 2562 final String correction; |
2057 | 2563 |
2058 /** | 2564 /** |
2059 * An empty list of error codes. | |
2060 */ | |
2061 static const List<ErrorCode> EMPTY_LIST = const <ErrorCode>[]; | |
2062 | |
2063 /** | |
2064 * Initialize a newly created error code to have the given [name]. The message | 2565 * Initialize a newly created error code to have the given [name]. The message |
2065 * associated with the error will be created from the given [message] | 2566 * associated with the error will be created from the given [message] |
2066 * template. The correction associated with the error will be created from the | 2567 * template. The correction associated with the error will be created from the |
2067 * given [correction] template. | 2568 * given [correction] template. |
2068 */ | 2569 */ |
2069 const ErrorCode(this.name, this.message, [this.correction]); | 2570 const ErrorCode(this.name, this.message, [this.correction]); |
2070 | 2571 |
2071 /** | 2572 /** |
2072 * The severity of the error. | 2573 * The severity of the error. |
2073 */ | 2574 */ |
(...skipping 12 matching lines...) Expand all Loading... |
2086 | 2587 |
2087 /** | 2588 /** |
2088 * The enumeration `ErrorProperty` defines the properties that can be associated
with an | 2589 * The enumeration `ErrorProperty` defines the properties that can be associated
with an |
2089 * [AnalysisError]. | 2590 * [AnalysisError]. |
2090 */ | 2591 */ |
2091 class ErrorProperty extends Enum<ErrorProperty> { | 2592 class ErrorProperty extends Enum<ErrorProperty> { |
2092 /** | 2593 /** |
2093 * A property whose value is an array of [ExecutableElement] that should | 2594 * A property whose value is an array of [ExecutableElement] that should |
2094 * be but are not implemented by a concrete class. | 2595 * be but are not implemented by a concrete class. |
2095 */ | 2596 */ |
2096 static const ErrorProperty UNIMPLEMENTED_METHODS = const ErrorProperty('UNIMPL
EMENTED_METHODS', 0); | 2597 static const ErrorProperty UNIMPLEMENTED_METHODS = |
| 2598 const ErrorProperty('UNIMPLEMENTED_METHODS', 0); |
2097 | 2599 |
2098 static const List<ErrorProperty> values = const [UNIMPLEMENTED_METHODS]; | 2600 static const List<ErrorProperty> values = const [UNIMPLEMENTED_METHODS]; |
2099 | 2601 |
2100 const ErrorProperty(String name, int ordinal) : super(name, ordinal); | 2602 const ErrorProperty(String name, int ordinal) : super(name, ordinal); |
2101 } | 2603 } |
2102 | 2604 |
2103 /** | 2605 /** |
2104 * Instances of the class `ErrorReporter` wrap an error listener with utility me
thods used to | 2606 * Instances of the class `ErrorReporter` wrap an error listener with utility me
thods used to |
2105 * create the errors being reported. | 2607 * create the errors being reported. |
2106 */ | 2608 */ |
(...skipping 24 matching lines...) Expand all Loading... |
2131 throw new IllegalArgumentException("An error listener must be provided"); | 2633 throw new IllegalArgumentException("An error listener must be provided"); |
2132 } else if (_defaultSource == null) { | 2634 } else if (_defaultSource == null) { |
2133 throw new IllegalArgumentException("A default source must be provided"); | 2635 throw new IllegalArgumentException("A default source must be provided"); |
2134 } | 2636 } |
2135 this._source = _defaultSource; | 2637 this._source = _defaultSource; |
2136 } | 2638 } |
2137 | 2639 |
2138 Source get source => _source; | 2640 Source get source => _source; |
2139 | 2641 |
2140 /** | 2642 /** |
| 2643 * Set the source to be used when reporting errors. Setting the source to `nul
l` will cause |
| 2644 * the default source to be used. |
| 2645 * |
| 2646 * @param source the source to be used when reporting errors |
| 2647 */ |
| 2648 void set source(Source source) { |
| 2649 this._source = source == null ? _defaultSource : source; |
| 2650 } |
| 2651 |
| 2652 /** |
2141 * Creates an error with properties with the given error code and arguments. | 2653 * Creates an error with properties with the given error code and arguments. |
2142 * | 2654 * |
2143 * @param errorCode the error code of the error to be reported | 2655 * @param errorCode the error code of the error to be reported |
2144 * @param node the node specifying the location of the error | 2656 * @param node the node specifying the location of the error |
2145 * @param arguments the arguments to the error, used to compose the error mess
age | 2657 * @param arguments the arguments to the error, used to compose the error mess
age |
2146 */ | 2658 */ |
2147 AnalysisErrorWithProperties newErrorWithProperties(ErrorCode errorCode, AstNod
e node, List<Object> arguments) => new AnalysisErrorWithProperties.con2(_source,
node.offset, node.length, errorCode, arguments); | 2659 AnalysisErrorWithProperties newErrorWithProperties(ErrorCode errorCode, |
| 2660 AstNode node, List<Object> arguments) => |
| 2661 new AnalysisErrorWithProperties.con2( |
| 2662 _source, |
| 2663 node.offset, |
| 2664 node.length, |
| 2665 errorCode, |
| 2666 arguments); |
2148 | 2667 |
2149 /** | 2668 /** |
2150 * Report a passed error. | 2669 * Report a passed error. |
2151 * | 2670 * |
2152 * @param error the error to report | 2671 * @param error the error to report |
2153 */ | 2672 */ |
2154 void reportError(AnalysisError error) { | 2673 void reportError(AnalysisError error) { |
2155 _errorListener.onError(error); | 2674 _errorListener.onError(error); |
2156 } | 2675 } |
2157 | 2676 |
2158 /** | 2677 /** |
2159 * Report an error with the given error code and arguments. | 2678 * Report an error with the given error code and arguments. |
2160 * | 2679 * |
2161 * @param errorCode the error code of the error to be reported | 2680 * @param errorCode the error code of the error to be reported |
2162 * @param element the element which name should be used as the location of the
error | 2681 * @param element the element which name should be used as the location of the
error |
2163 * @param arguments the arguments to the error, used to compose the error mess
age | 2682 * @param arguments the arguments to the error, used to compose the error mess
age |
2164 */ | 2683 */ |
2165 void reportErrorForElement(ErrorCode errorCode, Element element, List<Object>
arguments) { | 2684 void reportErrorForElement(ErrorCode errorCode, Element element, |
2166 reportErrorForOffset(errorCode, element.nameOffset, element.displayName.leng
th, arguments); | 2685 List<Object> arguments) { |
| 2686 reportErrorForOffset( |
| 2687 errorCode, |
| 2688 element.nameOffset, |
| 2689 element.displayName.length, |
| 2690 arguments); |
2167 } | 2691 } |
2168 | 2692 |
2169 /** | 2693 /** |
2170 * Report an error with the given error code and arguments. | 2694 * Report an error with the given error code and arguments. |
2171 * | 2695 * |
2172 * If the arguments contain the names of two or more types, the method | 2696 * If the arguments contain the names of two or more types, the method |
2173 * [reportTypeErrorForNode] should be used and the types | 2697 * [reportTypeErrorForNode] should be used and the types |
2174 * themselves (rather than their names) should be passed as arguments. | 2698 * themselves (rather than their names) should be passed as arguments. |
2175 * | 2699 * |
2176 * @param errorCode the error code of the error to be reported | 2700 * @param errorCode the error code of the error to be reported |
2177 * @param node the node specifying the location of the error | 2701 * @param node the node specifying the location of the error |
2178 * @param arguments the arguments to the error, used to compose the error mess
age | 2702 * @param arguments the arguments to the error, used to compose the error mess
age |
2179 */ | 2703 */ |
2180 void reportErrorForNode(ErrorCode errorCode, AstNode node, [List<Object> argum
ents]) { | 2704 void reportErrorForNode(ErrorCode errorCode, AstNode node, |
| 2705 [List<Object> arguments]) { |
2181 reportErrorForOffset(errorCode, node.offset, node.length, arguments); | 2706 reportErrorForOffset(errorCode, node.offset, node.length, arguments); |
2182 } | 2707 } |
2183 | 2708 |
2184 /** | 2709 /** |
2185 * Report an error with the given error code and arguments. | 2710 * Report an error with the given error code and arguments. |
2186 * | 2711 * |
2187 * @param errorCode the error code of the error to be reported | 2712 * @param errorCode the error code of the error to be reported |
2188 * @param offset the offset of the location of the error | 2713 * @param offset the offset of the location of the error |
2189 * @param length the length of the location of the error | 2714 * @param length the length of the location of the error |
2190 * @param arguments the arguments to the error, used to compose the error mess
age | 2715 * @param arguments the arguments to the error, used to compose the error mess
age |
2191 */ | 2716 */ |
2192 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, [List<O
bject> arguments]) { | 2717 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, |
2193 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error
Code, arguments)); | 2718 [List<Object> arguments]) { |
| 2719 _errorListener.onError( |
| 2720 new AnalysisError.con2(_source, offset, length, errorCode, arguments)); |
2194 } | 2721 } |
2195 | 2722 |
2196 /** | 2723 /** |
2197 * Report an error with the given error code and arguments. | 2724 * Report an error with the given error code and arguments. |
2198 * | 2725 * |
2199 * @param errorCode the error code of the error to be reported | 2726 * @param errorCode the error code of the error to be reported |
2200 * @param token the token specifying the location of the error | 2727 * @param token the token specifying the location of the error |
2201 * @param arguments the arguments to the error, used to compose the error mess
age | 2728 * @param arguments the arguments to the error, used to compose the error mess
age |
2202 */ | 2729 */ |
2203 void reportErrorForToken(ErrorCode errorCode, Token token, [List<Object> argum
ents]) { | 2730 void reportErrorForToken(ErrorCode errorCode, Token token, |
| 2731 [List<Object> arguments]) { |
2204 reportErrorForOffset(errorCode, token.offset, token.length, arguments); | 2732 reportErrorForOffset(errorCode, token.offset, token.length, arguments); |
2205 } | 2733 } |
2206 | 2734 |
2207 /** | 2735 /** |
2208 * Report an error with the given error code and arguments. The arguments are
expected to contain | 2736 * Report an error with the given error code and arguments. The arguments are
expected to contain |
2209 * two or more types. Convert the types into strings by using the display name
s of the types, | 2737 * two or more types. Convert the types into strings by using the display name
s of the types, |
2210 * unless there are two or more types with the same names, in which case the e
xtended display | 2738 * unless there are two or more types with the same names, in which case the e
xtended display |
2211 * names of the types will be used in order to clarify the message. | 2739 * names of the types will be used in order to clarify the message. |
2212 * | 2740 * |
2213 * If there are not two or more types in the argument list, the method | 2741 * If there are not two or more types in the argument list, the method |
2214 * [reportErrorForNode] should be used instead. | 2742 * [reportErrorForNode] should be used instead. |
2215 * | 2743 * |
2216 * @param errorCode the error code of the error to be reported | 2744 * @param errorCode the error code of the error to be reported |
2217 * @param node the node specifying the location of the error | 2745 * @param node the node specifying the location of the error |
2218 * @param arguments the arguments to the error, used to compose the error mess
age | 2746 * @param arguments the arguments to the error, used to compose the error mess
age |
2219 */ | 2747 */ |
2220 void reportTypeErrorForNode(ErrorCode errorCode, AstNode node, List<Object> ar
guments) { | 2748 void reportTypeErrorForNode(ErrorCode errorCode, AstNode node, |
| 2749 List<Object> arguments) { |
2221 _convertTypeNames(arguments); | 2750 _convertTypeNames(arguments); |
2222 reportErrorForOffset(errorCode, node.offset, node.length, arguments); | 2751 reportErrorForOffset(errorCode, node.offset, node.length, arguments); |
2223 } | 2752 } |
2224 | 2753 |
2225 /** | 2754 /** |
2226 * Set the source to be used when reporting errors. Setting the source to `nul
l` will cause | |
2227 * the default source to be used. | |
2228 * | |
2229 * @param source the source to be used when reporting errors | |
2230 */ | |
2231 void set source(Source source) { | |
2232 this._source = source == null ? _defaultSource : source; | |
2233 } | |
2234 | |
2235 /** | |
2236 * Given an array of arguments that is expected to contain two or more types,
convert the types | 2755 * Given an array of arguments that is expected to contain two or more types,
convert the types |
2237 * into strings by using the display names of the types, unless there are two
or more types with | 2756 * into strings by using the display names of the types, unless there are two
or more types with |
2238 * the same names, in which case the extended display names of the types will
be used in order to | 2757 * the same names, in which case the extended display names of the types will
be used in order to |
2239 * clarify the message. | 2758 * clarify the message. |
2240 * | 2759 * |
2241 * @param arguments the arguments that are to be converted | 2760 * @param arguments the arguments that are to be converted |
2242 */ | 2761 */ |
2243 void _convertTypeNames(List<Object> arguments) { | 2762 void _convertTypeNames(List<Object> arguments) { |
2244 if (_hasEqualTypeNames(arguments)) { | 2763 if (_hasEqualTypeNames(arguments)) { |
2245 int count = arguments.length; | 2764 int count = arguments.length; |
(...skipping 25 matching lines...) Expand all Loading... |
2271 * display name. | 2790 * display name. |
2272 * | 2791 * |
2273 * @param arguments the arguments being tested | 2792 * @param arguments the arguments being tested |
2274 * @return `true` if the array of arguments contains two or more types with th
e same display | 2793 * @return `true` if the array of arguments contains two or more types with th
e same display |
2275 * name | 2794 * name |
2276 */ | 2795 */ |
2277 bool _hasEqualTypeNames(List<Object> arguments) { | 2796 bool _hasEqualTypeNames(List<Object> arguments) { |
2278 int count = arguments.length; | 2797 int count = arguments.length; |
2279 HashSet<String> typeNames = new HashSet<String>(); | 2798 HashSet<String> typeNames = new HashSet<String>(); |
2280 for (int i = 0; i < count; i++) { | 2799 for (int i = 0; i < count; i++) { |
2281 if (arguments[i] is DartType && !typeNames.add((arguments[i] as DartType).
displayName)) { | 2800 if (arguments[i] is DartType && |
| 2801 !typeNames.add((arguments[i] as DartType).displayName)) { |
2282 return true; | 2802 return true; |
2283 } | 2803 } |
2284 } | 2804 } |
2285 return false; | 2805 return false; |
2286 } | 2806 } |
2287 } | 2807 } |
2288 | 2808 |
2289 /** | 2809 /** |
2290 * Instances of the enumeration `ErrorSeverity` represent the severity of an [Er
rorCode] | 2810 * Instances of the enumeration `ErrorSeverity` represent the severity of an [Er
rorCode] |
2291 * . | 2811 * . |
2292 */ | 2812 */ |
2293 class ErrorSeverity extends Enum<ErrorSeverity> { | 2813 class ErrorSeverity extends Enum<ErrorSeverity> { |
2294 /** | 2814 /** |
2295 * The severity representing a non-error. This is never used for any error cod
e, but is useful for | 2815 * The severity representing a non-error. This is never used for any error cod
e, but is useful for |
2296 * clients. | 2816 * clients. |
2297 */ | 2817 */ |
2298 static const ErrorSeverity NONE = const ErrorSeverity('NONE', 0, " ", "none"); | 2818 static const ErrorSeverity NONE = const ErrorSeverity('NONE', 0, " ", "none"); |
2299 | 2819 |
2300 /** | 2820 /** |
2301 * The severity representing an informational level analysis issue. | 2821 * The severity representing an informational level analysis issue. |
2302 */ | 2822 */ |
2303 static const ErrorSeverity INFO = const ErrorSeverity('INFO', 1, "I", "info"); | 2823 static const ErrorSeverity INFO = const ErrorSeverity('INFO', 1, "I", "info"); |
2304 | 2824 |
2305 /** | 2825 /** |
2306 * The severity representing a warning. Warnings can become errors if the `-We
rror` command | 2826 * The severity representing a warning. Warnings can become errors if the `-We
rror` command |
2307 * line flag is specified. | 2827 * line flag is specified. |
2308 */ | 2828 */ |
2309 static const ErrorSeverity WARNING = const ErrorSeverity('WARNING', 2, "W", "w
arning"); | 2829 static const ErrorSeverity WARNING = |
| 2830 const ErrorSeverity('WARNING', 2, "W", "warning"); |
2310 | 2831 |
2311 /** | 2832 /** |
2312 * The severity representing an error. | 2833 * The severity representing an error. |
2313 */ | 2834 */ |
2314 static const ErrorSeverity ERROR = const ErrorSeverity('ERROR', 3, "E", "error
"); | 2835 static const ErrorSeverity ERROR = |
| 2836 const ErrorSeverity('ERROR', 3, "E", "error"); |
2315 | 2837 |
2316 static const List<ErrorSeverity> values = const [NONE, INFO, WARNING, ERROR]; | 2838 static const List<ErrorSeverity> values = const [NONE, INFO, WARNING, ERROR]; |
2317 | 2839 |
2318 /** | 2840 /** |
2319 * The name of the severity used when producing machine output. | 2841 * The name of the severity used when producing machine output. |
2320 */ | 2842 */ |
2321 final String machineCode; | 2843 final String machineCode; |
2322 | 2844 |
2323 /** | 2845 /** |
2324 * The name of the severity used when producing readable output. | 2846 * The name of the severity used when producing readable output. |
2325 */ | 2847 */ |
2326 final String displayName; | 2848 final String displayName; |
2327 | 2849 |
2328 /** | 2850 /** |
2329 * Initialize a newly created severity with the given names. | 2851 * Initialize a newly created severity with the given names. |
2330 * | 2852 * |
2331 * @param machineCode the name of the severity used when producing machine out
put | 2853 * @param machineCode the name of the severity used when producing machine out
put |
2332 * @param displayName the name of the severity used when producing readable ou
tput | 2854 * @param displayName the name of the severity used when producing readable ou
tput |
2333 */ | 2855 */ |
2334 const ErrorSeverity(String name, int ordinal, this.machineCode, this.displayNa
me) : super(name, ordinal); | 2856 const ErrorSeverity(String name, int ordinal, this.machineCode, |
| 2857 this.displayName) |
| 2858 : super(name, ordinal); |
2335 | 2859 |
2336 /** | 2860 /** |
2337 * Return the severity constant that represents the greatest severity. | 2861 * Return the severity constant that represents the greatest severity. |
2338 * | 2862 * |
2339 * @param severity the severity being compared against | 2863 * @param severity the severity being compared against |
2340 * @return the most sever of this or the given severity | 2864 * @return the most sever of this or the given severity |
2341 */ | 2865 */ |
2342 ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal
? this : severity; | 2866 ErrorSeverity max(ErrorSeverity severity) => |
| 2867 this.ordinal >= severity.ordinal ? this : severity; |
2343 } | 2868 } |
2344 | 2869 |
2345 /** | 2870 /** |
2346 * Instances of the enumeration `ErrorType` represent the type of an [ErrorCode]
. | 2871 * Instances of the enumeration `ErrorType` represent the type of an [ErrorCode]
. |
2347 */ | 2872 */ |
2348 class ErrorType extends Enum<ErrorType> { | 2873 class ErrorType extends Enum<ErrorType> { |
2349 /** | 2874 /** |
2350 * Task (todo) comments in user code. | 2875 * Task (todo) comments in user code. |
2351 */ | 2876 */ |
2352 static const ErrorType TODO = const ErrorType('TODO', 0, ErrorSeverity.INFO); | 2877 static const ErrorType TODO = const ErrorType('TODO', 0, ErrorSeverity.INFO); |
2353 | 2878 |
2354 /** | 2879 /** |
2355 * Extra analysis run over the code to follow best practices, which are not in
the Dart Language | 2880 * Extra analysis run over the code to follow best practices, which are not in
the Dart Language |
2356 * Specification. | 2881 * Specification. |
2357 */ | 2882 */ |
2358 static const ErrorType HINT = const ErrorType('HINT', 1, ErrorSeverity.INFO); | 2883 static const ErrorType HINT = const ErrorType('HINT', 1, ErrorSeverity.INFO); |
2359 | 2884 |
2360 /** | 2885 /** |
2361 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported | 2886 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported |
2362 * by a Dart compiler before the erroneous code is executed. | 2887 * by a Dart compiler before the erroneous code is executed. |
2363 */ | 2888 */ |
2364 static const ErrorType COMPILE_TIME_ERROR = const ErrorType('COMPILE_TIME_ERRO
R', 2, ErrorSeverity.ERROR); | 2889 static const ErrorType COMPILE_TIME_ERROR = |
| 2890 const ErrorType('COMPILE_TIME_ERROR', 2, ErrorSeverity.ERROR); |
2365 | 2891 |
2366 /** | 2892 /** |
2367 * Checked mode compile-time errors are errors that preclude execution in chec
ked mode. | 2893 * Checked mode compile-time errors are errors that preclude execution in chec
ked mode. |
2368 */ | 2894 */ |
2369 static const ErrorType CHECKED_MODE_COMPILE_TIME_ERROR = const ErrorType('CHEC
KED_MODE_COMPILE_TIME_ERROR', 3, ErrorSeverity.ERROR); | 2895 static const ErrorType CHECKED_MODE_COMPILE_TIME_ERROR = |
| 2896 const ErrorType('CHECKED_MODE_COMPILE_TIME_ERROR', 3, ErrorSeverity.ERROR)
; |
2370 | 2897 |
2371 /** | 2898 /** |
2372 * Static warnings are those warnings reported by the static checker. They hav
e no effect on | 2899 * Static warnings are those warnings reported by the static checker. They hav
e no effect on |
2373 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. | 2900 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. |
2374 */ | 2901 */ |
2375 static const ErrorType STATIC_WARNING = const ErrorType('STATIC_WARNING', 4, E
rrorSeverity.WARNING); | 2902 static const ErrorType STATIC_WARNING = |
| 2903 const ErrorType('STATIC_WARNING', 4, ErrorSeverity.WARNING); |
2376 | 2904 |
2377 /** | 2905 /** |
2378 * Many, but not all, static warnings relate to types, in which case they are
known as static type | 2906 * Many, but not all, static warnings relate to types, in which case they are
known as static type |
2379 * warnings. | 2907 * warnings. |
2380 */ | 2908 */ |
2381 static const ErrorType STATIC_TYPE_WARNING = const ErrorType('STATIC_TYPE_WARN
ING', 5, ErrorSeverity.WARNING); | 2909 static const ErrorType STATIC_TYPE_WARNING = |
| 2910 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); |
2382 | 2911 |
2383 /** | 2912 /** |
2384 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. | 2913 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. |
2385 */ | 2914 */ |
2386 static const ErrorType SYNTACTIC_ERROR = const ErrorType('SYNTACTIC_ERROR', 6,
ErrorSeverity.ERROR); | 2915 static const ErrorType SYNTACTIC_ERROR = |
| 2916 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); |
2387 | 2917 |
2388 /** | 2918 /** |
2389 * Angular specific semantic problems. | 2919 * Angular specific semantic problems. |
2390 */ | 2920 */ |
2391 static const ErrorType ANGULAR = const ErrorType('ANGULAR', 7, ErrorSeverity.I
NFO); | 2921 static const ErrorType ANGULAR = |
| 2922 const ErrorType('ANGULAR', 7, ErrorSeverity.INFO); |
2392 | 2923 |
2393 /** | 2924 /** |
2394 * Polymer specific semantic problems. | 2925 * Polymer specific semantic problems. |
2395 */ | 2926 */ |
2396 static const ErrorType POLYMER = const ErrorType('POLYMER', 8, ErrorSeverity.I
NFO); | 2927 static const ErrorType POLYMER = |
| 2928 const ErrorType('POLYMER', 8, ErrorSeverity.INFO); |
2397 | 2929 |
2398 static const List<ErrorType> values = const [ | 2930 static const List<ErrorType> values = const [ |
2399 TODO, | 2931 TODO, |
2400 HINT, | 2932 HINT, |
2401 COMPILE_TIME_ERROR, | 2933 COMPILE_TIME_ERROR, |
2402 CHECKED_MODE_COMPILE_TIME_ERROR, | 2934 CHECKED_MODE_COMPILE_TIME_ERROR, |
2403 STATIC_WARNING, | 2935 STATIC_WARNING, |
2404 STATIC_TYPE_WARNING, | 2936 STATIC_TYPE_WARNING, |
2405 SYNTACTIC_ERROR, | 2937 SYNTACTIC_ERROR, |
2406 ANGULAR, | 2938 ANGULAR, |
2407 POLYMER]; | 2939 POLYMER]; |
2408 | 2940 |
2409 /** | 2941 /** |
2410 * The severity of this type of error. | 2942 * The severity of this type of error. |
2411 */ | 2943 */ |
2412 final ErrorSeverity severity; | 2944 final ErrorSeverity severity; |
2413 | 2945 |
2414 /** | 2946 /** |
2415 * Initialize a newly created error type to have the given severity. | 2947 * Initialize a newly created error type to have the given severity. |
2416 * | 2948 * |
2417 * @param severity the severity of this type of error | 2949 * @param severity the severity of this type of error |
2418 */ | 2950 */ |
2419 const ErrorType(String name, int ordinal, this.severity) : super(name, ordinal
); | 2951 const ErrorType(String name, int ordinal, this.severity) |
| 2952 : super(name, ordinal); |
2420 | 2953 |
2421 String get displayName => name.toLowerCase().replaceAll('_', ' '); | 2954 String get displayName => name.toLowerCase().replaceAll('_', ' '); |
2422 } | 2955 } |
2423 | 2956 |
2424 /** | 2957 /** |
2425 * The class `HintCode` defines the hints and coding recommendations for best | 2958 * The class `HintCode` defines the hints and coding recommendations for best |
2426 * practices which are not mentioned in the Dart Language Specification. | 2959 * practices which are not mentioned in the Dart Language Specification. |
2427 */ | 2960 */ |
2428 class HintCode extends ErrorCode { | 2961 class HintCode extends ErrorCode { |
2429 /** | 2962 /** |
2430 * This hint is generated anywhere where the | 2963 * This hint is generated anywhere where the |
2431 * [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, | 2964 * [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, |
2432 * if we used propagated information for the warnings. | 2965 * if we used propagated information for the warnings. |
2433 * | 2966 * |
2434 * @param actualType the name of the actual argument type | 2967 * @param actualType the name of the actual argument type |
2435 * @param expectedType the name of the expected type | 2968 * @param expectedType the name of the expected type |
2436 */ | 2969 */ |
2437 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode('ARGUMENT_
TYPE_NOT_ASSIGNABLE', "The argument type '{0}' cannot be assigned to the paramet
er type '{1}'"); | 2970 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode( |
| 2971 'ARGUMENT_TYPE_NOT_ASSIGNABLE', |
| 2972 "The argument type '{0}' cannot be assigned to the parameter type '{1}'"); |
2438 | 2973 |
2439 /** | 2974 /** |
2440 * Dead code is code that is never reached, this can happen for instance if a | 2975 * Dead code is code that is never reached, this can happen for instance if a |
2441 * statement follows a return statement. | 2976 * statement follows a return statement. |
2442 */ | 2977 */ |
2443 static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code"); | 2978 static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code"); |
2444 | 2979 |
2445 /** | 2980 /** |
2446 * Dead code is code that is never reached. This case covers cases where the | 2981 * Dead code is code that is never reached. This case covers cases where the |
2447 * user has catch clauses after `catch (e)` or `on Object catch (e)`. | 2982 * user has catch clauses after `catch (e)` or `on Object catch (e)`. |
2448 */ | 2983 */ |
2449 static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode('DEAD_C
ODE_CATCH_FOLLOWING_CATCH', "Dead code, catch clauses after a 'catch (e)' or an
'on Object catch (e)' are never reached"); | 2984 static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode( |
| 2985 'DEAD_CODE_CATCH_FOLLOWING_CATCH', |
| 2986 "Dead code, catch clauses after a 'catch (e)' or an 'on Object catch (e)'
are never reached"); |
2450 | 2987 |
2451 /** | 2988 /** |
2452 * Dead code is code that is never reached. This case covers cases where the | 2989 * Dead code is code that is never reached. This case covers cases where the |
2453 * user has an on-catch clause such as `on A catch (e)`, where a supertype of | 2990 * user has an on-catch clause such as `on A catch (e)`, where a supertype of |
2454 * `A` was already caught. | 2991 * `A` was already caught. |
2455 * | 2992 * |
2456 * @param subtypeName name of the subtype | 2993 * @param subtypeName name of the subtype |
2457 * @param supertypeName name of the supertype | 2994 * @param supertypeName name of the supertype |
2458 */ | 2995 */ |
2459 static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = const HintCode('DEAD_CODE_O
N_CATCH_SUBTYPE', "Dead code, this on-catch block will never be executed since '
{0}' is a subtype of '{1}'"); | 2996 static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = const HintCode( |
| 2997 'DEAD_CODE_ON_CATCH_SUBTYPE', |
| 2998 "Dead code, this on-catch block will never be executed since '{0}' is a su
btype of '{1}'"); |
2460 | 2999 |
2461 /** | 3000 /** |
2462 * Deprecated members should not be invoked or used. | 3001 * Deprecated members should not be invoked or used. |
2463 * | 3002 * |
2464 * @param memberName the name of the member | 3003 * @param memberName the name of the member |
2465 */ | 3004 */ |
2466 static const HintCode DEPRECATED_MEMBER_USE = const HintCode('DEPRECATED_MEMBE
R_USE', "'{0}' is deprecated"); | 3005 static const HintCode DEPRECATED_MEMBER_USE = |
| 3006 const HintCode('DEPRECATED_MEMBER_USE', "'{0}' is deprecated"); |
2467 | 3007 |
2468 /** | 3008 /** |
2469 * Duplicate imports. | 3009 * Duplicate imports. |
2470 */ | 3010 */ |
2471 static const HintCode DUPLICATE_IMPORT = const HintCode('DUPLICATE_IMPORT', "D
uplicate import"); | 3011 static const HintCode DUPLICATE_IMPORT = |
| 3012 const HintCode('DUPLICATE_IMPORT', "Duplicate import"); |
2472 | 3013 |
2473 /** | 3014 /** |
2474 * Hint to use the ~/ operator. | 3015 * Hint to use the ~/ operator. |
2475 */ | 3016 */ |
2476 static const HintCode DIVISION_OPTIMIZATION = const HintCode('DIVISION_OPTIMIZ
ATION', "The operator x ~/ y is more efficient than (x / y).toInt()"); | 3017 static const HintCode DIVISION_OPTIMIZATION = const HintCode( |
| 3018 'DIVISION_OPTIMIZATION', |
| 3019 "The operator x ~/ y is more efficient than (x / y).toInt()"); |
2477 | 3020 |
2478 /** | 3021 /** |
2479 * Hint for the `x is double` type checks. | 3022 * Hint for the `x is double` type checks. |
2480 */ | 3023 */ |
2481 static const HintCode IS_DOUBLE = const HintCode('IS_DOUBLE', "When compiled t
o JS, this test might return true when the left hand side is an int"); | 3024 static const HintCode IS_DOUBLE = const HintCode( |
| 3025 'IS_DOUBLE', |
| 3026 "When compiled to JS, this test might return true when the left hand side
is an int"); |
2482 | 3027 |
2483 /** | 3028 /** |
2484 * Hint for the `x is int` type checks. | 3029 * Hint for the `x is int` type checks. |
2485 */ | 3030 */ |
2486 static const HintCode IS_INT = const HintCode('IS_INT', "When compiled to JS,
this test might return true when the left hand side is a double"); | 3031 static const HintCode IS_INT = const HintCode( |
| 3032 'IS_INT', |
| 3033 "When compiled to JS, this test might return true when the left hand side
is a double"); |
2487 | 3034 |
2488 /** | 3035 /** |
2489 * Hint for the `x is! double` type checks. | 3036 * Hint for the `x is! double` type checks. |
2490 */ | 3037 */ |
2491 static const HintCode IS_NOT_DOUBLE = const HintCode('IS_NOT_DOUBLE', "When co
mpiled to JS, this test might return false when the left hand side is an int"); | 3038 static const HintCode IS_NOT_DOUBLE = const HintCode( |
| 3039 'IS_NOT_DOUBLE', |
| 3040 "When compiled to JS, this test might return false when the left hand side
is an int"); |
2492 | 3041 |
2493 /** | 3042 /** |
2494 * Hint for the `x is! int` type checks. | 3043 * Hint for the `x is! int` type checks. |
2495 */ | 3044 */ |
2496 static const HintCode IS_NOT_INT = const HintCode('IS_NOT_INT', "When compiled
to JS, this test might return false when the left hand side is a double"); | 3045 static const HintCode IS_NOT_INT = const HintCode( |
| 3046 'IS_NOT_INT', |
| 3047 "When compiled to JS, this test might return false when the left hand side
is a double"); |
2497 | 3048 |
2498 /** | 3049 /** |
2499 * Deferred libraries shouldn't define a top level function 'loadLibrary'. | 3050 * Deferred libraries shouldn't define a top level function 'loadLibrary'. |
2500 */ | 3051 */ |
2501 static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = const HintC
ode('IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION', "The library '{0}' defines a t
op-level function named 'loadLibrary' which is hidden by deferring this library"
); | 3052 static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = |
| 3053 const HintCode( |
| 3054 'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION', |
| 3055 "The library '{0}' defines a top-level function named 'loadLibrary' wh
ich is hidden by deferring this library"); |
2502 | 3056 |
2503 /** | 3057 /** |
2504 * This hint is generated anywhere where the | 3058 * This hint is generated anywhere where the |
2505 * [StaticTypeWarningCode.INVALID_ASSIGNMENT] would have been generated, if we | 3059 * [StaticTypeWarningCode.INVALID_ASSIGNMENT] would have been generated, if we |
2506 * used propagated information for the warnings. | 3060 * used propagated information for the warnings. |
2507 * | 3061 * |
2508 * @param rhsTypeName the name of the right hand side type | 3062 * @param rhsTypeName the name of the right hand side type |
2509 * @param lhsTypeName the name of the left hand side type | 3063 * @param lhsTypeName the name of the left hand side type |
2510 * See [StaticTypeWarningCode.INVALID_ASSIGNMENT]. | 3064 * See [StaticTypeWarningCode.INVALID_ASSIGNMENT]. |
2511 */ | 3065 */ |
2512 static const HintCode INVALID_ASSIGNMENT = const HintCode('INVALID_ASSIGNMENT'
, "A value of type '{0}' cannot be assigned to a variable of type '{1}'"); | 3066 static const HintCode INVALID_ASSIGNMENT = const HintCode( |
| 3067 'INVALID_ASSIGNMENT', |
| 3068 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"); |
2513 | 3069 |
2514 /** | 3070 /** |
2515 * Generate a hint for methods or functions that have a return type, but do | 3071 * Generate a hint for methods or functions that have a return type, but do |
2516 * not have a non-void return statement on all branches. At the end of methods | 3072 * not have a non-void return statement on all branches. At the end of methods |
2517 * or functions with no return, Dart implicitly returns `null`, avoiding these | 3073 * or functions with no return, Dart implicitly returns `null`, avoiding these |
2518 * implicit returns is considered a best practice. | 3074 * implicit returns is considered a best practice. |
2519 * | 3075 * |
2520 * @param returnType the name of the declared return type | 3076 * @param returnType the name of the declared return type |
2521 */ | 3077 */ |
2522 static const HintCode MISSING_RETURN = const HintCode('MISSING_RETURN', "This
function declares a return type of '{0}', but does not end with a return stateme
nt", "Either add a return statement or change the return type to 'void'"); | 3078 static const HintCode MISSING_RETURN = const HintCode( |
| 3079 'MISSING_RETURN', |
| 3080 "This function declares a return type of '{0}', but does not end with a re
turn statement", |
| 3081 "Either add a return statement or change the return type to 'void'"); |
2523 | 3082 |
2524 /** | 3083 /** |
2525 * A getter with the override annotation does not override an existing getter. | 3084 * A getter with the override annotation does not override an existing getter. |
2526 */ | 3085 */ |
2527 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode('OVER
RIDE_ON_NON_OVERRIDING_GETTER', "Getter does not override an inherited getter"); | 3086 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode( |
| 3087 'OVERRIDE_ON_NON_OVERRIDING_GETTER', |
| 3088 "Getter does not override an inherited getter"); |
2528 | 3089 |
2529 /** | 3090 /** |
2530 * A method with the override annotation does not override an existing method. | 3091 * A method with the override annotation does not override an existing method. |
2531 */ | 3092 */ |
2532 static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode('OVER
RIDE_ON_NON_OVERRIDING_METHOD', "Method does not override an inherited method"); | 3093 static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode( |
| 3094 'OVERRIDE_ON_NON_OVERRIDING_METHOD', |
| 3095 "Method does not override an inherited method"); |
2533 | 3096 |
2534 /** | 3097 /** |
2535 * A setter with the override annotation does not override an existing setter. | 3098 * A setter with the override annotation does not override an existing setter. |
2536 */ | 3099 */ |
2537 static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode('OVER
RIDE_ON_NON_OVERRIDING_SETTER', "Setter does not override an inherited setter"); | 3100 static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode( |
| 3101 'OVERRIDE_ON_NON_OVERRIDING_SETTER', |
| 3102 "Setter does not override an inherited setter"); |
2538 | 3103 |
2539 /** | 3104 /** |
2540 * Hint for classes that override equals, but not hashCode. | 3105 * Hint for classes that override equals, but not hashCode. |
2541 * | 3106 * |
2542 * @param className the name of the current class | 3107 * @param className the name of the current class |
2543 */ | 3108 */ |
2544 static const HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = const HintCode('OVER
RIDE_EQUALS_BUT_NOT_HASH_CODE', "The class '{0}' overrides 'operator==', but not
'get hashCode'"); | 3109 static const HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = const HintCode( |
| 3110 'OVERRIDE_EQUALS_BUT_NOT_HASH_CODE', |
| 3111 "The class '{0}' overrides 'operator==', but not 'get hashCode'"); |
2545 | 3112 |
2546 /** | 3113 /** |
2547 * Type checks of the type `x is! Null` should be done with `x != null`. | 3114 * Type checks of the type `x is! Null` should be done with `x != null`. |
2548 */ | 3115 */ |
2549 static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode('TYPE_CHECK_IS_N
OT_NULL', "Tests for non-null should be done with '!= null'"); | 3116 static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode( |
| 3117 'TYPE_CHECK_IS_NOT_NULL', |
| 3118 "Tests for non-null should be done with '!= null'"); |
2550 | 3119 |
2551 /** | 3120 /** |
2552 * Type checks of the type `x is Null` should be done with `x == null`. | 3121 * Type checks of the type `x is Null` should be done with `x == null`. |
2553 */ | 3122 */ |
2554 static const HintCode TYPE_CHECK_IS_NULL = const HintCode('TYPE_CHECK_IS_NULL'
, "Tests for null should be done with '== null'"); | 3123 static const HintCode TYPE_CHECK_IS_NULL = const HintCode( |
| 3124 'TYPE_CHECK_IS_NULL', |
| 3125 "Tests for null should be done with '== null'"); |
2555 | 3126 |
2556 /** | 3127 /** |
2557 * This hint is generated anywhere where the | 3128 * This hint is generated anywhere where the |
2558 * [StaticTypeWarningCode.UNDEFINED_GETTER] or | 3129 * [StaticTypeWarningCode.UNDEFINED_GETTER] or |
2559 * [StaticWarningCode.UNDEFINED_GETTER] would have been generated, if we used | 3130 * [StaticWarningCode.UNDEFINED_GETTER] would have been generated, if we used |
2560 * propagated information for the warnings. | 3131 * propagated information for the warnings. |
2561 * | 3132 * |
2562 * @param getterName the name of the getter | 3133 * @param getterName the name of the getter |
2563 * @param enclosingType the name of the enclosing type where the getter is | 3134 * @param enclosingType the name of the enclosing type where the getter is |
2564 * being looked for | 3135 * being looked for |
2565 * See [StaticTypeWarningCode.UNDEFINED_GETTER], and | 3136 * See [StaticTypeWarningCode.UNDEFINED_GETTER], and |
2566 * [StaticWarningCode.UNDEFINED_GETTER]. | 3137 * [StaticWarningCode.UNDEFINED_GETTER]. |
2567 */ | 3138 */ |
2568 static const HintCode UNDEFINED_GETTER = const HintCode('UNDEFINED_GETTER', "T
here is no such getter '{0}' in '{1}'"); | 3139 static const HintCode UNDEFINED_GETTER = |
| 3140 const HintCode('UNDEFINED_GETTER', "There is no such getter '{0}' in '{1}'
"); |
2569 | 3141 |
2570 /** | 3142 /** |
2571 * This hint is generated anywhere where the | 3143 * This hint is generated anywhere where the |
2572 * [StaticTypeWarningCode.UNDEFINED_METHOD] would have been generated, if we | 3144 * [StaticTypeWarningCode.UNDEFINED_METHOD] would have been generated, if we |
2573 * used propagated information for the warnings. | 3145 * used propagated information for the warnings. |
2574 * | 3146 * |
2575 * @param methodName the name of the method that is undefined | 3147 * @param methodName the name of the method that is undefined |
2576 * @param typeName the resolved type name that the method lookup is happening | 3148 * @param typeName the resolved type name that the method lookup is happening |
2577 * on | 3149 * on |
2578 * See [StaticTypeWarningCode.UNDEFINED_METHOD]. | 3150 * See [StaticTypeWarningCode.UNDEFINED_METHOD]. |
2579 */ | 3151 */ |
2580 static const HintCode UNDEFINED_METHOD = const HintCode('UNDEFINED_METHOD', "T
he method '{0}' is not defined for the class '{1}'"); | 3152 static const HintCode UNDEFINED_METHOD = const HintCode( |
| 3153 'UNDEFINED_METHOD', |
| 3154 "The method '{0}' is not defined for the class '{1}'"); |
2581 | 3155 |
2582 /** | 3156 /** |
2583 * This hint is generated anywhere where the | 3157 * This hint is generated anywhere where the |
2584 * [StaticTypeWarningCode.UNDEFINED_OPERATOR] would have been generated, if we | 3158 * [StaticTypeWarningCode.UNDEFINED_OPERATOR] would have been generated, if we |
2585 * used propagated information for the warnings. | 3159 * used propagated information for the warnings. |
2586 * | 3160 * |
2587 * @param operator the name of the operator | 3161 * @param operator the name of the operator |
2588 * @param enclosingType the name of the enclosing type where the operator is | 3162 * @param enclosingType the name of the enclosing type where the operator is |
2589 * being looked for | 3163 * being looked for |
2590 * See [StaticTypeWarningCode.UNDEFINED_OPERATOR]. | 3164 * See [StaticTypeWarningCode.UNDEFINED_OPERATOR]. |
2591 */ | 3165 */ |
2592 static const HintCode UNDEFINED_OPERATOR = const HintCode('UNDEFINED_OPERATOR'
, "There is no such operator '{0}' in '{1}'"); | 3166 static const HintCode UNDEFINED_OPERATOR = const HintCode( |
| 3167 'UNDEFINED_OPERATOR', |
| 3168 "There is no such operator '{0}' in '{1}'"); |
2593 | 3169 |
2594 /** | 3170 /** |
2595 * This hint is generated anywhere where the | 3171 * This hint is generated anywhere where the |
2596 * [StaticTypeWarningCode.UNDEFINED_SETTER] or | 3172 * [StaticTypeWarningCode.UNDEFINED_SETTER] or |
2597 * [StaticWarningCode.UNDEFINED_SETTER] would have been generated, if we used | 3173 * [StaticWarningCode.UNDEFINED_SETTER] would have been generated, if we used |
2598 * propagated information for the warnings. | 3174 * propagated information for the warnings. |
2599 * | 3175 * |
2600 * @param setterName the name of the setter | 3176 * @param setterName the name of the setter |
2601 * @param enclosingType the name of the enclosing type where the setter is | 3177 * @param enclosingType the name of the enclosing type where the setter is |
2602 * being looked for | 3178 * being looked for |
2603 * See [StaticTypeWarningCode.UNDEFINED_SETTER], and | 3179 * See [StaticTypeWarningCode.UNDEFINED_SETTER], and |
2604 * [StaticWarningCode.UNDEFINED_SETTER]. | 3180 * [StaticWarningCode.UNDEFINED_SETTER]. |
2605 */ | 3181 */ |
2606 static const HintCode UNDEFINED_SETTER = const HintCode('UNDEFINED_SETTER', "T
here is no such setter '{0}' in '{1}'"); | 3182 static const HintCode UNDEFINED_SETTER = |
| 3183 const HintCode('UNDEFINED_SETTER', "There is no such setter '{0}' in '{1}'
"); |
2607 | 3184 |
2608 /** | 3185 /** |
2609 * Unnecessary cast. | 3186 * Unnecessary cast. |
2610 */ | 3187 */ |
2611 static const HintCode UNNECESSARY_CAST = const HintCode('UNNECESSARY_CAST', "U
nnecessary cast"); | 3188 static const HintCode UNNECESSARY_CAST = |
| 3189 const HintCode('UNNECESSARY_CAST', "Unnecessary cast"); |
2612 | 3190 |
2613 /** | 3191 /** |
2614 * Unnecessary type checks, the result is always true. | 3192 * Unnecessary type checks, the result is always true. |
2615 */ | 3193 */ |
2616 static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode('UNNECESSA
RY_TYPE_CHECK_FALSE', "Unnecessary type check, the result is always false"); | 3194 static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode( |
| 3195 'UNNECESSARY_TYPE_CHECK_FALSE', |
| 3196 "Unnecessary type check, the result is always false"); |
2617 | 3197 |
2618 /** | 3198 /** |
2619 * Unnecessary type checks, the result is always false. | 3199 * Unnecessary type checks, the result is always false. |
2620 */ | 3200 */ |
2621 static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode('UNNECESSAR
Y_TYPE_CHECK_TRUE', "Unnecessary type check, the result is always true"); | 3201 static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode( |
| 3202 'UNNECESSARY_TYPE_CHECK_TRUE', |
| 3203 "Unnecessary type check, the result is always true"); |
2622 | 3204 |
2623 /** | 3205 /** |
2624 * See [Modifier.IS_USED_IN_LIBRARY]. | 3206 * See [Modifier.IS_USED_IN_LIBRARY]. |
2625 */ | 3207 */ |
2626 static const HintCode UNUSED_ELEMENT = const HintCode('UNUSED_ELEMENT', "The {
0} '{1}' is not used"); | 3208 static const HintCode UNUSED_ELEMENT = |
| 3209 const HintCode('UNUSED_ELEMENT', "The {0} '{1}' is not used"); |
2627 | 3210 |
2628 /** | 3211 /** |
2629 * Unused fields are fields which are never read. | 3212 * Unused fields are fields which are never read. |
2630 */ | 3213 */ |
2631 static const HintCode UNUSED_FIELD = const HintCode('UNUSED_FIELD', "The value
of the field '{0}' is not used"); | 3214 static const HintCode UNUSED_FIELD = |
| 3215 const HintCode('UNUSED_FIELD', "The value of the field '{0}' is not used")
; |
2632 | 3216 |
2633 /** | 3217 /** |
2634 * Unused imports are imports which are never used. | 3218 * Unused imports are imports which are never used. |
2635 */ | 3219 */ |
2636 static const HintCode UNUSED_IMPORT = const HintCode('UNUSED_IMPORT', "Unused
import"); | 3220 static const HintCode UNUSED_IMPORT = |
| 3221 const HintCode('UNUSED_IMPORT', "Unused import"); |
2637 | 3222 |
2638 /** | 3223 /** |
2639 * Unused local variables are local varaibles which are never read. | 3224 * Unused local variables are local varaibles which are never read. |
2640 */ | 3225 */ |
2641 static const HintCode UNUSED_LOCAL_VARIABLE = const HintCode('UNUSED_LOCAL_VAR
IABLE', "The value of the local variable '{0}' is not used"); | 3226 static const HintCode UNUSED_LOCAL_VARIABLE = const HintCode( |
| 3227 'UNUSED_LOCAL_VARIABLE', |
| 3228 "The value of the local variable '{0}' is not used"); |
2642 | 3229 |
2643 /** | 3230 /** |
2644 * Hint for cases where the source expects a method or function to return a | 3231 * Hint for cases where the source expects a method or function to return a |
2645 * non-void result, but the method or function signature returns void. | 3232 * non-void result, but the method or function signature returns void. |
2646 * | 3233 * |
2647 * @param name the name of the method or function that returns void | 3234 * @param name the name of the method or function that returns void |
2648 */ | 3235 */ |
2649 static const HintCode USE_OF_VOID_RESULT = const HintCode('USE_OF_VOID_RESULT'
, "The result of '{0}' is being used, even though it is declared to be 'void'"); | 3236 static const HintCode USE_OF_VOID_RESULT = const HintCode( |
| 3237 'USE_OF_VOID_RESULT', |
| 3238 "The result of '{0}' is being used, even though it is declared to be 'void
'"); |
2650 | 3239 |
2651 /** | 3240 /** |
2652 * It is a bad practice for a source file in a package "lib" directory | 3241 * It is a bad practice for a source file in a package "lib" directory |
2653 * hierarchy to traverse outside that directory hierarchy. For example, a | 3242 * hierarchy to traverse outside that directory hierarchy. For example, a |
2654 * source file in the "lib" directory should not contain a directive such as | 3243 * source file in the "lib" directory should not contain a directive such as |
2655 * `import '../web/some.dart'` which references a file outside the lib | 3244 * `import '../web/some.dart'` which references a file outside the lib |
2656 * directory. | 3245 * directory. |
2657 */ | 3246 */ |
2658 static const HintCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = const H
intCode('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', "A file in the 'lib' d
irectory hierarchy should not reference a file outside that hierarchy"); | 3247 static const HintCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = |
| 3248 const HintCode( |
| 3249 'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', |
| 3250 "A file in the 'lib' directory hierarchy should not reference a file o
utside that hierarchy"); |
2659 | 3251 |
2660 /** | 3252 /** |
2661 * It is a bad practice for a source file ouside a package "lib" directory | 3253 * It is a bad practice for a source file ouside a package "lib" directory |
2662 * hierarchy to traverse into that directory hierarchy. For example, a source | 3254 * hierarchy to traverse into that directory hierarchy. For example, a source |
2663 * file in the "web" directory should not contain a directive such as | 3255 * file in the "web" directory should not contain a directive such as |
2664 * `import '../lib/some.dart'` which references a file inside the lib | 3256 * `import '../lib/some.dart'` which references a file inside the lib |
2665 * directory. | 3257 * directory. |
2666 */ | 3258 */ |
2667 static const HintCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = const H
intCode('FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', "A file outside the 'l
ib' directory hierarchy should not reference a file inside that hierarchy. Use a
package: reference instead."); | 3259 static const HintCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = |
| 3260 const HintCode( |
| 3261 'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', |
| 3262 "A file outside the 'lib' directory hierarchy should not reference a f
ile inside that hierarchy. Use a package: reference instead."); |
2668 | 3263 |
2669 /** | 3264 /** |
2670 * It is a bad practice for a package import to reference anything outside the | 3265 * It is a bad practice for a package import to reference anything outside the |
2671 * given package, or more generally, it is bad practice for a package import | 3266 * given package, or more generally, it is bad practice for a package import |
2672 * to contain a "..". For example, a source file should not contain a | 3267 * to contain a "..". For example, a source file should not contain a |
2673 * directive such as `import 'package:foo/../some.dart'`. | 3268 * directive such as `import 'package:foo/../some.dart'`. |
2674 */ | 3269 */ |
2675 static const HintCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const HintCode('PACKAG
E_IMPORT_CONTAINS_DOT_DOT', "A package import should not contain '..'"); | 3270 static const HintCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const HintCode( |
| 3271 'PACKAGE_IMPORT_CONTAINS_DOT_DOT', |
| 3272 "A package import should not contain '..'"); |
2676 | 3273 |
2677 /** | 3274 /** |
2678 * Initialize a newly created error code to have the given [name]. The message | 3275 * Initialize a newly created error code to have the given [name]. The message |
2679 * associated with the error will be created from the given [message] | 3276 * associated with the error will be created from the given [message] |
2680 * template. The correction associated with the error will be created from the | 3277 * template. The correction associated with the error will be created from the |
2681 * given [correction] template. | 3278 * given [correction] template. |
2682 */ | 3279 */ |
2683 const HintCode(String name, String message, [String correction]) : super(name,
message, correction); | 3280 const HintCode(String name, String message, [String correction]) |
| 3281 : super(name, message, correction); |
2684 | 3282 |
2685 @override | 3283 @override |
2686 ErrorSeverity get errorSeverity => ErrorType.HINT.severity; | 3284 ErrorSeverity get errorSeverity => ErrorType.HINT.severity; |
2687 | 3285 |
2688 @override | 3286 @override |
2689 ErrorType get type => ErrorType.HINT; | 3287 ErrorType get type => ErrorType.HINT; |
2690 } | 3288 } |
2691 | 3289 |
2692 /** | 3290 /** |
2693 * The enumeration `HtmlWarningCode` defines the error codes used for warnings | 3291 * The enumeration `HtmlWarningCode` defines the error codes used for warnings |
2694 * in HTML files. The convention for this class is for the name of the error | 3292 * in HTML files. The convention for this class is for the name of the error |
2695 * code to indicate the problem that caused the error to be generated and for | 3293 * code to indicate the problem that caused the error to be generated and for |
2696 * the error message to explain what is wrong and, when appropriate, how the | 3294 * the error message to explain what is wrong and, when appropriate, how the |
2697 * problem can be corrected. | 3295 * problem can be corrected. |
2698 */ | 3296 */ |
2699 class HtmlWarningCode extends ErrorCode { | 3297 class HtmlWarningCode extends ErrorCode { |
2700 /** | 3298 /** |
2701 * An error code indicating that the value of the 'src' attribute of a Dart | 3299 * An error code indicating that the value of the 'src' attribute of a Dart |
2702 * script tag is not a valid URI. | 3300 * script tag is not a valid URI. |
2703 * | 3301 * |
2704 * @param uri the URI that is invalid | 3302 * @param uri the URI that is invalid |
2705 */ | 3303 */ |
2706 static const HtmlWarningCode INVALID_URI = const HtmlWarningCode('INVALID_URI'
, "Invalid URI syntax: '{0}'"); | 3304 static const HtmlWarningCode INVALID_URI = |
| 3305 const HtmlWarningCode('INVALID_URI', "Invalid URI syntax: '{0}'"); |
2707 | 3306 |
2708 /** | 3307 /** |
2709 * An error code indicating that the value of the 'src' attribute of a Dart | 3308 * An error code indicating that the value of the 'src' attribute of a Dart |
2710 * script tag references a file that does not exist. | 3309 * script tag references a file that does not exist. |
2711 * | 3310 * |
2712 * @param uri the URI pointing to a non-existent file | 3311 * @param uri the URI pointing to a non-existent file |
2713 */ | 3312 */ |
2714 static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode('URI_D
OES_NOT_EXIST', "Target of URI does not exist: '{0}'"); | 3313 static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode( |
| 3314 'URI_DOES_NOT_EXIST', |
| 3315 "Target of URI does not exist: '{0}'"); |
2715 | 3316 |
2716 /** | 3317 /** |
2717 * Initialize a newly created error code to have the given [name]. The message | 3318 * Initialize a newly created error code to have the given [name]. The message |
2718 * associated with the error will be created from the given [message] | 3319 * associated with the error will be created from the given [message] |
2719 * template. The correction associated with the error will be created from the | 3320 * template. The correction associated with the error will be created from the |
2720 * given [correction] template. | 3321 * given [correction] template. |
2721 */ | 3322 */ |
2722 const HtmlWarningCode(String name, String message, [String correction]) : supe
r(name, message, correction); | 3323 const HtmlWarningCode(String name, String message, [String correction]) |
| 3324 : super(name, message, correction); |
2723 | 3325 |
2724 @override | 3326 @override |
2725 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; | 3327 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; |
2726 | 3328 |
2727 @override | 3329 @override |
2728 ErrorType get type => ErrorType.STATIC_WARNING; | 3330 ErrorType get type => ErrorType.STATIC_WARNING; |
2729 } | 3331 } |
2730 | 3332 |
2731 /** | 3333 /** |
2732 * The enumeration `PolymerCode` defines Polymer specific problems. | 3334 * The enumeration `PolymerCode` defines Polymer specific problems. |
2733 */ | 3335 */ |
2734 class PolymerCode extends ErrorCode { | 3336 class PolymerCode extends ErrorCode { |
2735 static const PolymerCode ATTRIBUTE_FIELD_NOT_PUBLISHED = const PolymerCode('AT
TRIBUTE_FIELD_NOT_PUBLISHED', "Field '{0}' in '{1}' must be @published"); | 3337 static const PolymerCode ATTRIBUTE_FIELD_NOT_PUBLISHED = const PolymerCode( |
| 3338 'ATTRIBUTE_FIELD_NOT_PUBLISHED', |
| 3339 "Field '{0}' in '{1}' must be @published"); |
2736 | 3340 |
2737 static const PolymerCode DUPLICATE_ATTRIBUTE_DEFINITION = const PolymerCode('D
UPLICATE_ATTRIBUTE_DEFINITION', "The attribute '{0}' is already defined"); | 3341 static const PolymerCode DUPLICATE_ATTRIBUTE_DEFINITION = const PolymerCode( |
| 3342 'DUPLICATE_ATTRIBUTE_DEFINITION', |
| 3343 "The attribute '{0}' is already defined"); |
2738 | 3344 |
2739 static const PolymerCode EMPTY_ATTRIBUTES = const PolymerCode('EMPTY_ATTRIBUTE
S', "Empty 'attributes' attribute is useless"); | 3345 static const PolymerCode EMPTY_ATTRIBUTES = const PolymerCode( |
| 3346 'EMPTY_ATTRIBUTES', |
| 3347 "Empty 'attributes' attribute is useless"); |
2740 | 3348 |
2741 static const PolymerCode INVALID_ATTRIBUTE_NAME = const PolymerCode('INVALID_A
TTRIBUTE_NAME', "'{0}' is not a valid name for a custom element attribute"); | 3349 static const PolymerCode INVALID_ATTRIBUTE_NAME = const PolymerCode( |
| 3350 'INVALID_ATTRIBUTE_NAME', |
| 3351 "'{0}' is not a valid name for a custom element attribute"); |
2742 | 3352 |
2743 static const PolymerCode INVALID_TAG_NAME = const PolymerCode('INVALID_TAG_NAM
E', "'{0}' is not a valid name for a custom element"); | 3353 static const PolymerCode INVALID_TAG_NAME = const PolymerCode( |
| 3354 'INVALID_TAG_NAME', |
| 3355 "'{0}' is not a valid name for a custom element"); |
2744 | 3356 |
2745 static const PolymerCode MISSING_TAG_NAME = const PolymerCode('MISSING_TAG_NAM
E', "Missing tag name of the custom element. Please include an attribute like na
me='your-tag-name'"); | 3357 static const PolymerCode MISSING_TAG_NAME = const PolymerCode( |
| 3358 'MISSING_TAG_NAME', |
| 3359 "Missing tag name of the custom element. Please include an attribute like
name='your-tag-name'"); |
2746 | 3360 |
2747 static const PolymerCode UNDEFINED_ATTRIBUTE_FIELD = const PolymerCode('UNDEFI
NED_ATTRIBUTE_FIELD', "There is no such field '{0}' in '{1}'"); | 3361 static const PolymerCode UNDEFINED_ATTRIBUTE_FIELD = const PolymerCode( |
| 3362 'UNDEFINED_ATTRIBUTE_FIELD', |
| 3363 "There is no such field '{0}' in '{1}'"); |
2748 | 3364 |
2749 /** | 3365 /** |
2750 * Initialize a newly created error code to have the given [name]. The message | 3366 * Initialize a newly created error code to have the given [name]. The message |
2751 * associated with the error will be created from the given [message] | 3367 * associated with the error will be created from the given [message] |
2752 * template. The correction associated with the error will be created from the | 3368 * template. The correction associated with the error will be created from the |
2753 * given [correction] template. | 3369 * given [correction] template. |
2754 */ | 3370 */ |
2755 const PolymerCode(String name, String message, [String correction]) : super(na
me, message, correction); | 3371 const PolymerCode(String name, String message, [String correction]) |
| 3372 : super(name, message, correction); |
2756 | 3373 |
2757 @override | 3374 @override |
2758 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 3375 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
2759 | 3376 |
2760 @override | 3377 @override |
2761 ErrorType get type => ErrorType.POLYMER; | 3378 ErrorType get type => ErrorType.POLYMER; |
2762 } | 3379 } |
2763 | 3380 |
2764 /** | 3381 /** |
2765 * The class `StaticTypeWarningCode` defines the error codes used for static | 3382 * The class `StaticTypeWarningCode` defines the error codes used for static |
2766 * type warnings. The convention for this class is for the name of the error | 3383 * type warnings. The convention for this class is for the name of the error |
2767 * code to indicate the problem that caused the error to be generated and for | 3384 * code to indicate the problem that caused the error to be generated and for |
2768 * the error message to explain what is wrong and, when appropriate, how the | 3385 * the error message to explain what is wrong and, when appropriate, how the |
2769 * problem can be corrected. | 3386 * problem can be corrected. |
2770 */ | 3387 */ |
2771 class StaticTypeWarningCode extends ErrorCode { | 3388 class StaticTypeWarningCode extends ErrorCode { |
2772 /** | 3389 /** |
2773 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose | 3390 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose |
2774 * class implements the built-in class <i>List<E></i> is allocated. | 3391 * class implements the built-in class <i>List<E></i> is allocated. |
2775 * | 3392 * |
2776 * @param numTypeArgument the number of provided type arguments | 3393 * @param numTypeArgument the number of provided type arguments |
2777 */ | 3394 */ |
2778 static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = const St
aticTypeWarningCode('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', "List literal requires e
xactly one type arguments or none, but {0} found"); | 3395 static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = |
| 3396 const StaticTypeWarningCode( |
| 3397 'EXPECTED_ONE_LIST_TYPE_ARGUMENTS', |
| 3398 "List literal requires exactly one type arguments or none, but {0} fou
nd"); |
2779 | 3399 |
2780 /** | 3400 /** |
2781 * 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class | 3401 * 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class |
2782 * implements the built-in class <i>Map<K, V></i> is allocated. | 3402 * implements the built-in class <i>Map<K, V></i> is allocated. |
2783 * | 3403 * |
2784 * @param numTypeArgument the number of provided type arguments | 3404 * @param numTypeArgument the number of provided type arguments |
2785 */ | 3405 */ |
2786 static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = const Sta
ticTypeWarningCode('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', "Map literal requires exac
tly two type arguments or none, but {0} found"); | 3406 static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = |
| 3407 const StaticTypeWarningCode( |
| 3408 'EXPECTED_TWO_MAP_TYPE_ARGUMENTS', |
| 3409 "Map literal requires exactly two type arguments or none, but {0} foun
d"); |
2787 | 3410 |
2788 /** | 3411 /** |
2789 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3412 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
2790 * It is a static type warning if <i>T</i> does not have an accessible | 3413 * It is a static type warning if <i>T</i> does not have an accessible |
2791 * instance setter named <i>v=</i>. | 3414 * instance setter named <i>v=</i>. |
2792 * | 3415 * |
2793 * See [UNDEFINED_SETTER]. | 3416 * See [UNDEFINED_SETTER]. |
2794 */ | 3417 */ |
2795 static const StaticTypeWarningCode INACCESSIBLE_SETTER = const StaticTypeWarni
ngCode('INACCESSIBLE_SETTER', ""); | 3418 static const StaticTypeWarningCode INACCESSIBLE_SETTER = |
| 3419 const StaticTypeWarningCode('INACCESSIBLE_SETTER', ""); |
2796 | 3420 |
2797 /** | 3421 /** |
2798 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause | 3422 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause |
2799 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the | 3423 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the |
2800 * same name <i>n</i> that would be inherited (because identically named | 3424 * same name <i>n</i> that would be inherited (because identically named |
2801 * members existed in several superinterfaces) then at most one member is | 3425 * members existed in several superinterfaces) then at most one member is |
2802 * inherited. | 3426 * inherited. |
2803 * | 3427 * |
2804 * If the static types <i>T<sub>1</sub>, …, T<sub>k</sub></i> of the | 3428 * If the static types <i>T<sub>1</sub>, …, T<sub>k</sub></i> of the |
2805 * members <i>m<sub>1</sub>, …, m<sub>k</sub></i> are not identical, | 3429 * members <i>m<sub>1</sub>, …, m<sub>k</sub></i> are not identical, |
2806 * then there must be a member <i>m<sub>x</sub></i> such that <i>T<sub>x</sub> | 3430 * then there must be a member <i>m<sub>x</sub></i> such that <i>T<sub>x</sub> |
2807 * <: T<sub>i</sub>, 1 <= x <= k</i> for all <i>i, 1 <= i <= | 3431 * <: T<sub>i</sub>, 1 <= x <= k</i> for all <i>i, 1 <= i <= |
2808 * k</i>, or a static type warning occurs. The member that is inherited is | 3432 * k</i>, or a static type warning occurs. The member that is inherited is |
2809 * <i>m<sub>x</sub></i>, if it exists; otherwise: | 3433 * <i>m<sub>x</sub></i>, if it exists; otherwise: |
2810 * * Let <i>numberOfPositionals</i>(<i>f</i>) denote the number of positional | 3434 * * Let <i>numberOfPositionals</i>(<i>f</i>) denote the number of positional |
2811 * parameters of a function <i>f</i>, and let | 3435 * parameters of a function <i>f</i>, and let |
2812 * <i>numberOfRequiredParams</i>(<i>f</i>) denote the number of required | 3436 * <i>numberOfRequiredParams</i>(<i>f</i>) denote the number of required |
2813 * parameters of a function <i>f</i>. Furthermore, let <i>s</i> denote the | 3437 * parameters of a function <i>f</i>. Furthermore, let <i>s</i> denote the |
2814 * set of all named parameters of the <i>m<sub>1</sub>, …, | 3438 * set of all named parameters of the <i>m<sub>1</sub>, …, |
2815 * m<sub>k</sub></i>. Then let | 3439 * m<sub>k</sub></i>. Then let |
2816 * * <i>h = max(numberOfPositionals(m<sub>i</sub>)),</i> | 3440 * * <i>h = max(numberOfPositionals(m<sub>i</sub>)),</i> |
2817 * * <i>r = min(numberOfRequiredParams(m<sub>i</sub>)), for all <i>i</i>, 1 <= | 3441 * * <i>r = min(numberOfRequiredParams(m<sub>i</sub>)), for all <i>i</i>, 1 <= |
2818 * i <= k.</i> If <i>r <= h</i> then <i>I</i> has a method named <i>n</i>, | 3442 * i <= k.</i> If <i>r <= h</i> then <i>I</i> has a method named <i>n</i>, |
2819 * with <i>r</i> required parameters of type <b>dynamic</b>, <i>h</i> | 3443 * with <i>r</i> required parameters of type <b>dynamic</b>, <i>h</i> |
2820 * positional parameters of type <b>dynamic</b>, named parameters <i>s</i> | 3444 * positional parameters of type <b>dynamic</b>, named parameters <i>s</i> |
2821 * of type <b>dynamic</b> and return type <b>dynamic</b>. | 3445 * of type <b>dynamic</b> and return type <b>dynamic</b>. |
2822 * * Otherwise none of the members <i>m<sub>1</sub>, …, | 3446 * * Otherwise none of the members <i>m<sub>1</sub>, …, |
2823 * m<sub>k</sub></i> is inherited. | 3447 * m<sub>k</sub></i> is inherited. |
2824 */ | 3448 */ |
2825 static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = const Sta
ticTypeWarningCode('INCONSISTENT_METHOD_INHERITANCE', "'{0}' is inherited by at
least two interfaces inconsistently, from {1}"); | 3449 static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = |
| 3450 const StaticTypeWarningCode( |
| 3451 'INCONSISTENT_METHOD_INHERITANCE', |
| 3452 "'{0}' is inherited by at least two interfaces inconsistently, from {1
}"); |
2826 | 3453 |
2827 /** | 3454 /** |
2828 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does | 3455 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does |
2829 * not have an accessible (3.2) instance member named <i>m</i>. | 3456 * not have an accessible (3.2) instance member named <i>m</i>. |
2830 * | 3457 * |
2831 * @param memberName the name of the static member | 3458 * @param memberName the name of the static member |
2832 * See [UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER]. | 3459 * See [UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER]. |
2833 */ | 3460 */ |
2834 static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = const St
aticTypeWarningCode('INSTANCE_ACCESS_TO_STATIC_MEMBER', "Static member '{0}' can
not be accessed using instance access"); | 3461 static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = |
| 3462 const StaticTypeWarningCode( |
| 3463 'INSTANCE_ACCESS_TO_STATIC_MEMBER', |
| 3464 "Static member '{0}' cannot be accessed using instance access"); |
2835 | 3465 |
2836 /** | 3466 /** |
2837 * 12.18 Assignment: It is a static type warning if the static type of | 3467 * 12.18 Assignment: It is a static type warning if the static type of |
2838 * <i>e</i> may not be assigned to the static type of <i>v</i>. The static | 3468 * <i>e</i> may not be assigned to the static type of <i>v</i>. The static |
2839 * type of the expression <i>v = e</i> is the static type of <i>e</i>. | 3469 * type of the expression <i>v = e</i> is the static type of <i>e</i>. |
2840 * | 3470 * |
2841 * 12.18 Assignment: It is a static type warning if the static type of | 3471 * 12.18 Assignment: It is a static type warning if the static type of |
2842 * <i>e</i> may not be assigned to the static type of <i>C.v</i>. The static | 3472 * <i>e</i> may not be assigned to the static type of <i>C.v</i>. The static |
2843 * type of the expression <i>C.v = e</i> is the static type of <i>e</i>. | 3473 * type of the expression <i>C.v = e</i> is the static type of <i>e</i>. |
2844 * | 3474 * |
2845 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3475 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
2846 * It is a static type warning if the static type of <i>e<sub>2</sub></i> may | 3476 * It is a static type warning if the static type of <i>e<sub>2</sub></i> may |
2847 * not be assigned to <i>T</i>. | 3477 * not be assigned to <i>T</i>. |
2848 * | 3478 * |
2849 * @param rhsTypeName the name of the right hand side type | 3479 * @param rhsTypeName the name of the right hand side type |
2850 * @param lhsTypeName the name of the left hand side type | 3480 * @param lhsTypeName the name of the left hand side type |
2851 */ | 3481 */ |
2852 static const StaticTypeWarningCode INVALID_ASSIGNMENT = const StaticTypeWarnin
gCode('INVALID_ASSIGNMENT', "A value of type '{0}' cannot be assigned to a varia
ble of type '{1}'"); | 3482 static const StaticTypeWarningCode INVALID_ASSIGNMENT = |
| 3483 const StaticTypeWarningCode( |
| 3484 'INVALID_ASSIGNMENT', |
| 3485 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"
); |
2853 | 3486 |
2854 /** | 3487 /** |
2855 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the | 3488 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the |
2856 * form <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 3489 * form <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
2857 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. | 3490 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. |
2858 * | 3491 * |
2859 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if | 3492 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if |
2860 * <i>T</i> does not have an accessible instance member named <i>m</i>. If | 3493 * <i>T</i> does not have an accessible instance member named <i>m</i>. If |
2861 * <i>T.m</i> exists, it is a static warning if the type <i>F</i> of | 3494 * <i>T.m</i> exists, it is a static warning if the type <i>F</i> of |
2862 * <i>T.m</i> may not be assigned to a function type. If <i>T.m</i> does not | 3495 * <i>T.m</i> may not be assigned to a function type. If <i>T.m</i> does not |
2863 * exist, or if <i>F</i> is not a function type, the static type of <i>i</i> | 3496 * exist, or if <i>F</i> is not a function type, the static type of <i>i</i> |
2864 * is dynamic. | 3497 * is dynamic. |
2865 * | 3498 * |
2866 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i> | 3499 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i> |
2867 * of <i>C.m</i> may not be assigned to a function type. | 3500 * of <i>C.m</i> may not be assigned to a function type. |
2868 * | 3501 * |
2869 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 3502 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
2870 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 3503 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
2871 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If | 3504 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If |
2872 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of | 3505 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of |
2873 * <i>S.m</i> may not be assigned to a function type. | 3506 * <i>S.m</i> may not be assigned to a function type. |
2874 * | 3507 * |
2875 * @param nonFunctionIdentifier the name of the identifier that is not a | 3508 * @param nonFunctionIdentifier the name of the identifier that is not a |
2876 * function type | 3509 * function type |
2877 */ | 3510 */ |
2878 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = const StaticTy
peWarningCode('INVOCATION_OF_NON_FUNCTION', "'{0}' is not a method"); | 3511 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = |
| 3512 const StaticTypeWarningCode( |
| 3513 'INVOCATION_OF_NON_FUNCTION', |
| 3514 "'{0}' is not a method"); |
2879 | 3515 |
2880 /** | 3516 /** |
2881 * 12.14.4 Function Expression Invocation: A function expression invocation | 3517 * 12.14.4 Function Expression Invocation: A function expression invocation |
2882 * <i>i</i> has the form <i>e<sub>f</sub>(a<sub>1</sub>, …, | 3518 * <i>i</i> has the form <i>e<sub>f</sub>(a<sub>1</sub>, …, |
2883 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: | 3519 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: |
2884 * a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i> is an expression. | 3520 * a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i> is an expression. |
2885 * | 3521 * |
2886 * It is a static type warning if the static type <i>F</i> of | 3522 * It is a static type warning if the static type <i>F</i> of |
2887 * <i>e<sub>f</sub></i> may not be assigned to a function type. | 3523 * <i>e<sub>f</sub></i> may not be assigned to a function type. |
2888 */ | 3524 */ |
2889 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = con
st StaticTypeWarningCode('INVOCATION_OF_NON_FUNCTION_EXPRESSION', "Cannot invoke
a non-function"); | 3525 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = |
| 3526 const StaticTypeWarningCode( |
| 3527 'INVOCATION_OF_NON_FUNCTION_EXPRESSION', |
| 3528 "Cannot invoke a non-function"); |
2890 | 3529 |
2891 /** | 3530 /** |
2892 * 12.20 Conditional: It is a static type warning if the type of | 3531 * 12.20 Conditional: It is a static type warning if the type of |
2893 * <i>e<sub>1</sub></i> may not be assigned to bool. | 3532 * <i>e<sub>1</sub></i> may not be assigned to bool. |
2894 * | 3533 * |
2895 * 13.5 If: It is a static type warning if the type of the expression <i>b</i> | 3534 * 13.5 If: It is a static type warning if the type of the expression <i>b</i> |
2896 * may not be assigned to bool. | 3535 * may not be assigned to bool. |
2897 * | 3536 * |
2898 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be | 3537 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be |
2899 * assigned to bool. | 3538 * assigned to bool. |
2900 * | 3539 * |
2901 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be | 3540 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be |
2902 * assigned to bool. | 3541 * assigned to bool. |
2903 */ | 3542 */ |
2904 static const StaticTypeWarningCode NON_BOOL_CONDITION = const StaticTypeWarnin
gCode('NON_BOOL_CONDITION', "Conditions must have a static type of 'bool'"); | 3543 static const StaticTypeWarningCode NON_BOOL_CONDITION = |
| 3544 const StaticTypeWarningCode( |
| 3545 'NON_BOOL_CONDITION', |
| 3546 "Conditions must have a static type of 'bool'"); |
2905 | 3547 |
2906 /** | 3548 /** |
2907 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not | 3549 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not |
2908 * be assigned to either bool or () → bool | 3550 * be assigned to either bool or () → bool |
2909 */ | 3551 */ |
2910 static const StaticTypeWarningCode NON_BOOL_EXPRESSION = const StaticTypeWarni
ngCode('NON_BOOL_EXPRESSION', "Assertions must be on either a 'bool' or '() -> b
ool'"); | 3552 static const StaticTypeWarningCode NON_BOOL_EXPRESSION = |
| 3553 const StaticTypeWarningCode( |
| 3554 'NON_BOOL_EXPRESSION', |
| 3555 "Assertions must be on either a 'bool' or '() -> bool'"); |
2911 | 3556 |
2912 /** | 3557 /** |
2913 * 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the | 3558 * 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the |
2914 * expression <i>e</i>?<b>false<b> : <b>true</b>. | 3559 * expression <i>e</i>?<b>false<b> : <b>true</b>. |
2915 * | 3560 * |
2916 * 12.20 Conditional: It is a static type warning if the type of | 3561 * 12.20 Conditional: It is a static type warning if the type of |
2917 * <i>e<sub>1</sub></i> may not be assigned to bool. | 3562 * <i>e<sub>1</sub></i> may not be assigned to bool. |
2918 */ | 3563 */ |
2919 static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION = const Static
TypeWarningCode('NON_BOOL_NEGATION_EXPRESSION', "Negation argument must have a s
tatic type of 'bool'"); | 3564 static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION = |
| 3565 const StaticTypeWarningCode( |
| 3566 'NON_BOOL_NEGATION_EXPRESSION', |
| 3567 "Negation argument must have a static type of 'bool'"); |
2920 | 3568 |
2921 /** | 3569 /** |
2922 * 12.21 Logical Boolean Expressions: It is a static type warning if the | 3570 * 12.21 Logical Boolean Expressions: It is a static type warning if the |
2923 * static types of both of <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> may | 3571 * static types of both of <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> may |
2924 * not be assigned to bool. | 3572 * not be assigned to bool. |
2925 * | 3573 * |
2926 * @param operator the lexeme of the logical operator | 3574 * @param operator the lexeme of the logical operator |
2927 */ | 3575 */ |
2928 static const StaticTypeWarningCode NON_BOOL_OPERAND = const StaticTypeWarningC
ode('NON_BOOL_OPERAND', "The operands of the '{0}' operator must be assignable t
o 'bool'"); | 3576 static const StaticTypeWarningCode NON_BOOL_OPERAND = |
| 3577 const StaticTypeWarningCode( |
| 3578 'NON_BOOL_OPERAND', |
| 3579 "The operands of the '{0}' operator must be assignable to 'bool'"); |
2929 | 3580 |
2930 /** | 3581 /** |
2931 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, | 3582 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, |
2932 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. | 3583 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. |
2933 */ | 3584 */ |
2934 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = const StaticTyp
eWarningCode('NON_TYPE_AS_TYPE_ARGUMENT', "The name '{0}' is not a type and cann
ot be used as a parameterized type"); | 3585 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = |
| 3586 const StaticTypeWarningCode( |
| 3587 'NON_TYPE_AS_TYPE_ARGUMENT', |
| 3588 "The name '{0}' is not a type and cannot be used as a parameterized ty
pe"); |
2935 | 3589 |
2936 /** | 3590 /** |
2937 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not | 3591 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not |
2938 * be assigned to the declared return type of the immediately enclosing | 3592 * be assigned to the declared return type of the immediately enclosing |
2939 * function. | 3593 * function. |
2940 * | 3594 * |
2941 * @param actualReturnType the return type as declared in the return statement | 3595 * @param actualReturnType the return type as declared in the return statement |
2942 * @param expectedReturnType the expected return type as defined by the method | 3596 * @param expectedReturnType the expected return type as defined by the method |
2943 * @param methodName the name of the method | 3597 * @param methodName the name of the method |
2944 */ | 3598 */ |
2945 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = const StaticTypeWa
rningCode('RETURN_OF_INVALID_TYPE', "The return type '{0}' is not a '{1}', as de
fined by the method '{2}'"); | 3599 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = |
| 3600 const StaticTypeWarningCode( |
| 3601 'RETURN_OF_INVALID_TYPE', |
| 3602 "The return type '{0}' is not a '{1}', as defined by the method '{2}'"
); |
2946 | 3603 |
2947 /** | 3604 /** |
2948 * 12.11 Instance Creation: It is a static type warning if any of the type | 3605 * 12.11 Instance Creation: It is a static type warning if any of the type |
2949 * arguments to a constructor of a generic type <i>G</i> invoked by a new | 3606 * arguments to a constructor of a generic type <i>G</i> invoked by a new |
2950 * expression or a constant object expression are not subtypes of the bounds | 3607 * expression or a constant object expression are not subtypes of the bounds |
2951 * of the corresponding formal type parameters of <i>G</i>. | 3608 * of the corresponding formal type parameters of <i>G</i>. |
2952 * | 3609 * |
2953 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member | 3610 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member |
2954 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of | 3611 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of |
2955 * <i>G<A<sub>1</sub>, …, A<sub>n</sub>></i> is <i>[A<sub>1</sub>
, | 3612 * <i>G<A<sub>1</sub>, …, A<sub>n</sub>></i> is <i>[A<sub>1</sub>
, |
2956 * …, A<sub>n</sub>/T<sub>1</sub>, …, T<sub>n</sub>]S</i> where | 3613 * …, A<sub>n</sub>/T<sub>1</sub>, …, T<sub>n</sub>]S</i> where |
2957 * <i>T<sub>1</sub>, …, T<sub>n</sub></i> are the formal type | 3614 * <i>T<sub>1</sub>, …, T<sub>n</sub></i> are the formal type |
2958 * parameters of <i>G</i>. Let <i>B<sub>i</sub></i> be the bounds of | 3615 * parameters of <i>G</i>. Let <i>B<sub>i</sub></i> be the bounds of |
2959 * <i>T<sub>i</sub>, 1 <= i <= n</i>. It is a static type warning if | 3616 * <i>T<sub>i</sub>, 1 <= i <= n</i>. It is a static type warning if |
2960 * <i>A<sub>i</sub></i> is not a subtype of <i>[A<sub>1</sub>, …, | 3617 * <i>A<sub>i</sub></i> is not a subtype of <i>[A<sub>1</sub>, …, |
2961 * A<sub>n</sub>/T<sub>1</sub>, …, T<sub>n</sub>]B<sub>i</sub>, 1 <= | 3618 * A<sub>n</sub>/T<sub>1</sub>, …, T<sub>n</sub>]B<sub>i</sub>, 1 <= |
2962 * i <= n</i>. | 3619 * i <= n</i>. |
2963 * | 3620 * |
2964 * 7.6.2 Factories: It is a static type warning if any of the type arguments | 3621 * 7.6.2 Factories: It is a static type warning if any of the type arguments |
2965 * to <i>k'</i> are not subtypes of the bounds of the corresponding formal | 3622 * to <i>k'</i> are not subtypes of the bounds of the corresponding formal |
2966 * type parameters of type. | 3623 * type parameters of type. |
2967 * | 3624 * |
2968 * @param boundedTypeName the name of the type used in the instance creation | 3625 * @param boundedTypeName the name of the type used in the instance creation |
2969 * that should be limited by the bound as specified in the class | 3626 * that should be limited by the bound as specified in the class |
2970 * declaration | 3627 * declaration |
2971 * @param boundingTypeName the name of the bounding type | 3628 * @param boundingTypeName the name of the bounding type |
2972 * See [TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND]. | 3629 * See [TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND]. |
2973 */ | 3630 */ |
2974 static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const S
taticTypeWarningCode('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' does not extend
'{1}'"); | 3631 static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = |
| 3632 const StaticTypeWarningCode( |
| 3633 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', |
| 3634 "'{0}' does not extend '{1}'"); |
2975 | 3635 |
2976 /** | 3636 /** |
2977 * 10 Generics: It is a static type warning if a type parameter is a supertype | 3637 * 10 Generics: It is a static type warning if a type parameter is a supertype |
2978 * of its upper bound. | 3638 * of its upper bound. |
2979 * | 3639 * |
2980 * @param typeParameterName the name of the type parameter | 3640 * @param typeParameterName the name of the type parameter |
2981 * See [TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. | 3641 * See [TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. |
2982 */ | 3642 */ |
2983 static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND = con
st StaticTypeWarningCode('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND', "'{0}' cannot
be a supertype of its upper bound"); | 3643 static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND = |
| 3644 const StaticTypeWarningCode( |
| 3645 'TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND', |
| 3646 "'{0}' cannot be a supertype of its upper bound"); |
2984 | 3647 |
2985 /** | 3648 /** |
2986 * 12.17 Getter Invocation: It is a static warning if there is no class | 3649 * 12.17 Getter Invocation: It is a static warning if there is no class |
2987 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 3650 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
2988 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 3651 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
2989 * | 3652 * |
2990 * @param constantName the name of the enumeration constant that is not | 3653 * @param constantName the name of the enumeration constant that is not |
2991 * defined | 3654 * defined |
2992 * @param enumName the name of the enumeration used to access the constant | 3655 * @param enumName the name of the enumeration used to access the constant |
2993 */ | 3656 */ |
2994 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = const StaticTypeW
arningCode('UNDEFINED_ENUM_CONSTANT', "There is no constant named '{0}' in '{1}'
"); | 3657 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = |
| 3658 const StaticTypeWarningCode( |
| 3659 'UNDEFINED_ENUM_CONSTANT', |
| 3660 "There is no constant named '{0}' in '{1}'"); |
2995 | 3661 |
2996 /** | 3662 /** |
2997 * 12.15.3 Unqualified Invocation: If there exists a lexically visible | 3663 * 12.15.3 Unqualified Invocation: If there exists a lexically visible |
2998 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost | 3664 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost |
2999 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is | 3665 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is |
3000 * considered equivalent to the ordinary method invocation | 3666 * considered equivalent to the ordinary method invocation |
3001 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, | 3667 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, |
3002 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., | 3668 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., |
3003 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). | 3669 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). |
3004 * | 3670 * |
3005 * @param methodName the name of the method that is undefined | 3671 * @param methodName the name of the method that is undefined |
3006 */ | 3672 */ |
3007 static const StaticTypeWarningCode UNDEFINED_FUNCTION = const StaticTypeWarnin
gCode('UNDEFINED_FUNCTION', "The function '{0}' is not defined"); | 3673 static const StaticTypeWarningCode UNDEFINED_FUNCTION = |
| 3674 const StaticTypeWarningCode( |
| 3675 'UNDEFINED_FUNCTION', |
| 3676 "The function '{0}' is not defined"); |
3008 | 3677 |
3009 /** | 3678 /** |
3010 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is | 3679 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
3011 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. | 3680 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
3012 * | 3681 * |
3013 * @param getterName the name of the getter | 3682 * @param getterName the name of the getter |
3014 * @param enclosingType the name of the enclosing type where the getter is | 3683 * @param enclosingType the name of the enclosing type where the getter is |
3015 * being looked for | 3684 * being looked for |
3016 */ | 3685 */ |
3017 static const StaticTypeWarningCode UNDEFINED_GETTER = const StaticTypeWarningC
ode('UNDEFINED_GETTER', "There is no such getter '{0}' in '{1}'"); | 3686 static const StaticTypeWarningCode UNDEFINED_GETTER = |
| 3687 const StaticTypeWarningCode( |
| 3688 'UNDEFINED_GETTER', |
| 3689 "There is no such getter '{0}' in '{1}'"); |
3018 | 3690 |
3019 /** | 3691 /** |
3020 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3692 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
3021 * It is a static type warning if <i>T</i> does not have an accessible | 3693 * It is a static type warning if <i>T</i> does not have an accessible |
3022 * instance member named <i>m</i>. | 3694 * instance member named <i>m</i>. |
3023 * | 3695 * |
3024 * @param methodName the name of the method that is undefined | 3696 * @param methodName the name of the method that is undefined |
3025 * @param typeName the resolved type name that the method lookup is happening | 3697 * @param typeName the resolved type name that the method lookup is happening |
3026 * on | 3698 * on |
3027 */ | 3699 */ |
3028 static const StaticTypeWarningCode UNDEFINED_METHOD = const StaticTypeWarningC
ode('UNDEFINED_METHOD', "The method '{0}' is not defined for the class '{1}'"); | 3700 static const StaticTypeWarningCode UNDEFINED_METHOD = |
| 3701 const StaticTypeWarningCode( |
| 3702 'UNDEFINED_METHOD', |
| 3703 "The method '{0}' is not defined for the class '{1}'"); |
3029 | 3704 |
3030 /** | 3705 /** |
3031 * 12.18 Assignment: Evaluation of an assignment of the form | 3706 * 12.18 Assignment: Evaluation of an assignment of the form |
3032 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is | 3707 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
3033 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); | 3708 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
3034 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, | 3709 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
3035 * <i>e<sub>2</sub></i>). | 3710 * <i>e<sub>2</sub></i>). |
3036 * | 3711 * |
3037 * 12.29 Assignable Expressions: An assignable expression of the form | 3712 * 12.29 Assignable Expressions: An assignable expression of the form |
3038 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method | 3713 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method |
3039 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument | 3714 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument |
3040 * <i>e<sub>2</sub></i>. | 3715 * <i>e<sub>2</sub></i>. |
3041 * | 3716 * |
3042 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3717 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
3043 * It is a static type warning if <i>T</i> does not have an accessible | 3718 * It is a static type warning if <i>T</i> does not have an accessible |
3044 * instance member named <i>m</i>. | 3719 * instance member named <i>m</i>. |
3045 * | 3720 * |
3046 * @param operator the name of the operator | 3721 * @param operator the name of the operator |
3047 * @param enclosingType the name of the enclosing type where the operator is | 3722 * @param enclosingType the name of the enclosing type where the operator is |
3048 * being looked for | 3723 * being looked for |
3049 */ | 3724 */ |
3050 static const StaticTypeWarningCode UNDEFINED_OPERATOR = const StaticTypeWarnin
gCode('UNDEFINED_OPERATOR', "There is no such operator '{0}' in '{1}'"); | 3725 static const StaticTypeWarningCode UNDEFINED_OPERATOR = |
| 3726 const StaticTypeWarningCode( |
| 3727 'UNDEFINED_OPERATOR', |
| 3728 "There is no such operator '{0}' in '{1}'"); |
3051 | 3729 |
3052 /** | 3730 /** |
3053 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3731 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
3054 * It is a static type warning if <i>T</i> does not have an accessible | 3732 * It is a static type warning if <i>T</i> does not have an accessible |
3055 * instance setter named <i>v=</i>. | 3733 * instance setter named <i>v=</i>. |
3056 * | 3734 * |
3057 * @param setterName the name of the setter | 3735 * @param setterName the name of the setter |
3058 * @param enclosingType the name of the enclosing type where the setter is | 3736 * @param enclosingType the name of the enclosing type where the setter is |
3059 * being looked for | 3737 * being looked for |
3060 * See [INACCESSIBLE_SETTER]. | 3738 * See [INACCESSIBLE_SETTER]. |
3061 */ | 3739 */ |
3062 static const StaticTypeWarningCode UNDEFINED_SETTER = const StaticTypeWarningC
ode('UNDEFINED_SETTER', "There is no such setter '{0}' in '{1}'"); | 3740 static const StaticTypeWarningCode UNDEFINED_SETTER = |
| 3741 const StaticTypeWarningCode( |
| 3742 'UNDEFINED_SETTER', |
| 3743 "There is no such setter '{0}' in '{1}'"); |
3063 | 3744 |
3064 /** | 3745 /** |
3065 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 3746 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
3066 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 3747 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
3067 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 3748 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
3068 * static type warning if <i>S</i> does not have an accessible instance member | 3749 * static type warning if <i>S</i> does not have an accessible instance member |
3069 * named <i>m</i>. | 3750 * named <i>m</i>. |
3070 * | 3751 * |
3071 * @param methodName the name of the method that is undefined | 3752 * @param methodName the name of the method that is undefined |
3072 * @param typeName the resolved type name that the method lookup is happening | 3753 * @param typeName the resolved type name that the method lookup is happening |
3073 * on | 3754 * on |
3074 */ | 3755 */ |
3075 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = const StaticTypeWa
rningCode('UNDEFINED_SUPER_METHOD', "There is no such method '{0}' in '{1}'"); | 3756 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = |
| 3757 const StaticTypeWarningCode( |
| 3758 'UNDEFINED_SUPER_METHOD', |
| 3759 "There is no such method '{0}' in '{1}'"); |
3076 | 3760 |
3077 /** | 3761 /** |
3078 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does | 3762 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does |
3079 * not have an accessible (3.2) instance member named <i>m</i>. | 3763 * not have an accessible (3.2) instance member named <i>m</i>. |
3080 * | 3764 * |
3081 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used | 3765 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used |
3082 * when we are able to find the name defined in a supertype. It exists to | 3766 * when we are able to find the name defined in a supertype. It exists to |
3083 * provide a more informative error message. | 3767 * provide a more informative error message. |
3084 */ | 3768 */ |
3085 static const StaticTypeWarningCode UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_M
EMBER = const StaticTypeWarningCode('UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_M
EMBER', "Static members from supertypes must be qualified by the name of the def
ining type"); | 3769 static const StaticTypeWarningCode |
| 3770 UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = |
| 3771 const StaticTypeWarningCode( |
| 3772 'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER', |
| 3773 "Static members from supertypes must be qualified by the name of the d
efining type"); |
3086 | 3774 |
3087 /** | 3775 /** |
3088 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a | 3776 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a |
3089 * generic type with exactly <i>n</i> type parameters. | 3777 * generic type with exactly <i>n</i> type parameters. |
3090 * | 3778 * |
3091 * @param typeName the name of the type being referenced (<i>G</i>) | 3779 * @param typeName the name of the type being referenced (<i>G</i>) |
3092 * @param parameterCount the number of type parameters that were declared | 3780 * @param parameterCount the number of type parameters that were declared |
3093 * @param argumentCount the number of type arguments provided | 3781 * @param argumentCount the number of type arguments provided |
3094 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and | 3782 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and |
3095 * [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]. | 3783 * [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]. |
3096 */ | 3784 */ |
3097 static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = const Stat
icTypeWarningCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', "The type '{0}' is declared
with {1} type parameters, but {2} type arguments were given"); | 3785 static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = |
| 3786 const StaticTypeWarningCode( |
| 3787 'WRONG_NUMBER_OF_TYPE_ARGUMENTS', |
| 3788 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); |
3098 | 3789 |
3099 /** | 3790 /** |
3100 * Initialize a newly created error code to have the given [name]. The message | 3791 * Initialize a newly created error code to have the given [name]. The message |
3101 * associated with the error will be created from the given [message] | 3792 * associated with the error will be created from the given [message] |
3102 * template. The correction associated with the error will be created from the | 3793 * template. The correction associated with the error will be created from the |
3103 * given [correction] template. | 3794 * given [correction] template. |
3104 */ | 3795 */ |
3105 const StaticTypeWarningCode(String name, String message, [String correction])
: super(name, message, correction); | 3796 const StaticTypeWarningCode(String name, String message, [String correction]) |
| 3797 : super(name, message, correction); |
3106 | 3798 |
3107 @override | 3799 @override |
3108 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; | 3800 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; |
3109 | 3801 |
3110 @override | 3802 @override |
3111 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; | 3803 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; |
3112 } | 3804 } |
3113 | 3805 |
3114 /** | 3806 /** |
3115 * The enumeration `StaticWarningCode` defines the error codes used for static | 3807 * The enumeration `StaticWarningCode` defines the error codes used for static |
(...skipping 11 matching lines...) Expand all Loading... |
3127 * 2. If <i>N</i> is referenced as a function, getter or setter, a | 3819 * 2. If <i>N</i> is referenced as a function, getter or setter, a |
3128 * <i>NoSuchMethodError</i> is raised. | 3820 * <i>NoSuchMethodError</i> is raised. |
3129 * 3. If <i>N</i> is referenced as a type, it is treated as a malformed type. | 3821 * 3. If <i>N</i> is referenced as a type, it is treated as a malformed type. |
3130 * | 3822 * |
3131 * @param ambiguousTypeName the name of the ambiguous type | 3823 * @param ambiguousTypeName the name of the ambiguous type |
3132 * @param firstLibraryName the name of the first library that the type is | 3824 * @param firstLibraryName the name of the first library that the type is |
3133 * found | 3825 * found |
3134 * @param secondLibraryName the name of the second library that the type is | 3826 * @param secondLibraryName the name of the second library that the type is |
3135 * found | 3827 * found |
3136 */ | 3828 */ |
3137 static const StaticWarningCode AMBIGUOUS_IMPORT = const StaticWarningCode('AMB
IGUOUS_IMPORT', "The name '{0}' is defined in the libraries {1}"); | 3829 static const StaticWarningCode AMBIGUOUS_IMPORT = const StaticWarningCode( |
| 3830 'AMBIGUOUS_IMPORT', |
| 3831 "The name '{0}' is defined in the libraries {1}"); |
3138 | 3832 |
3139 /** | 3833 /** |
3140 * 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>, | 3834 * 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>, |
3141 * 1 <= i <= n+ k</i> may not be assigned to the type of the | 3835 * 1 <= i <= n+ k</i> may not be assigned to the type of the |
3142 * corresponding formal parameter of the constructor <i>T.id</i> (respectively | 3836 * corresponding formal parameter of the constructor <i>T.id</i> (respectively |
3143 * <i>T</i>). | 3837 * <i>T</i>). |
3144 * | 3838 * |
3145 * 12.11.2 Const: It is a static warning if the static type of | 3839 * 12.11.2 Const: It is a static warning if the static type of |
3146 * <i>a<sub>i</sub>, 1 <= i <= n+ k</i> may not be assigned to the type | 3840 * <i>a<sub>i</sub>, 1 <= i <= n+ k</i> may not be assigned to the type |
3147 * of the corresponding formal parameter of the constructor <i>T.id</i> | 3841 * of the corresponding formal parameter of the constructor <i>T.id</i> |
3148 * (respectively <i>T</i>). | 3842 * (respectively <i>T</i>). |
3149 * | 3843 * |
3150 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 3844 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
3151 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 3845 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
3152 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 3846 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
3153 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 3847 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
3154 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 3848 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
3155 * <= j <= m</i>. | 3849 * <= j <= m</i>. |
3156 * | 3850 * |
3157 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub>, 1 | 3851 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub>, 1 |
3158 * <= i <= l</i>, must have a corresponding named parameter in the set | 3852 * <= i <= l</i>, must have a corresponding named parameter in the set |
3159 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning | 3853 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning |
3160 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be | 3854 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be |
3161 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j | 3855 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j |
3162 * <= l</i>. | 3856 * <= l</i>. |
3163 * | 3857 * |
3164 * @param actualType the name of the actual argument type | 3858 * @param actualType the name of the actual argument type |
3165 * @param expectedType the name of the expected type | 3859 * @param expectedType the name of the expected type |
3166 */ | 3860 */ |
3167 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const StaticWarn
ingCode('ARGUMENT_TYPE_NOT_ASSIGNABLE', "The argument type '{0}' cannot be assig
ned to the parameter type '{1}'"); | 3861 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = |
| 3862 const StaticWarningCode( |
| 3863 'ARGUMENT_TYPE_NOT_ASSIGNABLE', |
| 3864 "The argument type '{0}' cannot be assigned to the parameter type '{1}
'"); |
3168 | 3865 |
3169 /** | 3866 /** |
3170 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 3867 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
3171 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 3868 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
3172 * assignment will also give rise to a static warning for the same reason. | 3869 * assignment will also give rise to a static warning for the same reason. |
3173 * | 3870 * |
3174 * A constant variable is always implicitly final. | 3871 * A constant variable is always implicitly final. |
3175 */ | 3872 */ |
3176 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode('
ASSIGNMENT_TO_CONST', "Constant variables cannot be assigned a value"); | 3873 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode( |
| 3874 'ASSIGNMENT_TO_CONST', |
| 3875 "Constant variables cannot be assigned a value"); |
3177 | 3876 |
3178 /** | 3877 /** |
3179 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 3878 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
3180 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 3879 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
3181 * assignment will also give rise to a static warning for the same reason. | 3880 * assignment will also give rise to a static warning for the same reason. |
3182 */ | 3881 */ |
3183 static const StaticWarningCode ASSIGNMENT_TO_FINAL = const StaticWarningCode('
ASSIGNMENT_TO_FINAL', "'{0}' cannot be used as a setter, it is final"); | 3882 static const StaticWarningCode ASSIGNMENT_TO_FINAL = const StaticWarningCode( |
| 3883 'ASSIGNMENT_TO_FINAL', |
| 3884 "'{0}' cannot be used as a setter, it is final"); |
3184 | 3885 |
3185 /** | 3886 /** |
3186 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 3887 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
3187 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 3888 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
3188 * assignment will also give rise to a static warning for the same reason. | 3889 * assignment will also give rise to a static warning for the same reason. |
3189 */ | 3890 */ |
3190 static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER = const StaticWar
ningCode('ASSIGNMENT_TO_FINAL_NO_SETTER', "No setter named '{0}' in class '{1}'"
); | 3891 static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER = |
| 3892 const StaticWarningCode( |
| 3893 'ASSIGNMENT_TO_FINAL_NO_SETTER', |
| 3894 "No setter named '{0}' in class '{1}'"); |
3191 | 3895 |
3192 /** | 3896 /** |
3193 * 12.18 Assignment: It is as static warning if an assignment of the form | 3897 * 12.18 Assignment: It is as static warning if an assignment of the form |
3194 * <i>v = e</i> occurs inside a top level or static function (be it function, | 3898 * <i>v = e</i> occurs inside a top level or static function (be it function, |
3195 * method, getter, or setter) or variable initializer and there is neither a | 3899 * method, getter, or setter) or variable initializer and there is neither a |
3196 * local variable declaration with name <i>v</i> nor setter declaration with | 3900 * local variable declaration with name <i>v</i> nor setter declaration with |
3197 * name <i>v=</i> in the lexical scope enclosing the assignment. | 3901 * name <i>v=</i> in the lexical scope enclosing the assignment. |
3198 */ | 3902 */ |
3199 static const StaticWarningCode ASSIGNMENT_TO_FUNCTION = const StaticWarningCod
e('ASSIGNMENT_TO_FUNCTION', "Functions cannot be assigned a value"); | 3903 static const StaticWarningCode ASSIGNMENT_TO_FUNCTION = |
| 3904 const StaticWarningCode( |
| 3905 'ASSIGNMENT_TO_FUNCTION', |
| 3906 "Functions cannot be assigned a value"); |
3200 | 3907 |
3201 /** | 3908 /** |
3202 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i> | 3909 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i> |
3203 * It is a static type warning if <i>T</i> does not have an accessible | 3910 * It is a static type warning if <i>T</i> does not have an accessible |
3204 * instance setter named <i>v=</i>. | 3911 * instance setter named <i>v=</i>. |
3205 */ | 3912 */ |
3206 static const StaticWarningCode ASSIGNMENT_TO_METHOD = const StaticWarningCode(
'ASSIGNMENT_TO_METHOD', "Methods cannot be assigned a value"); | 3913 static const StaticWarningCode ASSIGNMENT_TO_METHOD = const StaticWarningCode( |
| 3914 'ASSIGNMENT_TO_METHOD', |
| 3915 "Methods cannot be assigned a value"); |
3207 | 3916 |
3208 /** | 3917 /** |
3209 * 13.9 Switch: It is a static warning if the last statement of the statement | 3918 * 13.9 Switch: It is a static warning if the last statement of the statement |
3210 * sequence <i>s<sub>k</sub></i> is not a break, continue, return or throw | 3919 * sequence <i>s<sub>k</sub></i> is not a break, continue, return or throw |
3211 * statement. | 3920 * statement. |
3212 */ | 3921 */ |
3213 static const StaticWarningCode CASE_BLOCK_NOT_TERMINATED = const StaticWarning
Code('CASE_BLOCK_NOT_TERMINATED', "The last statement of the 'case' should be 'b
reak', 'continue', 'return' or 'throw'"); | 3922 static const StaticWarningCode CASE_BLOCK_NOT_TERMINATED = |
| 3923 const StaticWarningCode( |
| 3924 'CASE_BLOCK_NOT_TERMINATED', |
| 3925 "The last statement of the 'case' should be 'break', 'continue', 'retu
rn' or 'throw'"); |
3214 | 3926 |
3215 /** | 3927 /** |
3216 * 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type | 3928 * 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type |
3217 * available in the current lexical scope. | 3929 * available in the current lexical scope. |
3218 */ | 3930 */ |
3219 static const StaticWarningCode CAST_TO_NON_TYPE = const StaticWarningCode('CAS
T_TO_NON_TYPE', "The name '{0}' is not a type and cannot be used in an 'as' expr
ession"); | 3931 static const StaticWarningCode CAST_TO_NON_TYPE = const StaticWarningCode( |
| 3932 'CAST_TO_NON_TYPE', |
| 3933 "The name '{0}' is not a type and cannot be used in an 'as' expression"); |
3220 | 3934 |
3221 /** | 3935 /** |
3222 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 3936 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
3223 * is declared or inherited in a concrete class. | 3937 * is declared or inherited in a concrete class. |
3224 */ | 3938 */ |
3225 static const StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = const Sta
ticWarningCode('CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', "'{0}' must have a method
body because '{1}' is not abstract"); | 3939 static const StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = |
| 3940 const StaticWarningCode( |
| 3941 'CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', |
| 3942 "'{0}' must have a method body because '{1}' is not abstract"); |
3226 | 3943 |
3227 /** | 3944 /** |
3228 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and | 3945 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and |
3229 * <i>N</i> would be introduced into the top level scope of <i>L</i> by an | 3946 * <i>N</i> would be introduced into the top level scope of <i>L</i> by an |
3230 * import from a library whose URI begins with <i>dart:</i> and an import from | 3947 * import from a library whose URI begins with <i>dart:</i> and an import from |
3231 * a library whose URI does not begin with <i>dart:</i>: | 3948 * a library whose URI does not begin with <i>dart:</i>: |
3232 * * The import from <i>dart:</i> is implicitly extended by a hide N clause. | 3949 * * The import from <i>dart:</i> is implicitly extended by a hide N clause. |
3233 * * A static warning is issued. | 3950 * * A static warning is issued. |
3234 * | 3951 * |
3235 * @param ambiguousName the ambiguous name | 3952 * @param ambiguousName the ambiguous name |
3236 * @param sdkLibraryName the name of the dart: library that the element is | 3953 * @param sdkLibraryName the name of the dart: library that the element is |
3237 * found | 3954 * found |
3238 * @param otherLibraryName the name of the non-dart: library that the element | 3955 * @param otherLibraryName the name of the non-dart: library that the element |
3239 * is found | 3956 * is found |
3240 */ | 3957 */ |
3241 static const StaticWarningCode CONFLICTING_DART_IMPORT = const StaticWarningCo
de('CONFLICTING_DART_IMPORT', "Element '{0}' from SDK library '{1}' is implicitl
y hidden by '{2}'"); | 3958 static const StaticWarningCode CONFLICTING_DART_IMPORT = |
| 3959 const StaticWarningCode( |
| 3960 'CONFLICTING_DART_IMPORT', |
| 3961 "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'"); |
3242 | 3962 |
3243 /** | 3963 /** |
3244 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an | 3964 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an |
3245 * instance getter named <i>v</i> and an accessible static member named | 3965 * instance getter named <i>v</i> and an accessible static member named |
3246 * <i>v</i> or <i>v=</i> is declared in a superclass of <i>C</i>. | 3966 * <i>v</i> or <i>v=</i> is declared in a superclass of <i>C</i>. |
3247 * | 3967 * |
3248 * @param superName the name of the super class declaring a static member | 3968 * @param superName the name of the super class declaring a static member |
3249 */ | 3969 */ |
3250 static const StaticWarningCode CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMB
ER = const StaticWarningCode('CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER'
, "Superclass '{0}' declares static member with the same name"); | 3970 static const StaticWarningCode |
| 3971 CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER = |
| 3972 const StaticWarningCode( |
| 3973 'CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER', |
| 3974 "Superclass '{0}' declares static member with the same name"); |
3251 | 3975 |
3252 /** | 3976 /** |
3253 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3977 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
3254 * an instance method named <i>n</i> and has a setter named <i>n=</i>. | 3978 * an instance method named <i>n</i> and has a setter named <i>n=</i>. |
3255 */ | 3979 */ |
3256 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER = const Stat
icWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER', "Class '{0}' declares instan
ce method '{1}', but also has a setter with the same name from '{2}'"); | 3980 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER = |
| 3981 const StaticWarningCode( |
| 3982 'CONFLICTING_INSTANCE_METHOD_SETTER', |
| 3983 "Class '{0}' declares instance method '{1}', but also has a setter wit
h the same name from '{2}'"); |
3257 | 3984 |
3258 /** | 3985 /** |
3259 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3986 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
3260 * an instance method named <i>n</i> and has a setter named <i>n=</i>. | 3987 * an instance method named <i>n</i> and has a setter named <i>n=</i>. |
3261 */ | 3988 */ |
3262 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 = const Sta
ticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER2', "Class '{0}' declares the
setter '{1}', but also has an instance method in the same class"); | 3989 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 = |
| 3990 const StaticWarningCode( |
| 3991 'CONFLICTING_INSTANCE_METHOD_SETTER2', |
| 3992 "Class '{0}' declares the setter '{1}', but also has an instance metho
d in the same class"); |
3263 | 3993 |
3264 /** | 3994 /** |
3265 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an | 3995 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an |
3266 * instance setter named <i>v=</i> and an accessible static member named | 3996 * instance setter named <i>v=</i> and an accessible static member named |
3267 * <i>v=</i> or <i>v</i> is declared in a superclass of <i>C</i>. | 3997 * <i>v=</i> or <i>v</i> is declared in a superclass of <i>C</i>. |
3268 * | 3998 * |
3269 * @param superName the name of the super class declaring a static member | 3999 * @param superName the name of the super class declaring a static member |
3270 */ | 4000 */ |
3271 static const StaticWarningCode CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMB
ER = const StaticWarningCode('CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER'
, "Superclass '{0}' declares static member with the same name"); | 4001 static const StaticWarningCode |
| 4002 CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER = |
| 4003 const StaticWarningCode( |
| 4004 'CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER', |
| 4005 "Superclass '{0}' declares static member with the same name"); |
3272 | 4006 |
3273 /** | 4007 /** |
3274 * 7.2 Getters: It is a static warning if a class declares a static getter | 4008 * 7.2 Getters: It is a static warning if a class declares a static getter |
3275 * named <i>v</i> and also has a non-static setter named <i>v=</i>. | 4009 * named <i>v</i> and also has a non-static setter named <i>v=</i>. |
3276 */ | 4010 */ |
3277 static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER =
const StaticWarningCode('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', "Class
'{0}' declares non-static setter with the same name"); | 4011 static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER = |
| 4012 const StaticWarningCode( |
| 4013 'CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', |
| 4014 "Class '{0}' declares non-static setter with the same name"); |
3278 | 4015 |
3279 /** | 4016 /** |
3280 * 7.3 Setters: It is a static warning if a class declares a static setter | 4017 * 7.3 Setters: It is a static warning if a class declares a static setter |
3281 * named <i>v=</i> and also has a non-static member named <i>v</i>. | 4018 * named <i>v=</i> and also has a non-static member named <i>v</i>. |
3282 */ | 4019 */ |
3283 static const StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER =
const StaticWarningCode('CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER', "Class
'{0}' declares non-static member with the same name"); | 4020 static const StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER = |
| 4021 const StaticWarningCode( |
| 4022 'CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER', |
| 4023 "Class '{0}' declares non-static member with the same name"); |
3284 | 4024 |
3285 /** | 4025 /** |
3286 * 12.11.2 Const: Given an instance creation expression of the form <i>const | 4026 * 12.11.2 Const: Given an instance creation expression of the form <i>const |
3287 * q(a<sub>1</sub>, … a<sub>n</sub>)</i> it is a static warning if | 4027 * q(a<sub>1</sub>, … a<sub>n</sub>)</i> it is a static warning if |
3288 * <i>q</i> is the constructor of an abstract class but <i>q</i> is not a | 4028 * <i>q</i> is the constructor of an abstract class but <i>q</i> is not a |
3289 * factory constructor. | 4029 * factory constructor. |
3290 */ | 4030 */ |
3291 static const StaticWarningCode CONST_WITH_ABSTRACT_CLASS = const StaticWarning
Code('CONST_WITH_ABSTRACT_CLASS', "Abstract classes cannot be created with a 'co
nst' expression"); | 4031 static const StaticWarningCode CONST_WITH_ABSTRACT_CLASS = |
| 4032 const StaticWarningCode( |
| 4033 'CONST_WITH_ABSTRACT_CLASS', |
| 4034 "Abstract classes cannot be created with a 'const' expression"); |
3292 | 4035 |
3293 /** | 4036 /** |
3294 * 12.7 Maps: It is a static warning if the values of any two keys in a map | 4037 * 12.7 Maps: It is a static warning if the values of any two keys in a map |
3295 * literal are equal. | 4038 * literal are equal. |
3296 */ | 4039 */ |
3297 static const StaticWarningCode EQUAL_KEYS_IN_MAP = const StaticWarningCode('EQ
UAL_KEYS_IN_MAP', "Keys in a map cannot be equal"); | 4040 static const StaticWarningCode EQUAL_KEYS_IN_MAP = |
| 4041 const StaticWarningCode('EQUAL_KEYS_IN_MAP', "Keys in a map cannot be equa
l"); |
3298 | 4042 |
3299 /** | 4043 /** |
3300 * 14.2 Exports: It is a static warning to export two different libraries with | 4044 * 14.2 Exports: It is a static warning to export two different libraries with |
3301 * the same name. | 4045 * the same name. |
3302 * | 4046 * |
3303 * @param uri1 the uri pointing to a first library | 4047 * @param uri1 the uri pointing to a first library |
3304 * @param uri2 the uri pointing to a second library | 4048 * @param uri2 the uri pointing to a second library |
3305 * @param name the shared name of the exported libraries | 4049 * @param name the shared name of the exported libraries |
3306 */ | 4050 */ |
3307 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAMED | 4051 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAMED = |
3308 = const StaticWarningCode( | 4052 const StaticWarningCode( |
3309 'EXPORT_DUPLICATED_LIBRARY_NAMED', | 4053 'EXPORT_DUPLICATED_LIBRARY_NAMED', |
3310 "The exported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); | 4054 "The exported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); |
3311 | 4055 |
3312 /** | 4056 /** |
3313 * 14.2 Exports: It is a static warning to export two different libraries with | 4057 * 14.2 Exports: It is a static warning to export two different libraries with |
3314 * the same name. | 4058 * the same name. |
3315 * | 4059 * |
3316 * @param uri1 the uri pointing to a first library | 4060 * @param uri1 the uri pointing to a first library |
3317 * @param uri2 the uri pointing to a second library | 4061 * @param uri2 the uri pointing to a second library |
3318 */ | 4062 */ |
3319 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_UNNAMED | 4063 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_UNNAMED = |
3320 = const StaticWarningCode( | 4064 const StaticWarningCode( |
3321 'EXPORT_DUPLICATED_LIBRARY_UNNAMED', | 4065 'EXPORT_DUPLICATED_LIBRARY_UNNAMED', |
3322 "The exported libraries '{0}' and '{1}' cannot both be unnamed"); | 4066 "The exported libraries '{0}' and '{1}' cannot both be unnamed"); |
3323 | 4067 |
3324 /** | 4068 /** |
3325 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < | 4069 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < |
3326 * h</i> or if <i>m > n</i>. | 4070 * h</i> or if <i>m > n</i>. |
3327 * | 4071 * |
3328 * @param requiredCount the maximum number of positional arguments | 4072 * @param requiredCount the maximum number of positional arguments |
3329 * @param argumentCount the actual number of positional arguments given | 4073 * @param argumentCount the actual number of positional arguments given |
3330 * See [NOT_ENOUGH_REQUIRED_ARGUMENTS]. | 4074 * See [NOT_ENOUGH_REQUIRED_ARGUMENTS]. |
3331 */ | 4075 */ |
3332 static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = const StaticWarnin
gCode('EXTRA_POSITIONAL_ARGUMENTS', "{0} positional arguments expected, but {1}
found"); | 4076 static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = |
| 4077 const StaticWarningCode( |
| 4078 'EXTRA_POSITIONAL_ARGUMENTS', |
| 4079 "{0} positional arguments expected, but {1} found"); |
3333 | 4080 |
3334 /** | 4081 /** |
3335 * 5. Variables: It is a static warning if a final instance variable that has | 4082 * 5. Variables: It is a static warning if a final instance variable that has |
3336 * been initialized at its point of declaration is also initialized in a | 4083 * been initialized at its point of declaration is also initialized in a |
3337 * constructor. | 4084 * constructor. |
3338 */ | 4085 */ |
3339 static const StaticWarningCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATIO
N = const StaticWarningCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION',
"Values cannot be set in the constructor if they are final, and have already bee
n set"); | 4086 static const StaticWarningCode |
| 4087 FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = |
| 4088 const StaticWarningCode( |
| 4089 'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', |
| 4090 "Values cannot be set in the constructor if they are final, and have a
lready been set"); |
3340 | 4091 |
3341 /** | 4092 /** |
3342 * 5. Variables: It is a static warning if a final instance variable that has | 4093 * 5. Variables: It is a static warning if a final instance variable that has |
3343 * been initialized at its point of declaration is also initialized in a | 4094 * been initialized at its point of declaration is also initialized in a |
3344 * constructor. | 4095 * constructor. |
3345 * | 4096 * |
3346 * @param name the name of the field in question | 4097 * @param name the name of the field in question |
3347 */ | 4098 */ |
3348 static const StaticWarningCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTO
R = const StaticWarningCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR',
"'{0}' is final and was given a value when it was declared, so it cannot be set
to a new value"); | 4099 static const StaticWarningCode |
| 4100 FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = |
| 4101 const StaticWarningCode( |
| 4102 'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', |
| 4103 "'{0}' is final and was given a value when it was declared, so it cann
ot be set to a new value"); |
3349 | 4104 |
3350 /** | 4105 /** |
3351 * 7.6.1 Generative Constructors: Execution of an initializer of the form | 4106 * 7.6.1 Generative Constructors: Execution of an initializer of the form |
3352 * <b>this</b>.<i>v</i> = <i>e</i> proceeds as follows: First, the expression | 4107 * <b>this</b>.<i>v</i> = <i>e</i> proceeds as follows: First, the expression |
3353 * <i>e</i> is evaluated to an object <i>o</i>. Then, the instance variable | 4108 * <i>e</i> is evaluated to an object <i>o</i>. Then, the instance variable |
3354 * <i>v</i> of the object denoted by this is bound to <i>o</i>. | 4109 * <i>v</i> of the object denoted by this is bound to <i>o</i>. |
3355 * | 4110 * |
3356 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 4111 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
3357 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 4112 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
3358 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 4113 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
3359 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 4114 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
3360 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 4115 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
3361 * <= j <= m</i>. | 4116 * <= j <= m</i>. |
3362 * | 4117 * |
3363 * @param initializerType the name of the type of the initializer expression | 4118 * @param initializerType the name of the type of the initializer expression |
3364 * @param fieldType the name of the type of the field | 4119 * @param fieldType the name of the type of the field |
3365 */ | 4120 */ |
3366 static const StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE = const Static
WarningCode('FIELD_INITIALIZER_NOT_ASSIGNABLE', "The initializer type '{0}' cann
ot be assigned to the field type '{1}'"); | 4121 static const StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE = |
| 4122 const StaticWarningCode( |
| 4123 'FIELD_INITIALIZER_NOT_ASSIGNABLE', |
| 4124 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); |
3367 | 4125 |
3368 /** | 4126 /** |
3369 * 7.6.1 Generative Constructors: An initializing formal has the form | 4127 * 7.6.1 Generative Constructors: An initializing formal has the form |
3370 * <i>this.id</i>. It is a static warning if the static type of <i>id</i> is | 4128 * <i>this.id</i>. It is a static warning if the static type of <i>id</i> is |
3371 * not assignable to <i>T<sub>id</sub></i>. | 4129 * not assignable to <i>T<sub>id</sub></i>. |
3372 * | 4130 * |
3373 * @param parameterType the name of the type of the field formal parameter | 4131 * @param parameterType the name of the type of the field formal parameter |
3374 * @param fieldType the name of the type of the field | 4132 * @param fieldType the name of the type of the field |
3375 */ | 4133 */ |
3376 static const StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = cons
t StaticWarningCode('FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', "The parameter t
ype '{0}' is incompatable with the field type '{1}'"); | 4134 static const StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = |
| 4135 const StaticWarningCode( |
| 4136 'FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', |
| 4137 "The parameter type '{0}' is incompatable with the field type '{1}'"); |
3377 | 4138 |
3378 /** | 4139 /** |
3379 * 5 Variables: It is a static warning if a library, static or local variable | 4140 * 5 Variables: It is a static warning if a library, static or local variable |
3380 * <i>v</i> is final and <i>v</i> is not initialized at its point of | 4141 * <i>v</i> is final and <i>v</i> is not initialized at its point of |
3381 * declaration. | 4142 * declaration. |
3382 * | 4143 * |
3383 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> | 4144 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> |
3384 * declared in the immediately enclosing class must have an initializer in | 4145 * declared in the immediately enclosing class must have an initializer in |
3385 * <i>k</i>'s initializer list unless it has already been initialized by one | 4146 * <i>k</i>'s initializer list unless it has already been initialized by one |
3386 * of the following means: | 4147 * of the following means: |
3387 * * Initialization at the declaration of <i>f</i>. | 4148 * * Initialization at the declaration of <i>f</i>. |
3388 * * Initialization by means of an initializing formal of <i>k</i>. | 4149 * * Initialization by means of an initializing formal of <i>k</i>. |
3389 * or a static warning occurs. | 4150 * or a static warning occurs. |
3390 * | 4151 * |
3391 * @param name the name of the uninitialized final variable | 4152 * @param name the name of the uninitialized final variable |
3392 */ | 4153 */ |
3393 static const StaticWarningCode FINAL_NOT_INITIALIZED = const StaticWarningCode
('FINAL_NOT_INITIALIZED', "The final variable '{0}' must be initialized"); | 4154 static const StaticWarningCode FINAL_NOT_INITIALIZED = |
| 4155 const StaticWarningCode( |
| 4156 'FINAL_NOT_INITIALIZED', |
| 4157 "The final variable '{0}' must be initialized"); |
3394 | 4158 |
3395 /** | 4159 /** |
3396 * 15.5 Function Types: It is a static warning if a concrete class implements | 4160 * 15.5 Function Types: It is a static warning if a concrete class implements |
3397 * Function and does not have a concrete method named call(). | 4161 * Function and does not have a concrete method named call(). |
3398 */ | 4162 */ |
3399 static const StaticWarningCode FUNCTION_WITHOUT_CALL = const StaticWarningCode
('FUNCTION_WITHOUT_CALL', "Concrete classes that implement Function must impleme
nt the method call()"); | 4163 static const StaticWarningCode FUNCTION_WITHOUT_CALL = |
| 4164 const StaticWarningCode( |
| 4165 'FUNCTION_WITHOUT_CALL', |
| 4166 "Concrete classes that implement Function must implement the method ca
ll()"); |
3400 | 4167 |
3401 /** | 4168 /** |
3402 * 14.1 Imports: It is a static warning to import two different libraries with | 4169 * 14.1 Imports: It is a static warning to import two different libraries with |
3403 * the same name. | 4170 * the same name. |
3404 * | 4171 * |
3405 * @param uri1 the uri pointing to a first library | 4172 * @param uri1 the uri pointing to a first library |
3406 * @param uri2 the uri pointing to a second library | 4173 * @param uri2 the uri pointing to a second library |
3407 * @param name the shared name of the imported libraries | 4174 * @param name the shared name of the imported libraries |
3408 */ | 4175 */ |
3409 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAMED | 4176 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAMED = |
3410 = const StaticWarningCode( | 4177 const StaticWarningCode( |
3411 'IMPORT_DUPLICATED_LIBRARY_NAMED', | 4178 'IMPORT_DUPLICATED_LIBRARY_NAMED', |
3412 "The imported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); | 4179 "The imported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); |
3413 | 4180 |
3414 /** | 4181 /** |
3415 * 14.1 Imports: It is a static warning to import two different libraries with | 4182 * 14.1 Imports: It is a static warning to import two different libraries with |
3416 * the same name. | 4183 * the same name. |
3417 * | 4184 * |
3418 * @param uri1 the uri pointing to a first library | 4185 * @param uri1 the uri pointing to a first library |
3419 * @param uri2 the uri pointing to a second library | 4186 * @param uri2 the uri pointing to a second library |
3420 */ | 4187 */ |
3421 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_UNNAMED | 4188 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_UNNAMED = |
3422 = const StaticWarningCode( | 4189 const StaticWarningCode( |
3423 'IMPORT_DUPLICATED_LIBRARY_UNNAMED', | 4190 'IMPORT_DUPLICATED_LIBRARY_UNNAMED', |
3424 "The imported libraries '{0}' and '{1}' cannot both be unnamed"); | 4191 "The imported libraries '{0}' and '{1}' cannot both be unnamed"); |
3425 | 4192 |
3426 /** | 4193 /** |
3427 * 14.1 Imports: It is a static warning if the specified URI of a deferred | 4194 * 14.1 Imports: It is a static warning if the specified URI of a deferred |
3428 * import does not refer to a library declaration. | 4195 * import does not refer to a library declaration. |
3429 * | 4196 * |
3430 * @param uri the uri pointing to a non-library declaration | 4197 * @param uri the uri pointing to a non-library declaration |
3431 * See [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]. | 4198 * See [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]. |
3432 */ | 4199 */ |
3433 static const StaticWarningCode IMPORT_OF_NON_LIBRARY = const StaticWarningCode
('IMPORT_OF_NON_LIBRARY', "The imported library '{0}' must not have a part-of di
rective"); | 4200 static const StaticWarningCode IMPORT_OF_NON_LIBRARY = |
| 4201 const StaticWarningCode( |
| 4202 'IMPORT_OF_NON_LIBRARY', |
| 4203 "The imported library '{0}' must not have a part-of directive"); |
3434 | 4204 |
3435 /** | 4205 /** |
3436 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause | 4206 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause |
3437 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the | 4207 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the |
3438 * same name <i>n</i> that would be inherited (because identically named | 4208 * same name <i>n</i> that would be inherited (because identically named |
3439 * members existed in several superinterfaces) then at most one member is | 4209 * members existed in several superinterfaces) then at most one member is |
3440 * inherited. | 4210 * inherited. |
3441 * | 4211 * |
3442 * If some but not all of the <i>m<sub>i</sub>, 1 <= i <= k</i> are | 4212 * If some but not all of the <i>m<sub>i</sub>, 1 <= i <= k</i> are |
3443 * getters none of the <i>m<sub>i</sub></i> are inherited, and a static | 4213 * getters none of the <i>m<sub>i</sub></i> are inherited, and a static |
3444 * warning is issued. | 4214 * warning is issued. |
3445 */ | 4215 */ |
3446 static const StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METH
OD = const StaticWarningCode('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD'
, "'{0}' is inherited as a getter and also a method"); | 4216 static const StaticWarningCode |
| 4217 INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD = |
| 4218 const StaticWarningCode( |
| 4219 'INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', |
| 4220 "'{0}' is inherited as a getter and also a method"); |
3447 | 4221 |
3448 /** | 4222 /** |
3449 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 4223 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
3450 * an instance method named <i>n</i> and an accessible static member named | 4224 * an instance method named <i>n</i> and an accessible static member named |
3451 * <i>n</i> is declared in a superclass of <i>C</i>. | 4225 * <i>n</i> is declared in a superclass of <i>C</i>. |
3452 * | 4226 * |
3453 * @param memberName the name of the member with the name conflict | 4227 * @param memberName the name of the member with the name conflict |
3454 * @param superclassName the name of the enclosing class that has the static | 4228 * @param superclassName the name of the enclosing class that has the static |
3455 * member | 4229 * member |
3456 */ | 4230 */ |
3457 static const StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S
TATIC = const StaticWarningCode('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S
TATIC', "'{0}' collides with a static member in the superclass '{1}'"); | 4231 static const StaticWarningCode |
| 4232 INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC = |
| 4233 const StaticWarningCode( |
| 4234 'INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', |
| 4235 "'{0}' collides with a static member in the superclass '{1}'"); |
3458 | 4236 |
3459 /** | 4237 /** |
3460 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a | 4238 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a |
3461 * getter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of | 4239 * getter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of |
3462 * <i>m2</i>. | 4240 * <i>m2</i>. |
3463 * | 4241 * |
3464 * @param actualReturnTypeName the name of the expected return type | 4242 * @param actualReturnTypeName the name of the expected return type |
3465 * @param expectedReturnType the name of the actual return type, not | 4243 * @param expectedReturnType the name of the actual return type, not |
3466 * assignable to the actualReturnTypeName | 4244 * assignable to the actualReturnTypeName |
3467 * @param className the name of the class where the overridden getter is | 4245 * @param className the name of the class where the overridden getter is |
3468 * declared | 4246 * declared |
3469 * See [INVALID_METHOD_OVERRIDE_RETURN_TYPE]. | 4247 * See [INVALID_METHOD_OVERRIDE_RETURN_TYPE]. |
3470 */ | 4248 */ |
3471 static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = const Sta
ticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE', "The return type '{0}' is
not assignable to '{1}' as required by the getter it is overriding from '{2}'"); | 4249 static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = |
| 4250 const StaticWarningCode( |
| 4251 'INVALID_GETTER_OVERRIDE_RETURN_TYPE', |
| 4252 "The return type '{0}' is not assignable to '{1}' as required by the g
etter it is overriding from '{2}'"); |
3472 | 4253 |
3473 /** | 4254 /** |
3474 * 7.1 Instance Methods: It is a static warning if an instance method | 4255 * 7.1 Instance Methods: It is a static warning if an instance method |
3475 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 4256 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
3476 * is not a subtype of the type of <i>m2</i>. | 4257 * is not a subtype of the type of <i>m2</i>. |
3477 * | 4258 * |
3478 * @param actualParamTypeName the name of the expected parameter type | 4259 * @param actualParamTypeName the name of the expected parameter type |
3479 * @param expectedParamType the name of the actual parameter type, not | 4260 * @param expectedParamType the name of the actual parameter type, not |
3480 * assignable to the actualParamTypeName | 4261 * assignable to the actualParamTypeName |
3481 * @param className the name of the class where the overridden method is | 4262 * @param className the name of the class where the overridden method is |
3482 * declared | 4263 * declared |
3483 */ | 4264 */ |
3484 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = cons
t StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', "The parameter t
ype '{0}' is not assignable to '{1}' as required by the method it is overriding
from '{2}'"); | 4265 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = |
| 4266 const StaticWarningCode( |
| 4267 'INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', |
| 4268 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); |
3485 | 4269 |
3486 /** | 4270 /** |
3487 * 7.1 Instance Methods: It is a static warning if an instance method | 4271 * 7.1 Instance Methods: It is a static warning if an instance method |
3488 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 4272 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
3489 * is not a subtype of the type of <i>m2</i>. | 4273 * is not a subtype of the type of <i>m2</i>. |
3490 * | 4274 * |
3491 * @param actualParamTypeName the name of the expected parameter type | 4275 * @param actualParamTypeName the name of the expected parameter type |
3492 * @param expectedParamType the name of the actual parameter type, not | 4276 * @param expectedParamType the name of the actual parameter type, not |
3493 * assignable to the actualParamTypeName | 4277 * assignable to the actualParamTypeName |
3494 * @param className the name of the class where the overridden method is | 4278 * @param className the name of the class where the overridden method is |
3495 * declared | 4279 * declared |
3496 * See [INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]. | 4280 * See [INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]. |
3497 */ | 4281 */ |
3498 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = con
st StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', "The parameter
type '{0}' is not assignable to '{1}' as required by the method it is overridin
g from '{2}'"); | 4282 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = |
| 4283 const StaticWarningCode( |
| 4284 'INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', |
| 4285 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); |
3499 | 4286 |
3500 /** | 4287 /** |
3501 * 7.1 Instance Methods: It is a static warning if an instance method | 4288 * 7.1 Instance Methods: It is a static warning if an instance method |
3502 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 4289 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
3503 * is not a subtype of the type of <i>m2</i>. | 4290 * is not a subtype of the type of <i>m2</i>. |
3504 * | 4291 * |
3505 * @param actualParamTypeName the name of the expected parameter type | 4292 * @param actualParamTypeName the name of the expected parameter type |
3506 * @param expectedParamType the name of the actual parameter type, not | 4293 * @param expectedParamType the name of the actual parameter type, not |
3507 * assignable to the actualParamTypeName | 4294 * assignable to the actualParamTypeName |
3508 * @param className the name of the class where the overridden method is | 4295 * @param className the name of the class where the overridden method is |
3509 * declared | 4296 * declared |
3510 */ | 4297 */ |
3511 static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = c
onst StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', "The param
eter type '{0}' is not assignable to '{1}' as required by the method it is overr
iding from '{2}'"); | 4298 static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = |
| 4299 const StaticWarningCode( |
| 4300 'INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', |
| 4301 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); |
3512 | 4302 |
3513 /** | 4303 /** |
3514 * 7.1 Instance Methods: It is a static warning if an instance method | 4304 * 7.1 Instance Methods: It is a static warning if an instance method |
3515 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 4305 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
3516 * is not a subtype of the type of <i>m2</i>. | 4306 * is not a subtype of the type of <i>m2</i>. |
3517 * | 4307 * |
3518 * @param actualReturnTypeName the name of the expected return type | 4308 * @param actualReturnTypeName the name of the expected return type |
3519 * @param expectedReturnType the name of the actual return type, not | 4309 * @param expectedReturnType the name of the actual return type, not |
3520 * assignable to the actualReturnTypeName | 4310 * assignable to the actualReturnTypeName |
3521 * @param className the name of the class where the overridden method is | 4311 * @param className the name of the class where the overridden method is |
3522 * declared | 4312 * declared |
3523 * See [INVALID_GETTER_OVERRIDE_RETURN_TYPE]. | 4313 * See [INVALID_GETTER_OVERRIDE_RETURN_TYPE]. |
3524 */ | 4314 */ |
3525 static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = const Sta
ticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', "The return type '{0}' is
not assignable to '{1}' as required by the method it is overriding from '{2}'"); | 4315 static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = |
| 4316 const StaticWarningCode( |
| 4317 'INVALID_METHOD_OVERRIDE_RETURN_TYPE', |
| 4318 "The return type '{0}' is not assignable to '{1}' as required by the m
ethod it is overriding from '{2}'"); |
3526 | 4319 |
3527 /** | 4320 /** |
3528 * 7.1 Instance Methods: It is a static warning if an instance method | 4321 * 7.1 Instance Methods: It is a static warning if an instance method |
3529 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of | 4322 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of |
3530 * <i>m2</i> explicitly specifies a default value for a formal parameter | 4323 * <i>m2</i> explicitly specifies a default value for a formal parameter |
3531 * <i>p</i> and the signature of <i>m1</i> specifies a different default value | 4324 * <i>p</i> and the signature of <i>m1</i> specifies a different default value |
3532 * for <i>p</i>. | 4325 * for <i>p</i>. |
3533 */ | 4326 */ |
3534 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED
= const StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', "P
arameters cannot override default values, this method overrides '{0}.{1}' where
'{2}' has a different value"); | 4327 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED |
| 4328 = |
| 4329 const StaticWarningCode( |
| 4330 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', |
| 4331 "Parameters cannot override default values, this method overrides '{0}
.{1}' where '{2}' has a different value"); |
3535 | 4332 |
3536 /** | 4333 /** |
3537 * 7.1 Instance Methods: It is a static warning if an instance method | 4334 * 7.1 Instance Methods: It is a static warning if an instance method |
3538 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of | 4335 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of |
3539 * <i>m2</i> explicitly specifies a default value for a formal parameter | 4336 * <i>m2</i> explicitly specifies a default value for a formal parameter |
3540 * <i>p</i> and the signature of <i>m1</i> specifies a different default value | 4337 * <i>p</i> and the signature of <i>m1</i> specifies a different default value |
3541 * for <i>p</i>. | 4338 * for <i>p</i>. |
3542 */ | 4339 */ |
3543 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSIT
IONAL = const StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSIT
IONAL', "Parameters cannot override default values, this method overrides '{0}.{
1}' where this positional parameter has a different value"); | 4340 static const StaticWarningCode |
| 4341 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL = |
| 4342 const StaticWarningCode( |
| 4343 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', |
| 4344 "Parameters cannot override default values, this method overrides '{0}
.{1}' where this positional parameter has a different value"); |
3544 | 4345 |
3545 /** | 4346 /** |
3546 * 7.1 Instance Methods: It is a static warning if an instance method | 4347 * 7.1 Instance Methods: It is a static warning if an instance method |
3547 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> does not | 4348 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> does not |
3548 * declare all the named parameters declared by <i>m2</i>. | 4349 * declare all the named parameters declared by <i>m2</i>. |
3549 * | 4350 * |
3550 * @param paramCount the number of named parameters in the overridden member | 4351 * @param paramCount the number of named parameters in the overridden member |
3551 * @param className the name of the class from the overridden method | 4352 * @param className the name of the class from the overridden method |
3552 */ | 4353 */ |
3553 static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCod
e('INVALID_OVERRIDE_NAMED', "Missing the named parameter '{0}' to match the over
ridden method from '{1}'"); | 4354 static const StaticWarningCode INVALID_OVERRIDE_NAMED = |
| 4355 const StaticWarningCode( |
| 4356 'INVALID_OVERRIDE_NAMED', |
| 4357 "Missing the named parameter '{0}' to match the overridden method from
'{1}'"); |
3554 | 4358 |
3555 /** | 4359 /** |
3556 * 7.1 Instance Methods: It is a static warning if an instance method | 4360 * 7.1 Instance Methods: It is a static warning if an instance method |
3557 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has fewer | 4361 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has fewer |
3558 * positional parameters than <i>m2</i>. | 4362 * positional parameters than <i>m2</i>. |
3559 * | 4363 * |
3560 * @param paramCount the number of positional parameters in the overridden | 4364 * @param paramCount the number of positional parameters in the overridden |
3561 * member | 4365 * member |
3562 * @param className the name of the class from the overridden method | 4366 * @param className the name of the class from the overridden method |
3563 */ | 4367 */ |
3564 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = const StaticWarni
ngCode('INVALID_OVERRIDE_POSITIONAL', "Must have at least {0} parameters to matc
h the overridden method from '{1}'"); | 4368 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = |
| 4369 const StaticWarningCode( |
| 4370 'INVALID_OVERRIDE_POSITIONAL', |
| 4371 "Must have at least {0} parameters to match the overridden method from
'{1}'"); |
3565 | 4372 |
3566 /** | 4373 /** |
3567 * 7.1 Instance Methods: It is a static warning if an instance method | 4374 * 7.1 Instance Methods: It is a static warning if an instance method |
3568 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has a | 4375 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has a |
3569 * greater number of required parameters than <i>m2</i>. | 4376 * greater number of required parameters than <i>m2</i>. |
3570 * | 4377 * |
3571 * @param paramCount the number of required parameters in the overridden | 4378 * @param paramCount the number of required parameters in the overridden |
3572 * member | 4379 * member |
3573 * @param className the name of the class from the overridden method | 4380 * @param className the name of the class from the overridden method |
3574 */ | 4381 */ |
3575 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = const StaticWarning
Code('INVALID_OVERRIDE_REQUIRED', "Must have {0} required parameters or less to
match the overridden method from '{1}'"); | 4382 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = |
| 4383 const StaticWarningCode( |
| 4384 'INVALID_OVERRIDE_REQUIRED', |
| 4385 "Must have {0} required parameters or less to match the overridden met
hod from '{1}'"); |
3576 | 4386 |
3577 /** | 4387 /** |
3578 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a | 4388 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a |
3579 * setter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of | 4389 * setter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of |
3580 * <i>m2</i>. | 4390 * <i>m2</i>. |
3581 * | 4391 * |
3582 * @param actualParamTypeName the name of the expected parameter type | 4392 * @param actualParamTypeName the name of the expected parameter type |
3583 * @param expectedParamType the name of the actual parameter type, not | 4393 * @param expectedParamType the name of the actual parameter type, not |
3584 * assignable to the actualParamTypeName | 4394 * assignable to the actualParamTypeName |
3585 * @param className the name of the class where the overridden setter is | 4395 * @param className the name of the class where the overridden setter is |
3586 * declared | 4396 * declared |
3587 * See [INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]. | 4397 * See [INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]. |
3588 */ | 4398 */ |
3589 static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = con
st StaticWarningCode('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', "The parameter
type '{0}' is not assignable to '{1}' as required by the setter it is overridin
g from '{2}'"); | 4399 static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = |
| 4400 const StaticWarningCode( |
| 4401 'INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', |
| 4402 "The parameter type '{0}' is not assignable to '{1}' as required by th
e setter it is overriding from '{2}'"); |
3590 | 4403 |
3591 /** | 4404 /** |
3592 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> | 4405 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> |
3593 * … <i>e<sub>n</sub></i>] is evaluated as follows: | 4406 * … <i>e<sub>n</sub></i>] is evaluated as follows: |
3594 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and | 4407 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and |
3595 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> | 4408 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> |
3596 * | 4409 * |
3597 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 4410 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
3598 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 4411 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
3599 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 4412 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
3600 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 4413 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
3601 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 4414 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
3602 * <= j <= m</i>. | 4415 * <= j <= m</i>. |
3603 */ | 4416 */ |
3604 static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const Static
WarningCode('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', "The element type '{0}' cannot b
e assigned to the list type '{1}'"); | 4417 static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = |
| 4418 const StaticWarningCode( |
| 4419 'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', |
| 4420 "The element type '{0}' cannot be assigned to the list type '{1}'"); |
3605 | 4421 |
3606 /** | 4422 /** |
3607 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 4423 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
3608 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> | 4424 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> |
3609 * : <i>e<sub>n</sub></i>] is evaluated as follows: | 4425 * : <i>e<sub>n</sub></i>] is evaluated as follows: |
3610 * * The operator []= is invoked on <i>m</i> with first argument | 4426 * * The operator []= is invoked on <i>m</i> with first argument |
3611 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 4427 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
3612 * i <= n</i> | 4428 * i <= n</i> |
3613 * | 4429 * |
3614 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 4430 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
3615 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 4431 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
3616 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 4432 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
3617 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 4433 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
3618 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 4434 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
3619 * <= j <= m</i>. | 4435 * <= j <= m</i>. |
3620 */ | 4436 */ |
3621 static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const StaticWarni
ngCode('MAP_KEY_TYPE_NOT_ASSIGNABLE', "The element type '{0}' cannot be assigned
to the map key type '{1}'"); | 4437 static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = |
| 4438 const StaticWarningCode( |
| 4439 'MAP_KEY_TYPE_NOT_ASSIGNABLE', |
| 4440 "The element type '{0}' cannot be assigned to the map key type '{1}'")
; |
3622 | 4441 |
3623 /** | 4442 /** |
3624 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 4443 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
3625 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> | 4444 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> |
3626 * : <i>e<sub>n</sub></i>] is evaluated as follows: | 4445 * : <i>e<sub>n</sub></i>] is evaluated as follows: |
3627 * * The operator []= is invoked on <i>m</i> with first argument | 4446 * * The operator []= is invoked on <i>m</i> with first argument |
3628 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 4447 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
3629 * i <= n</i> | 4448 * i <= n</i> |
3630 * | 4449 * |
3631 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 4450 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
3632 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 4451 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
3633 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 4452 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
3634 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 4453 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
3635 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 4454 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
3636 * <= j <= m</i>. | 4455 * <= j <= m</i>. |
3637 */ | 4456 */ |
3638 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const StaticWar
ningCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE', "The element type '{0}' cannot be assi
gned to the map value type '{1}'"); | 4457 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = |
| 4458 const StaticWarningCode( |
| 4459 'MAP_VALUE_TYPE_NOT_ASSIGNABLE', |
| 4460 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); |
3639 | 4461 |
3640 /** | 4462 /** |
3641 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> | 4463 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> |
3642 * with argument type <i>T</i> and a getter named <i>v</i> with return type | 4464 * with argument type <i>T</i> and a getter named <i>v</i> with return type |
3643 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. | 4465 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. |
3644 */ | 4466 */ |
3645 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = const Stat
icWarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES', "The parameter type for sett
er '{0}' is '{1}' which is not assignable to its getter (of type '{2}')"); | 4467 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = |
| 4468 const StaticWarningCode( |
| 4469 'MISMATCHED_GETTER_AND_SETTER_TYPES', |
| 4470 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}')"); |
3646 | 4471 |
3647 /** | 4472 /** |
3648 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> | 4473 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> |
3649 * with argument type <i>T</i> and a getter named <i>v</i> with return type | 4474 * with argument type <i>T</i> and a getter named <i>v</i> with return type |
3650 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. | 4475 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. |
3651 */ | 4476 */ |
3652 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTY
PE = const StaticWarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE'
, "The parameter type for setter '{0}' is '{1}' which is not assignable to its g
etter (of type '{2}'), from superclass '{3}'"); | 4477 static const StaticWarningCode |
| 4478 MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE = |
| 4479 const StaticWarningCode( |
| 4480 'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE', |
| 4481 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'"); |
3653 | 4482 |
3654 /** | 4483 /** |
3655 * 13.12 Return: It is a static warning if a function contains both one or | 4484 * 13.12 Return: It is a static warning if a function contains both one or |
3656 * more return statements of the form <i>return;</i> and one or more return | 4485 * more return statements of the form <i>return;</i> and one or more return |
3657 * statements of the form <i>return e;</i>. | 4486 * statements of the form <i>return e;</i>. |
3658 */ | 4487 */ |
3659 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode('M
IXED_RETURN_TYPES', "Methods and functions cannot use return both with and witho
ut values"); | 4488 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode( |
| 4489 'MIXED_RETURN_TYPES', |
| 4490 "Methods and functions cannot use return both with and without values"); |
3660 | 4491 |
3661 /** | 4492 /** |
3662 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an | 4493 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an |
3663 * abstract class and <i>q</i> is not a factory constructor. | 4494 * abstract class and <i>q</i> is not a factory constructor. |
3664 */ | 4495 */ |
3665 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = const StaticWarningCo
de('NEW_WITH_ABSTRACT_CLASS', "Abstract classes cannot be created with a 'new' e
xpression"); | 4496 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = |
| 4497 const StaticWarningCode( |
| 4498 'NEW_WITH_ABSTRACT_CLASS', |
| 4499 "Abstract classes cannot be created with a 'new' expression"); |
3666 | 4500 |
3667 /** | 4501 /** |
3668 * 15.8 Parameterized Types: Any use of a malbounded type gives rise to a | 4502 * 15.8 Parameterized Types: Any use of a malbounded type gives rise to a |
3669 * static warning. | 4503 * static warning. |
3670 * | 4504 * |
3671 * @param typeName the name of the type being referenced (<i>S</i>) | 4505 * @param typeName the name of the type being referenced (<i>S</i>) |
3672 * @param parameterCount the number of type parameters that were declared | 4506 * @param parameterCount the number of type parameters that were declared |
3673 * @param argumentCount the number of type arguments provided | 4507 * @param argumentCount the number of type arguments provided |
3674 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and | 4508 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and |
3675 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. | 4509 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. |
3676 */ | 4510 */ |
3677 static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = const Static
WarningCode('NEW_WITH_INVALID_TYPE_PARAMETERS', "The type '{0}' is declared with
{1} type parameters, but {2} type arguments were given"); | 4511 static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = |
| 4512 const StaticWarningCode( |
| 4513 'NEW_WITH_INVALID_TYPE_PARAMETERS', |
| 4514 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); |
3678 | 4515 |
3679 /** | 4516 /** |
3680 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible | 4517 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible |
3681 * in the current scope, optionally followed by type arguments. | 4518 * in the current scope, optionally followed by type arguments. |
3682 * | 4519 * |
3683 * @param name the name of the non-type element | 4520 * @param name the name of the non-type element |
3684 */ | 4521 */ |
3685 static const StaticWarningCode NEW_WITH_NON_TYPE = const StaticWarningCode('NE
W_WITH_NON_TYPE', "The name '{0}' is not a class"); | 4522 static const StaticWarningCode NEW_WITH_NON_TYPE = |
| 4523 const StaticWarningCode('NEW_WITH_NON_TYPE', "The name '{0}' is not a clas
s"); |
3686 | 4524 |
3687 /** | 4525 /** |
3688 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the | 4526 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the |
3689 * current scope then: | 4527 * current scope then: |
3690 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, | 4528 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, |
3691 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, | 4529 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, |
3692 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a static warning if | 4530 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a static warning if |
3693 * <i>T.id</i> is not the name of a constructor declared by the type | 4531 * <i>T.id</i> is not the name of a constructor declared by the type |
3694 * <i>T</i>. | 4532 * <i>T</i>. |
3695 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, | 4533 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, |
3696 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: | 4534 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: |
3697 * a<sub>n+kM/sub>)</i> it is a static warning if the type <i>T</i> does not | 4535 * a<sub>n+kM/sub>)</i> it is a static warning if the type <i>T</i> does not |
3698 * declare a constructor with the same name as the declaration of <i>T</i>. | 4536 * declare a constructor with the same name as the declaration of <i>T</i>. |
3699 */ | 4537 */ |
3700 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = const StaticWa
rningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR', "The class '{0}' does not have a con
structor '{1}'"); | 4538 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = |
| 4539 const StaticWarningCode( |
| 4540 'NEW_WITH_UNDEFINED_CONSTRUCTOR', |
| 4541 "The class '{0}' does not have a constructor '{1}'"); |
3701 | 4542 |
3702 /** | 4543 /** |
3703 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the | 4544 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the |
3704 * current scope then: | 4545 * current scope then: |
3705 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, | 4546 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, |
3706 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: | 4547 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: |
3707 * a<sub>n+k</sub>)</i> it is a static warning if <i>T.id</i> is not the name | 4548 * a<sub>n+k</sub>)</i> it is a static warning if <i>T.id</i> is not the name |
3708 * of a constructor declared by the type <i>T</i>. If <i>e</i> of the form | 4549 * of a constructor declared by the type <i>T</i>. If <i>e</i> of the form |
3709 * <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 4550 * <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
3710 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a | 4551 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a |
3711 * static warning if the type <i>T</i> does not declare a constructor with the | 4552 * static warning if the type <i>T</i> does not declare a constructor with the |
3712 * same name as the declaration of <i>T</i>. | 4553 * same name as the declaration of <i>T</i>. |
3713 */ | 4554 */ |
3714 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = const
StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', "The class '{0}' doe
s not have a default constructor"); | 4555 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = |
| 4556 const StaticWarningCode( |
| 4557 'NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', |
| 4558 "The class '{0}' does not have a default constructor"); |
3715 | 4559 |
3716 /** | 4560 /** |
3717 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4561 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
3718 * class inherits an abstract method. | 4562 * class inherits an abstract method. |
3719 * | 4563 * |
3720 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4564 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
3721 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4565 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
3722 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4566 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
3723 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4567 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
3724 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4568 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
3725 * | 4569 * |
3726 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4570 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
3727 * is declared or inherited in a concrete class unless that member overrides a | 4571 * is declared or inherited in a concrete class unless that member overrides a |
3728 * concrete one. | 4572 * concrete one. |
3729 * | 4573 * |
3730 * @param memberName the name of the first member | 4574 * @param memberName the name of the first member |
3731 * @param memberName the name of the second member | 4575 * @param memberName the name of the second member |
3732 * @param memberName the name of the third member | 4576 * @param memberName the name of the third member |
3733 * @param memberName the name of the fourth member | 4577 * @param memberName the name of the fourth member |
3734 * @param additionalCount the number of additional missing members that aren't | 4578 * @param additionalCount the number of additional missing members that aren't |
3735 * listed | 4579 * listed |
3736 */ | 4580 */ |
3737 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIV
E_PLUS = const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FI
VE_PLUS', "Missing concrete implementation of {0}, {1}, {2}, {3} and {4} more"); | 4581 static const StaticWarningCode |
| 4582 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = |
| 4583 const StaticWarningCode( |
| 4584 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', |
| 4585 "Missing concrete implementation of {0}, {1}, {2}, {3} and {4} more"); |
3738 | 4586 |
3739 /** | 4587 /** |
3740 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4588 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
3741 * class inherits an abstract method. | 4589 * class inherits an abstract method. |
3742 * | 4590 * |
3743 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4591 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
3744 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4592 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
3745 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4593 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
3746 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4594 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
3747 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4595 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
3748 * | 4596 * |
3749 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4597 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
3750 * is declared or inherited in a concrete class unless that member overrides a | 4598 * is declared or inherited in a concrete class unless that member overrides a |
3751 * concrete one. | 4599 * concrete one. |
3752 * | 4600 * |
3753 * @param memberName the name of the first member | 4601 * @param memberName the name of the first member |
3754 * @param memberName the name of the second member | 4602 * @param memberName the name of the second member |
3755 * @param memberName the name of the third member | 4603 * @param memberName the name of the third member |
3756 * @param memberName the name of the fourth member | 4604 * @param memberName the name of the fourth member |
3757 */ | 4605 */ |
3758 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOU
R = const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR',
"Missing concrete implementation of {0}, {1}, {2} and {3}"); | 4606 static const StaticWarningCode |
| 4607 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = |
| 4608 const StaticWarningCode( |
| 4609 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', |
| 4610 "Missing concrete implementation of {0}, {1}, {2} and {3}"); |
3759 | 4611 |
3760 /** | 4612 /** |
3761 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4613 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
3762 * class inherits an abstract method. | 4614 * class inherits an abstract method. |
3763 * | 4615 * |
3764 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4616 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
3765 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4617 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
3766 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4618 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
3767 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4619 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
3768 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4620 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
3769 * | 4621 * |
3770 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4622 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
3771 * is declared or inherited in a concrete class unless that member overrides a | 4623 * is declared or inherited in a concrete class unless that member overrides a |
3772 * concrete one. | 4624 * concrete one. |
3773 * | 4625 * |
3774 * @param memberName the name of the member | 4626 * @param memberName the name of the member |
3775 */ | 4627 */ |
3776 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE
= const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', "M
issing concrete implementation of {0}"); | 4628 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE |
| 4629 = |
| 4630 const StaticWarningCode( |
| 4631 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', |
| 4632 "Missing concrete implementation of {0}"); |
3777 | 4633 |
3778 /** | 4634 /** |
3779 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4635 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
3780 * class inherits an abstract method. | 4636 * class inherits an abstract method. |
3781 * | 4637 * |
3782 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4638 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
3783 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4639 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
3784 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4640 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
3785 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4641 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
3786 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4642 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
3787 * | 4643 * |
3788 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4644 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
3789 * is declared or inherited in a concrete class unless that member overrides a | 4645 * is declared or inherited in a concrete class unless that member overrides a |
3790 * concrete one. | 4646 * concrete one. |
3791 * | 4647 * |
3792 * @param memberName the name of the first member | 4648 * @param memberName the name of the first member |
3793 * @param memberName the name of the second member | 4649 * @param memberName the name of the second member |
3794 * @param memberName the name of the third member | 4650 * @param memberName the name of the third member |
3795 */ | 4651 */ |
3796 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THR
EE = const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE'
, "Missing concrete implementation of {0}, {1} and {2}"); | 4652 static const StaticWarningCode |
| 4653 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = |
| 4654 const StaticWarningCode( |
| 4655 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', |
| 4656 "Missing concrete implementation of {0}, {1} and {2}"); |
3797 | 4657 |
3798 /** | 4658 /** |
3799 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4659 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
3800 * class inherits an abstract method. | 4660 * class inherits an abstract method. |
3801 * | 4661 * |
3802 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4662 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
3803 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4663 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
3804 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4664 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
3805 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4665 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
3806 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4666 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
3807 * | 4667 * |
3808 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4668 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
3809 * is declared or inherited in a concrete class unless that member overrides a | 4669 * is declared or inherited in a concrete class unless that member overrides a |
3810 * concrete one. | 4670 * concrete one. |
3811 * | 4671 * |
3812 * @param memberName the name of the first member | 4672 * @param memberName the name of the first member |
3813 * @param memberName the name of the second member | 4673 * @param memberName the name of the second member |
3814 */ | 4674 */ |
3815 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO
= const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', "M
issing concrete implementation of {0} and {1}"); | 4675 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO |
| 4676 = |
| 4677 const StaticWarningCode( |
| 4678 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', |
| 4679 "Missing concrete implementation of {0} and {1}"); |
3816 | 4680 |
3817 /** | 4681 /** |
3818 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, | 4682 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, |
3819 * p<sub>2</sub>) s</i> or <i>on T s</i> matches an object <i>o</i> if the | 4683 * p<sub>2</sub>) s</i> or <i>on T s</i> matches an object <i>o</i> if the |
3820 * type of <i>o</i> is a subtype of <i>T</i>. It is a static warning if | 4684 * type of <i>o</i> is a subtype of <i>T</i>. It is a static warning if |
3821 * <i>T</i> does not denote a type available in the lexical scope of the | 4685 * <i>T</i> does not denote a type available in the lexical scope of the |
3822 * catch clause. | 4686 * catch clause. |
3823 * | 4687 * |
3824 * @param name the name of the non-type element | 4688 * @param name the name of the non-type element |
3825 */ | 4689 */ |
3826 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = const StaticWarningC
ode('NON_TYPE_IN_CATCH_CLAUSE', "The name '{0}' is not a type and cannot be used
in an on-catch clause"); | 4690 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = |
| 4691 const StaticWarningCode( |
| 4692 'NON_TYPE_IN_CATCH_CLAUSE', |
| 4693 "The name '{0}' is not a type and cannot be used in an on-catch clause
"); |
3827 | 4694 |
3828 /** | 4695 /** |
3829 * 7.1.1 Operators: It is a static warning if the return type of the | 4696 * 7.1.1 Operators: It is a static warning if the return type of the |
3830 * user-declared operator []= is explicitly declared and not void. | 4697 * user-declared operator []= is explicitly declared and not void. |
3831 */ | 4698 */ |
3832 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = const StaticWarn
ingCode('NON_VOID_RETURN_FOR_OPERATOR', "The return type of the operator []= mus
t be 'void'"); | 4699 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = |
| 4700 const StaticWarningCode( |
| 4701 'NON_VOID_RETURN_FOR_OPERATOR', |
| 4702 "The return type of the operator []= must be 'void'"); |
3833 | 4703 |
3834 /** | 4704 /** |
3835 * 7.3 Setters: It is a static warning if a setter declares a return type | 4705 * 7.3 Setters: It is a static warning if a setter declares a return type |
3836 * other than void. | 4706 * other than void. |
3837 */ | 4707 */ |
3838 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = const StaticWarnin
gCode('NON_VOID_RETURN_FOR_SETTER', "The return type of the setter must be 'void
'"); | 4708 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = |
| 4709 const StaticWarningCode( |
| 4710 'NON_VOID_RETURN_FOR_SETTER', |
| 4711 "The return type of the setter must be 'void'"); |
3839 | 4712 |
3840 /** | 4713 /** |
3841 * 15.1 Static Types: A type <i>T</i> is malformed iff: | 4714 * 15.1 Static Types: A type <i>T</i> is malformed iff: |
3842 * * <i>T</i> has the form <i>id</i> or the form <i>prefix.id</i>, and in the | 4715 * * <i>T</i> has the form <i>id</i> or the form <i>prefix.id</i>, and in the |
3843 * enclosing lexical scope, the name <i>id</i> (respectively | 4716 * enclosing lexical scope, the name <i>id</i> (respectively |
3844 * <i>prefix.id</i>) does not denote a type. | 4717 * <i>prefix.id</i>) does not denote a type. |
3845 * * <i>T</i> denotes a type parameter in the enclosing lexical scope, but | 4718 * * <i>T</i> denotes a type parameter in the enclosing lexical scope, but |
3846 * occurs in the signature or body of a static member. | 4719 * occurs in the signature or body of a static member. |
3847 * * <i>T</i> is a parameterized type of the form <i>G<S<sub>1</sub>, .., | 4720 * * <i>T</i> is a parameterized type of the form <i>G<S<sub>1</sub>, .., |
3848 * S<sub>n</sub>></i>, | 4721 * S<sub>n</sub>></i>, |
3849 * | 4722 * |
3850 * Any use of a malformed type gives rise to a static warning. | 4723 * Any use of a malformed type gives rise to a static warning. |
3851 * | 4724 * |
3852 * @param nonTypeName the name that is not a type | 4725 * @param nonTypeName the name that is not a type |
3853 */ | 4726 */ |
3854 static const StaticWarningCode NOT_A_TYPE = const StaticWarningCode('NOT_A_TYP
E', "{0} is not a type"); | 4727 static const StaticWarningCode NOT_A_TYPE = |
| 4728 const StaticWarningCode('NOT_A_TYPE', "{0} is not a type"); |
3855 | 4729 |
3856 /** | 4730 /** |
3857 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < | 4731 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < |
3858 * h</i> or if <i>m > n</i>. | 4732 * h</i> or if <i>m > n</i>. |
3859 * | 4733 * |
3860 * @param requiredCount the expected number of required arguments | 4734 * @param requiredCount the expected number of required arguments |
3861 * @param argumentCount the actual number of positional arguments given | 4735 * @param argumentCount the actual number of positional arguments given |
3862 * See [EXTRA_POSITIONAL_ARGUMENTS]. | 4736 * See [EXTRA_POSITIONAL_ARGUMENTS]. |
3863 */ | 4737 */ |
3864 static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const StaticWar
ningCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', "{0} required argument(s) expected, bu
t {1} found"); | 4738 static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = |
| 4739 const StaticWarningCode( |
| 4740 'NOT_ENOUGH_REQUIRED_ARGUMENTS', |
| 4741 "{0} required argument(s) expected, but {1} found"); |
3865 | 4742 |
3866 /** | 4743 /** |
3867 * 14.3 Parts: It is a static warning if the referenced part declaration | 4744 * 14.3 Parts: It is a static warning if the referenced part declaration |
3868 * <i>p</i> names a library other than the current library as the library to | 4745 * <i>p</i> names a library other than the current library as the library to |
3869 * which <i>p</i> belongs. | 4746 * which <i>p</i> belongs. |
3870 * | 4747 * |
3871 * @param expectedLibraryName the name of expected library name | 4748 * @param expectedLibraryName the name of expected library name |
3872 * @param actualLibraryName the non-matching actual library name from the | 4749 * @param actualLibraryName the non-matching actual library name from the |
3873 * "part of" declaration | 4750 * "part of" declaration |
3874 */ | 4751 */ |
3875 static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY = const StaticWarning
Code('PART_OF_DIFFERENT_LIBRARY', "Expected this library to be part of '{0}', no
t '{1}'"); | 4752 static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY = |
| 4753 const StaticWarningCode( |
| 4754 'PART_OF_DIFFERENT_LIBRARY', |
| 4755 "Expected this library to be part of '{0}', not '{1}'"); |
3876 | 4756 |
3877 /** | 4757 /** |
3878 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> | 4758 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> |
3879 * is not a subtype of the type of <i>k</i>. | 4759 * is not a subtype of the type of <i>k</i>. |
3880 * | 4760 * |
3881 * @param redirectedName the name of the redirected constructor | 4761 * @param redirectedName the name of the redirected constructor |
3882 * @param redirectingName the name of the redirecting constructor | 4762 * @param redirectingName the name of the redirecting constructor |
3883 */ | 4763 */ |
3884 static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = const Stati
cWarningCode('REDIRECT_TO_INVALID_FUNCTION_TYPE', "The redirected constructor '{
0}' has incompatible parameters with '{1}'"); | 4764 static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = |
| 4765 const StaticWarningCode( |
| 4766 'REDIRECT_TO_INVALID_FUNCTION_TYPE', |
| 4767 "The redirected constructor '{0}' has incompatible parameters with '{1
}'"); |
3885 | 4768 |
3886 /** | 4769 /** |
3887 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> | 4770 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> |
3888 * is not a subtype of the type of <i>k</i>. | 4771 * is not a subtype of the type of <i>k</i>. |
3889 * | 4772 * |
3890 * @param redirectedName the name of the redirected constructor return type | 4773 * @param redirectedName the name of the redirected constructor return type |
3891 * @param redirectingName the name of the redirecting constructor return type | 4774 * @param redirectingName the name of the redirecting constructor return type |
3892 */ | 4775 */ |
3893 static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = const StaticW
arningCode('REDIRECT_TO_INVALID_RETURN_TYPE', "The return type '{0}' of the redi
rected constructor is not assignable to '{1}'"); | 4776 static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = |
| 4777 const StaticWarningCode( |
| 4778 'REDIRECT_TO_INVALID_RETURN_TYPE', |
| 4779 "The return type '{0}' of the redirected constructor is not assignable
to '{1}'"); |
3894 | 4780 |
3895 /** | 4781 /** |
3896 * 7.6.2 Factories: It is a static warning if type does not denote a class | 4782 * 7.6.2 Factories: It is a static warning if type does not denote a class |
3897 * accessible in the current scope; if type does denote such a class <i>C</i> | 4783 * accessible in the current scope; if type does denote such a class <i>C</i> |
3898 * it is a static warning if the referenced constructor (be it <i>type</i> or | 4784 * it is a static warning if the referenced constructor (be it <i>type</i> or |
3899 * <i>type.id</i>) is not a constructor of <i>C</i>. | 4785 * <i>type.id</i>) is not a constructor of <i>C</i>. |
3900 */ | 4786 */ |
3901 static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = const StaticW
arningCode('REDIRECT_TO_MISSING_CONSTRUCTOR', "The constructor '{0}' could not b
e found in '{1}'"); | 4787 static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = |
| 4788 const StaticWarningCode( |
| 4789 'REDIRECT_TO_MISSING_CONSTRUCTOR', |
| 4790 "The constructor '{0}' could not be found in '{1}'"); |
3902 | 4791 |
3903 /** | 4792 /** |
3904 * 7.6.2 Factories: It is a static warning if type does not denote a class | 4793 * 7.6.2 Factories: It is a static warning if type does not denote a class |
3905 * accessible in the current scope; if type does denote such a class <i>C</i> | 4794 * accessible in the current scope; if type does denote such a class <i>C</i> |
3906 * it is a static warning if the referenced constructor (be it <i>type</i> or | 4795 * it is a static warning if the referenced constructor (be it <i>type</i> or |
3907 * <i>type.id</i>) is not a constructor of <i>C</i>. | 4796 * <i>type.id</i>) is not a constructor of <i>C</i>. |
3908 */ | 4797 */ |
3909 static const StaticWarningCode REDIRECT_TO_NON_CLASS = const StaticWarningCode
('REDIRECT_TO_NON_CLASS', "The name '{0}' is not a type and cannot be used in a
redirected constructor"); | 4798 static const StaticWarningCode REDIRECT_TO_NON_CLASS = |
| 4799 const StaticWarningCode( |
| 4800 'REDIRECT_TO_NON_CLASS', |
| 4801 "The name '{0}' is not a type and cannot be used in a redirected const
ructor"); |
3910 | 4802 |
3911 /** | 4803 /** |
3912 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return | 4804 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return |
3913 * statement of the form <i>return;</i> It is a static warning if both of the | 4805 * statement of the form <i>return;</i> It is a static warning if both of the |
3914 * following conditions hold: | 4806 * following conditions hold: |
3915 * * <i>f</i> is not a generative constructor. | 4807 * * <i>f</i> is not a generative constructor. |
3916 * * The return type of <i>f</i> may not be assigned to void. | 4808 * * The return type of <i>f</i> may not be assigned to void. |
3917 */ | 4809 */ |
3918 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode(
'RETURN_WITHOUT_VALUE', "Missing return value after 'return'"); | 4810 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode( |
| 4811 'RETURN_WITHOUT_VALUE', |
| 4812 "Missing return value after 'return'"); |
3919 | 4813 |
3920 /** | 4814 /** |
3921 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not | 4815 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not |
3922 * declare a static method or getter <i>m</i>. | 4816 * declare a static method or getter <i>m</i>. |
3923 * | 4817 * |
3924 * @param memberName the name of the instance member | 4818 * @param memberName the name of the instance member |
3925 */ | 4819 */ |
3926 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = const Static
WarningCode('STATIC_ACCESS_TO_INSTANCE_MEMBER', "Instance member '{0}' cannot be
accessed using static access"); | 4820 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = |
| 4821 const StaticWarningCode( |
| 4822 'STATIC_ACCESS_TO_INSTANCE_MEMBER', |
| 4823 "Instance member '{0}' cannot be accessed using static access"); |
3927 | 4824 |
3928 /** | 4825 /** |
3929 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be | 4826 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be |
3930 * assigned to the type of <i>e<sub>k</sub></i>. | 4827 * assigned to the type of <i>e<sub>k</sub></i>. |
3931 */ | 4828 */ |
3932 static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = const Static
WarningCode('SWITCH_EXPRESSION_NOT_ASSIGNABLE', "Type '{0}' of the switch expres
sion is not assignable to the type '{1}' of case expressions"); | 4829 static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = |
| 4830 const StaticWarningCode( |
| 4831 'SWITCH_EXPRESSION_NOT_ASSIGNABLE', |
| 4832 "Type '{0}' of the switch expression is not assignable to the type '{1
}' of case expressions"); |
3933 | 4833 |
3934 /** | 4834 /** |
3935 * 15.1 Static Types: It is a static warning to use a deferred type in a type | 4835 * 15.1 Static Types: It is a static warning to use a deferred type in a type |
3936 * annotation. | 4836 * annotation. |
3937 * | 4837 * |
3938 * @param name the name of the type that is deferred and being used in a type | 4838 * @param name the name of the type that is deferred and being used in a type |
3939 * annotation | 4839 * annotation |
3940 */ | 4840 */ |
3941 static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS = const StaticWa
rningCode('TYPE_ANNOTATION_DEFERRED_CLASS', "The deferred type '{0}' cannot be u
sed in a declaration, cast or type test"); | 4841 static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS = |
| 4842 const StaticWarningCode( |
| 4843 'TYPE_ANNOTATION_DEFERRED_CLASS', |
| 4844 "The deferred type '{0}' cannot be used in a declaration, cast or type
test"); |
3942 | 4845 |
3943 /** | 4846 /** |
3944 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type | 4847 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type |
3945 * available in the current lexical scope. | 4848 * available in the current lexical scope. |
3946 */ | 4849 */ |
3947 static const StaticWarningCode TYPE_TEST_NON_TYPE = const StaticWarningCode('T
YPE_TEST_NON_TYPE', "The name '{0}' is not a type and cannot be used in an 'is'
expression"); | 4850 static const StaticWarningCode TYPE_TEST_NON_TYPE = const StaticWarningCode( |
| 4851 'TYPE_TEST_NON_TYPE', |
| 4852 "The name '{0}' is not a type and cannot be used in an 'is' expression"); |
3948 | 4853 |
3949 /** | 4854 /** |
3950 * 10 Generics: However, a type parameter is considered to be a malformed type | 4855 * 10 Generics: However, a type parameter is considered to be a malformed type |
3951 * when referenced by a static member. | 4856 * when referenced by a static member. |
3952 * | 4857 * |
3953 * 15.1 Static Types: Any use of a malformed type gives rise to a static | 4858 * 15.1 Static Types: Any use of a malformed type gives rise to a static |
3954 * warning. A malformed type is then interpreted as dynamic by the static type | 4859 * warning. A malformed type is then interpreted as dynamic by the static type |
3955 * checker and the runtime. | 4860 * checker and the runtime. |
3956 */ | 4861 */ |
3957 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = const Sta
ticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC', "Static members cannot ref
erence type parameters"); | 4862 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = |
| 4863 const StaticWarningCode( |
| 4864 'TYPE_PARAMETER_REFERENCED_BY_STATIC', |
| 4865 "Static members cannot reference type parameters"); |
3958 | 4866 |
3959 /** | 4867 /** |
3960 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form | 4868 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form |
3961 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 4869 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
3962 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 4870 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
3963 * static warning if <i>C</i> does not denote a class in the current scope. | 4871 * static warning if <i>C</i> does not denote a class in the current scope. |
3964 * | 4872 * |
3965 * @param undefinedClassName the name of the undefined class | 4873 * @param undefinedClassName the name of the undefined class |
3966 */ | 4874 */ |
3967 static const StaticWarningCode UNDEFINED_CLASS = const StaticWarningCode('UNDE
FINED_CLASS', "Undefined class '{0}'"); | 4875 static const StaticWarningCode UNDEFINED_CLASS = |
| 4876 const StaticWarningCode('UNDEFINED_CLASS', "Undefined class '{0}'"); |
3968 | 4877 |
3969 /** | 4878 /** |
3970 * Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool". | 4879 * Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool". |
3971 */ | 4880 */ |
3972 static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN = const StaticWarningCo
de('UNDEFINED_CLASS_BOOLEAN', "Undefined class 'boolean'; did you mean 'bool'?")
; | 4881 static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN = |
| 4882 const StaticWarningCode( |
| 4883 'UNDEFINED_CLASS_BOOLEAN', |
| 4884 "Undefined class 'boolean'; did you mean 'bool'?"); |
3973 | 4885 |
3974 /** | 4886 /** |
3975 * 12.17 Getter Invocation: It is a static warning if there is no class | 4887 * 12.17 Getter Invocation: It is a static warning if there is no class |
3976 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 4888 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
3977 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 4889 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
3978 * | 4890 * |
3979 * @param getterName the name of the getter | 4891 * @param getterName the name of the getter |
3980 * @param enclosingType the name of the enclosing type where the getter is | 4892 * @param enclosingType the name of the enclosing type where the getter is |
3981 * being looked for | 4893 * being looked for |
3982 */ | 4894 */ |
3983 static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode('UND
EFINED_GETTER', "There is no such getter '{0}' in '{1}'"); | 4895 static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode( |
| 4896 'UNDEFINED_GETTER', |
| 4897 "There is no such getter '{0}' in '{1}'"); |
3984 | 4898 |
3985 /** | 4899 /** |
3986 * 12.30 Identifier Reference: It is as static warning if an identifier | 4900 * 12.30 Identifier Reference: It is as static warning if an identifier |
3987 * expression of the form <i>id</i> occurs inside a top level or static | 4901 * expression of the form <i>id</i> occurs inside a top level or static |
3988 * function (be it function, method, getter, or setter) or variable | 4902 * function (be it function, method, getter, or setter) or variable |
3989 * initializer and there is no declaration <i>d</i> with name <i>id</i> in the | 4903 * initializer and there is no declaration <i>d</i> with name <i>id</i> in the |
3990 * lexical scope enclosing the expression. | 4904 * lexical scope enclosing the expression. |
3991 * | 4905 * |
3992 * @param name the name of the identifier | 4906 * @param name the name of the identifier |
3993 */ | 4907 */ |
3994 static const StaticWarningCode UNDEFINED_IDENTIFIER = const StaticWarningCode(
'UNDEFINED_IDENTIFIER', "Undefined name '{0}'"); | 4908 static const StaticWarningCode UNDEFINED_IDENTIFIER = |
| 4909 const StaticWarningCode('UNDEFINED_IDENTIFIER', "Undefined name '{0}'"); |
3995 | 4910 |
3996 /** | 4911 /** |
3997 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, | 4912 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, |
3998 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set | 4913 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set |
3999 * {<i>p<sub>n+1</sub></i> … <i>p<sub>n+k</sub></i>} or a static | 4914 * {<i>p<sub>n+1</sub></i> … <i>p<sub>n+k</sub></i>} or a static |
4000 * warning occurs. | 4915 * warning occurs. |
4001 * | 4916 * |
4002 * @param name the name of the requested named parameter | 4917 * @param name the name of the requested named parameter |
4003 */ | 4918 */ |
4004 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = const StaticWarning
Code('UNDEFINED_NAMED_PARAMETER', "The named parameter '{0}' is not defined"); | 4919 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = |
| 4920 const StaticWarningCode( |
| 4921 'UNDEFINED_NAMED_PARAMETER', |
| 4922 "The named parameter '{0}' is not defined"); |
4005 | 4923 |
4006 /** | 4924 /** |
4007 * 12.18 Assignment: It is as static warning if an assignment of the form | 4925 * 12.18 Assignment: It is as static warning if an assignment of the form |
4008 * <i>v = e</i> occurs inside a top level or static function (be it function, | 4926 * <i>v = e</i> occurs inside a top level or static function (be it function, |
4009 * method, getter, or setter) or variable initializer and there is no | 4927 * method, getter, or setter) or variable initializer and there is no |
4010 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the | 4928 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the |
4011 * assignment. | 4929 * assignment. |
4012 * | 4930 * |
4013 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in | 4931 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in |
4014 * the enclosing lexical scope of the assignment, or if <i>C</i> does not | 4932 * the enclosing lexical scope of the assignment, or if <i>C</i> does not |
4015 * declare, implicitly or explicitly, a setter <i>v=</i>. | 4933 * declare, implicitly or explicitly, a setter <i>v=</i>. |
4016 * | 4934 * |
4017 * @param setterName the name of the getter | 4935 * @param setterName the name of the getter |
4018 * @param enclosingType the name of the enclosing type where the setter is | 4936 * @param enclosingType the name of the enclosing type where the setter is |
4019 * being looked for | 4937 * being looked for |
4020 */ | 4938 */ |
4021 static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode('UND
EFINED_SETTER', "There is no such setter '{0}' in '{1}'"); | 4939 static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode( |
| 4940 'UNDEFINED_SETTER', |
| 4941 "There is no such setter '{0}' in '{1}'"); |
4022 | 4942 |
4023 /** | 4943 /** |
4024 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not | 4944 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not |
4025 * declare a static method or getter <i>m</i>. | 4945 * declare a static method or getter <i>m</i>. |
4026 * | 4946 * |
4027 * @param methodName the name of the method | 4947 * @param methodName the name of the method |
4028 * @param enclosingType the name of the enclosing type where the method is | 4948 * @param enclosingType the name of the enclosing type where the method is |
4029 * being looked for | 4949 * being looked for |
4030 */ | 4950 */ |
4031 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = const Stati
cWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', "There is no such static metho
d, getter or setter '{0}' in '{1}'"); | 4951 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = |
| 4952 const StaticWarningCode( |
| 4953 'UNDEFINED_STATIC_METHOD_OR_GETTER', |
| 4954 "There is no such static method, getter or setter '{0}' in '{1}'"); |
4032 | 4955 |
4033 /** | 4956 /** |
4034 * 7.2 Getters: It is a static warning if the return type of a getter is void. | 4957 * 7.2 Getters: It is a static warning if the return type of a getter is void. |
4035 */ | 4958 */ |
4036 static const StaticWarningCode VOID_RETURN_FOR_GETTER = const StaticWarningCod
e('VOID_RETURN_FOR_GETTER', "The return type of the getter must not be 'void'"); | 4959 static const StaticWarningCode VOID_RETURN_FOR_GETTER = |
| 4960 const StaticWarningCode( |
| 4961 'VOID_RETURN_FOR_GETTER', |
| 4962 "The return type of the getter must not be 'void'"); |
4037 | 4963 |
4038 /** | 4964 /** |
4039 * Initialize a newly created error code to have the given [name]. The message | 4965 * Initialize a newly created error code to have the given [name]. The message |
4040 * associated with the error will be created from the given [message] | 4966 * associated with the error will be created from the given [message] |
4041 * template. The correction associated with the error will be created from the | 4967 * template. The correction associated with the error will be created from the |
4042 * given [correction] template. | 4968 * given [correction] template. |
4043 */ | 4969 */ |
4044 const StaticWarningCode(String name, String message, [String correction]) : su
per(name, message, correction); | 4970 const StaticWarningCode(String name, String message, [String correction]) |
| 4971 : super(name, message, correction); |
4045 | 4972 |
4046 @override | 4973 @override |
4047 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; | 4974 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; |
4048 | 4975 |
4049 @override | 4976 @override |
4050 ErrorType get type => ErrorType.STATIC_WARNING; | 4977 ErrorType get type => ErrorType.STATIC_WARNING; |
4051 } | 4978 } |
4052 | 4979 |
4053 /** | 4980 /** |
4054 * The class `TodoCode` defines the single TODO error code. | 4981 * The class `TodoCode` defines the single TODO error code. |
(...skipping 10 matching lines...) Expand all Loading... |
4065 * * TODO: | 4992 * * TODO: |
4066 * * TODO(username): | 4993 * * TODO(username): |
4067 * | 4994 * |
4068 * As well as | 4995 * As well as |
4069 * * TODO | 4996 * * TODO |
4070 * | 4997 * |
4071 * But not | 4998 * But not |
4072 * * todo | 4999 * * todo |
4073 * * TODOS | 5000 * * TODOS |
4074 */ | 5001 */ |
4075 static RegExp TODO_REGEX = new RegExp("([\\s/\\*])((TODO[^\\w\\d][^\\r\\n]*)|(
TODO:?\$))"); | 5002 static RegExp TODO_REGEX = |
| 5003 new RegExp("([\\s/\\*])((TODO[^\\w\\d][^\\r\\n]*)|(TODO:?\$))"); |
4076 | 5004 |
4077 /** | 5005 /** |
4078 * Initialize a newly created error code to have the given [name]. | 5006 * Initialize a newly created error code to have the given [name]. |
4079 */ | 5007 */ |
4080 const TodoCode(String name) : super(name, "{0}"); | 5008 const TodoCode(String name) : super(name, "{0}"); |
4081 | 5009 |
4082 @override | 5010 @override |
4083 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5011 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
4084 | 5012 |
4085 @override | 5013 @override |
4086 ErrorType get type => ErrorType.TODO; | 5014 ErrorType get type => ErrorType.TODO; |
4087 } | 5015 } |
OLD | NEW |