OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. |
| 7 |
| 8 library engine.error; |
| 9 |
| 10 import 'dart:collection'; |
| 11 import 'java_core.dart'; |
| 12 import 'source.dart'; |
| 13 import 'scanner.dart' show Token; |
| 14 import 'ast.dart' show AstNode; |
| 15 import 'element.dart'; |
| 16 |
| 17 /** |
| 18 * Instances of the class `AnalysisError` represent an error discovered during t
he analysis of |
| 19 * some Dart code. |
| 20 * |
| 21 * @see AnalysisErrorListener |
| 22 */ |
| 23 class AnalysisError { |
| 24 /** |
| 25 * An empty array of errors used when no errors are expected. |
| 26 */ |
| 27 static List<AnalysisError> NO_ERRORS = new List<AnalysisError>(0); |
| 28 |
| 29 /** |
| 30 * A [Comparator] that sorts by the name of the file that the [AnalysisError]
was |
| 31 * found. |
| 32 */ |
| 33 static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1, Analysis
Error o2) => o1.source.shortName.compareTo(o2.source.shortName); |
| 34 |
| 35 /** |
| 36 * A [Comparator] that sorts error codes first by their severity (errors first
, warnings |
| 37 * second), and then by the the error code type. |
| 38 */ |
| 39 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = (AnalysisError o1, An
alysisError o2) { |
| 40 ErrorCode errorCode1 = o1.errorCode; |
| 41 ErrorCode errorCode2 = o2.errorCode; |
| 42 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity; |
| 43 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity; |
| 44 ErrorType errorType1 = errorCode1.type; |
| 45 ErrorType errorType2 = errorCode2.type; |
| 46 if (errorSeverity1 == errorSeverity2) { |
| 47 return errorType1.compareTo(errorType2); |
| 48 } else { |
| 49 return errorSeverity2.compareTo(errorSeverity1); |
| 50 } |
| 51 }; |
| 52 |
| 53 /** |
| 54 * The error code associated with the error. |
| 55 */ |
| 56 final ErrorCode errorCode; |
| 57 |
| 58 /** |
| 59 * The localized error message. |
| 60 */ |
| 61 String _message; |
| 62 |
| 63 /** |
| 64 * The correction to be displayed for this error, or `null` if there is no cor
rection |
| 65 * information for this error. |
| 66 */ |
| 67 String _correction; |
| 68 |
| 69 /** |
| 70 * The source in which the error occurred, or `null` if unknown. |
| 71 */ |
| 72 Source source; |
| 73 |
| 74 /** |
| 75 * The character offset from the beginning of the source (zero based) where th
e error occurred. |
| 76 */ |
| 77 int _offset = 0; |
| 78 |
| 79 /** |
| 80 * The number of characters from the offset to the end of the source which enc
ompasses the |
| 81 * compilation error. |
| 82 */ |
| 83 int _length = 0; |
| 84 |
| 85 /** |
| 86 * A flag indicating whether this error can be shown to be a non-issue because
of the result of |
| 87 * type propagation. |
| 88 */ |
| 89 bool isStaticOnly = false; |
| 90 |
| 91 /** |
| 92 * Initialize a newly created analysis error for the specified source. The err
or has no location |
| 93 * information. |
| 94 * |
| 95 * @param source the source for which the exception occurred |
| 96 * @param errorCode the error code to be associated with this error |
| 97 * @param arguments the arguments used to build the error message |
| 98 */ |
| 99 AnalysisError.con1(this.source, this.errorCode, List<Object> arguments) { |
| 100 this._message = formatList(errorCode.message, arguments); |
| 101 } |
| 102 |
| 103 /** |
| 104 * Initialize a newly created analysis error for the specified source at the g
iven location. |
| 105 * |
| 106 * @param source the source for which the exception occurred |
| 107 * @param offset the offset of the location of the error |
| 108 * @param length the length of the location of the error |
| 109 * @param errorCode the error code to be associated with this error |
| 110 * @param arguments the arguments used to build the error message |
| 111 */ |
| 112 AnalysisError.con2(this.source, int offset, int length, this.errorCode, List<O
bject> arguments) { |
| 113 this._offset = offset; |
| 114 this._length = length; |
| 115 this._message = formatList(errorCode.message, arguments); |
| 116 String correctionTemplate = errorCode.correction; |
| 117 if (correctionTemplate != null) { |
| 118 this._correction = formatList(correctionTemplate, arguments); |
| 119 } |
| 120 } |
| 121 |
| 122 @override |
| 123 bool operator ==(Object obj) { |
| 124 if (identical(obj, this)) { |
| 125 return true; |
| 126 } |
| 127 // prepare other AnalysisError |
| 128 if (obj is! AnalysisError) { |
| 129 return false; |
| 130 } |
| 131 AnalysisError other = obj as AnalysisError; |
| 132 // Quick checks. |
| 133 if (!identical(errorCode, other.errorCode)) { |
| 134 return false; |
| 135 } |
| 136 if (_offset != other._offset || _length != other._length) { |
| 137 return false; |
| 138 } |
| 139 if (isStaticOnly != other.isStaticOnly) { |
| 140 return false; |
| 141 } |
| 142 // Deep checks. |
| 143 if (_message != other._message) { |
| 144 return false; |
| 145 } |
| 146 if (source != other.source) { |
| 147 return false; |
| 148 } |
| 149 // OK |
| 150 return true; |
| 151 } |
| 152 |
| 153 /** |
| 154 * Return the correction to be displayed for this error, or `null` if there is
no correction |
| 155 * information for this error. The correction should indicate how the user can
fix the error. |
| 156 * |
| 157 * @return the template used to create the correction to be displayed for this
error |
| 158 */ |
| 159 String get correction => _correction; |
| 160 |
| 161 /** |
| 162 * Return the number of characters from the offset to the end of the source wh
ich encompasses the |
| 163 * compilation error. |
| 164 * |
| 165 * @return the length of the error location |
| 166 */ |
| 167 int get length => _length; |
| 168 |
| 169 /** |
| 170 * Return the message to be displayed for this error. The message should indic
ate what is wrong |
| 171 * and why it is wrong. |
| 172 * |
| 173 * @return the message to be displayed for this error |
| 174 */ |
| 175 String get message => _message; |
| 176 |
| 177 /** |
| 178 * Return the character offset from the beginning of the source (zero based) w
here the error |
| 179 * occurred. |
| 180 * |
| 181 * @return the offset to the start of the error location |
| 182 */ |
| 183 int get offset => _offset; |
| 184 |
| 185 /** |
| 186 * Return the value of the given property, or `null` if the given property is
not defined |
| 187 * for this error. |
| 188 * |
| 189 * @param property the property whose value is to be returned |
| 190 * @return the value of the given property |
| 191 */ |
| 192 Object getProperty(ErrorProperty property) => null; |
| 193 |
| 194 @override |
| 195 int get hashCode { |
| 196 int hashCode = _offset; |
| 197 hashCode ^= (_message != null) ? _message.hashCode : 0; |
| 198 hashCode ^= (source != null) ? source.hashCode : 0; |
| 199 return hashCode; |
| 200 } |
| 201 |
| 202 @override |
| 203 String toString() { |
| 204 JavaStringBuilder builder = new JavaStringBuilder(); |
| 205 builder.append((source != null) ? source.fullName : "<unknown source>"); |
| 206 builder.append("("); |
| 207 builder.append(_offset); |
| 208 builder.append(".."); |
| 209 builder.append(_offset + _length - 1); |
| 210 builder.append("): "); |
| 211 //builder.append("(" + lineNumber + ":" + columnNumber + "): "); |
| 212 builder.append(_message); |
| 213 return builder.toString(); |
| 214 } |
| 215 } |
| 216 |
| 217 /** |
| 218 * The interface `AnalysisErrorListener` defines the behavior of objects that li
sten for |
| 219 * [AnalysisError] being produced by the analysis engine. |
| 220 */ |
| 221 abstract class AnalysisErrorListener { |
| 222 /** |
| 223 * An error listener that ignores errors that are reported to it. |
| 224 */ |
| 225 static final AnalysisErrorListener NULL_LISTENER = new AnalysisErrorListener_N
ULL_LISTENER(); |
| 226 |
| 227 /** |
| 228 * This method is invoked when an error has been found by the analysis engine. |
| 229 * |
| 230 * @param error the error that was just found (not `null`) |
| 231 */ |
| 232 void onError(AnalysisError error); |
| 233 } |
| 234 |
| 235 class AnalysisErrorListener_NULL_LISTENER implements AnalysisErrorListener { |
| 236 @override |
| 237 void onError(AnalysisError event) { |
| 238 } |
| 239 } |
| 240 |
| 241 /** |
| 242 * Instances of the class `AnalysisErrorWithProperties` |
| 243 */ |
| 244 class AnalysisErrorWithProperties extends AnalysisError { |
| 245 /** |
| 246 * The properties associated with this error. |
| 247 */ |
| 248 HashMap<ErrorProperty, Object> _propertyMap = new HashMap<ErrorProperty, Objec
t>(); |
| 249 |
| 250 /** |
| 251 * Initialize a newly created analysis error for the specified source. The err
or has no location |
| 252 * information. |
| 253 * |
| 254 * @param source the source for which the exception occurred |
| 255 * @param errorCode the error code to be associated with this error |
| 256 * @param arguments the arguments used to build the error message |
| 257 */ |
| 258 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, List<Obje
ct> arguments) : super.con1(source, errorCode, arguments); |
| 259 |
| 260 /** |
| 261 * Initialize a newly created analysis error for the specified source at the g
iven location. |
| 262 * |
| 263 * @param source the source for which the exception occurred |
| 264 * @param offset the offset of the location of the error |
| 265 * @param length the length of the location of the error |
| 266 * @param errorCode the error code to be associated with this error |
| 267 * @param arguments the arguments used to build the error message |
| 268 */ |
| 269 AnalysisErrorWithProperties.con2(Source source, int offset, int length, ErrorC
ode errorCode, List<Object> arguments) : super.con2(source, offset, length, erro
rCode, arguments); |
| 270 |
| 271 @override |
| 272 Object getProperty(ErrorProperty property) => _propertyMap[property]; |
| 273 |
| 274 /** |
| 275 * Set the value of the given property to the given value. Using a value of `n
ull` will |
| 276 * effectively remove the property from this error. |
| 277 * |
| 278 * @param property the property whose value is to be returned |
| 279 * @param value the new value of the given property |
| 280 */ |
| 281 void setProperty(ErrorProperty property, Object value) { |
| 282 _propertyMap[property] = value; |
| 283 } |
| 284 } |
| 285 |
| 286 /** |
| 287 * The enumeration `AngularCode` defines Angular specific problems. |
| 288 */ |
| 289 class AngularCode extends Enum<AngularCode> implements ErrorCode { |
| 290 static const AngularCode CANNOT_PARSE_SELECTOR = const AngularCode('CANNOT_PAR
SE_SELECTOR', 0, "The selector '{0}' cannot be parsed"); |
| 291 |
| 292 static const AngularCode INVALID_FORMATTER_NAME = const AngularCode('INVALID_F
ORMATTER_NAME', 1, "Formatter name must be a simple identifier"); |
| 293 |
| 294 static const AngularCode INVALID_PROPERTY_KIND = const AngularCode('INVALID_PR
OPERTY_KIND', 2, "Unknown property binding kind '{0}', use one of the '@', '=>',
'=>!' or '<=>'"); |
| 295 |
| 296 static const AngularCode INVALID_PROPERTY_FIELD = const AngularCode('INVALID_P
ROPERTY_FIELD', 3, "Unknown property field '{0}'"); |
| 297 |
| 298 static const AngularCode INVALID_PROPERTY_MAP = const AngularCode('INVALID_PRO
PERTY_MAP', 4, "Argument 'map' must be a constant map literal"); |
| 299 |
| 300 static const AngularCode INVALID_PROPERTY_NAME = const AngularCode('INVALID_PR
OPERTY_NAME', 5, "Property name must be a string literal"); |
| 301 |
| 302 static const AngularCode INVALID_PROPERTY_SPEC = const AngularCode('INVALID_PR
OPERTY_SPEC', 6, "Property binding specification must be a string literal"); |
| 303 |
| 304 static const AngularCode INVALID_REPEAT_SYNTAX = const AngularCode('INVALID_RE
PEAT_SYNTAX', 7, "Expected statement in form '_item_ in _collection_ [tracked by
_id_]'"); |
| 305 |
| 306 static const AngularCode INVALID_REPEAT_ITEM_SYNTAX = const AngularCode('INVAL
ID_REPEAT_ITEM_SYNTAX', 8, "Item must by identifier or in '(_key_, _value_)' pai
r."); |
| 307 |
| 308 static const AngularCode INVALID_URI = const AngularCode('INVALID_URI', 9, "In
valid URI syntax: '{0}'"); |
| 309 |
| 310 static const AngularCode MISSING_FORMATTER_COLON = const AngularCode('MISSING_
FORMATTER_COLON', 10, "Missing ':' before formatter argument"); |
| 311 |
| 312 static const AngularCode MISSING_NAME = const AngularCode('MISSING_NAME', 11,
"Argument 'name' must be provided"); |
| 313 |
| 314 static const AngularCode MISSING_PUBLISH_AS = const AngularCode('MISSING_PUBLI
SH_AS', 12, "Argument 'publishAs' must be provided"); |
| 315 |
| 316 static const AngularCode MISSING_SELECTOR = const AngularCode('MISSING_SELECTO
R', 13, "Argument 'selector' must be provided"); |
| 317 |
| 318 static const AngularCode URI_DOES_NOT_EXIST = const AngularCode('URI_DOES_NOT_
EXIST', 14, "Target of URI does not exist: '{0}'"); |
| 319 |
| 320 static const List<AngularCode> values = const [ |
| 321 CANNOT_PARSE_SELECTOR, |
| 322 INVALID_FORMATTER_NAME, |
| 323 INVALID_PROPERTY_KIND, |
| 324 INVALID_PROPERTY_FIELD, |
| 325 INVALID_PROPERTY_MAP, |
| 326 INVALID_PROPERTY_NAME, |
| 327 INVALID_PROPERTY_SPEC, |
| 328 INVALID_REPEAT_SYNTAX, |
| 329 INVALID_REPEAT_ITEM_SYNTAX, |
| 330 INVALID_URI, |
| 331 MISSING_FORMATTER_COLON, |
| 332 MISSING_NAME, |
| 333 MISSING_PUBLISH_AS, |
| 334 MISSING_SELECTOR, |
| 335 URI_DOES_NOT_EXIST]; |
| 336 |
| 337 /** |
| 338 * The template used to create the message to be displayed for this error. |
| 339 */ |
| 340 final String message; |
| 341 |
| 342 /** |
| 343 * Initialize a newly created error code to have the given message. |
| 344 * |
| 345 * @param message the message template used to create the message to be displa
yed for the error |
| 346 */ |
| 347 const AngularCode(String name, int ordinal, this.message) : super(name, ordina
l); |
| 348 |
| 349 @override |
| 350 String get correction => null; |
| 351 |
| 352 @override |
| 353 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 354 |
| 355 @override |
| 356 ErrorType get type => ErrorType.ANGULAR; |
| 357 |
| 358 @override |
| 359 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 360 } |
| 361 |
| 362 /** |
| 363 * Instances of the class `BooleanErrorListener` implement a listener that keeps
track of |
| 364 * whether an error has been reported to it. |
| 365 */ |
| 366 class BooleanErrorListener implements AnalysisErrorListener { |
| 367 /** |
| 368 * A flag indicating whether an error has been reported to this listener. |
| 369 */ |
| 370 bool _errorReported = false; |
| 371 |
| 372 /** |
| 373 * Return `true` if an error has been reported to this listener. |
| 374 * |
| 375 * @return `true` if an error has been reported to this listener |
| 376 */ |
| 377 bool get errorReported => _errorReported; |
| 378 |
| 379 @override |
| 380 void onError(AnalysisError error) { |
| 381 _errorReported = true; |
| 382 } |
| 383 } |
| 384 |
| 385 /** |
| 386 * The enumeration `CompileTimeErrorCode` defines the error codes used for compi
le time |
| 387 * errors. The convention for this class is for the name of the error code to in
dicate the problem |
| 388 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 389 * when appropriate, how the problem can be corrected. |
| 390 */ |
| 391 class CompileTimeErrorCode extends Enum<CompileTimeErrorCode> implements ErrorCo
de { |
| 392 /** |
| 393 * Enum proposal: It is also a compile-time error to explicitly instantiate an
enum via 'new' or |
| 394 * 'const' or to access its private fields. |
| 395 */ |
| 396 static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD = const CompileTim
eErrorCode.con1('ACCESS_PRIVATE_ENUM_FIELD', 0, "The private fields of an enum c
annot be accessed, even within the same library"); |
| 397 |
| 398 /** |
| 399 * 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported
by a library |
| 400 * <i>L</i> and <i>N</i> is introduced into the export namespace of <i>L</i> b
y more than one |
| 401 * export, unless each all exports refer to same declaration for the name N. |
| 402 * |
| 403 * @param ambiguousElementName the name of the ambiguous element |
| 404 * @param firstLibraryName the name of the first library that the type is foun
d |
| 405 * @param secondLibraryName the name of the second library that the type is fo
und |
| 406 */ |
| 407 static const CompileTimeErrorCode AMBIGUOUS_EXPORT = const CompileTimeErrorCod
e.con1('AMBIGUOUS_EXPORT', 1, "The name '{0}' is defined in the libraries '{1}'
and '{2}'"); |
| 408 |
| 409 /** |
| 410 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does
not denote a formal |
| 411 * parameter. |
| 412 * |
| 413 * @param the name of the identifier in the argument definition test that is n
ot a parameter |
| 414 */ |
| 415 static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = con
st CompileTimeErrorCode.con1('ARGUMENT_DEFINITION_TEST_NON_PARAMETER', 2, "'{0}'
is not a parameter"); |
| 416 |
| 417 /** |
| 418 * 12.30 Identifier Reference: It is a compile-time error to use a built-in id
entifier other than |
| 419 * dynamic as a type annotation. |
| 420 */ |
| 421 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = const CompileT
imeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPE', 3, "The built-in identifier '{0
}' cannot be as a type"); |
| 422 |
| 423 /** |
| 424 * 12.30 Identifier Reference: It is a compile-time error if a built-in identi
fier is used as the |
| 425 * declared name of a class, type parameter or type alias. |
| 426 */ |
| 427 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = const Com
pileTimeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', 4, "The built-in iden
tifier '{0}' cannot be used as a type name"); |
| 428 |
| 429 /** |
| 430 * 12.30 Identifier Reference: It is a compile-time error if a built-in identi
fier is used as the |
| 431 * declared name of a class, type parameter or type alias. |
| 432 */ |
| 433 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = const
CompileTimeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', 5, "The built-i
n identifier '{0}' cannot be used as a type alias name"); |
| 434 |
| 435 /** |
| 436 * 12.30 Identifier Reference: It is a compile-time error if a built-in identi
fier is used as the |
| 437 * declared name of a class, type parameter or type alias. |
| 438 */ |
| 439 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME =
const CompileTimeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME', 6
, "The built-in identifier '{0}' cannot be used as a type parameter name"); |
| 440 |
| 441 /** |
| 442 * 13.9 Switch: It is a compile-time error if the class <i>C</i> implements th
e operator |
| 443 * <i>==</i>. |
| 444 */ |
| 445 static const CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = con
st CompileTimeErrorCode.con1('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', 7, "The s
witch case expression type '{0}' cannot override the == operator"); |
| 446 |
| 447 /** |
| 448 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time
constant would raise |
| 449 * an exception. |
| 450 */ |
| 451 static const CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = con
st CompileTimeErrorCode.con1('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', 8, ""); |
| 452 |
| 453 /** |
| 454 * 7.2 Getters: It is a compile-time error if a class has both a getter and a
method with the same |
| 455 * name. This restriction holds regardless of whether the getter is defined ex
plicitly or |
| 456 * implicitly, or whether the getter or the method are inherited or not. |
| 457 */ |
| 458 static const CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD = const Compil
eTimeErrorCode.con1('CONFLICTING_GETTER_AND_METHOD', 9, "Class '{0}' cannot have
both getter '{1}.{2}' and method with the same name"); |
| 459 |
| 460 /** |
| 461 * 7.2 Getters: It is a compile-time error if a class has both a getter and a
method with the same |
| 462 * name. This restriction holds regardless of whether the getter is defined ex
plicitly or |
| 463 * implicitly, or whether the getter or the method are inherited or not. |
| 464 */ |
| 465 static const CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER = const Compil
eTimeErrorCode.con1('CONFLICTING_METHOD_AND_GETTER', 10, "Class '{0}' cannot hav
e both method '{1}.{2}' and getter with the same name"); |
| 466 |
| 467 /** |
| 468 * 7.6 Constructors: A constructor name always begins with the name of its imm
ediately enclosing |
| 469 * class, and may optionally be followed by a dot and an identifier <i>id</i>.
It is a |
| 470 * compile-time error if <i>id</i> is the name of a member declared in the imm
ediately enclosing |
| 471 * class. |
| 472 */ |
| 473 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = con
st CompileTimeErrorCode.con1('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', 11, "'{0}
' cannot be used to name a constructor and a field in this class"); |
| 474 |
| 475 /** |
| 476 * 7.6 Constructors: A constructor name always begins with the name of its imm
ediately enclosing |
| 477 * class, and may optionally be followed by a dot and an identifier <i>id</i>.
It is a |
| 478 * compile-time error if <i>id</i> is the name of a member declared in the imm
ediately enclosing |
| 479 * class. |
| 480 */ |
| 481 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = co
nst CompileTimeErrorCode.con1('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', 12, "'{
0}' cannot be used to name a constructor and a method in this class"); |
| 482 |
| 483 /** |
| 484 * 7. Classes: It is a compile time error if a generic class declares a type v
ariable with the |
| 485 * same name as the class or any of its members or constructors. |
| 486 */ |
| 487 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS = const
CompileTimeErrorCode.con1('CONFLICTING_TYPE_VARIABLE_AND_CLASS', 13, "'{0}' cann
ot be used to name a type varaible in a class with the same name"); |
| 488 |
| 489 /** |
| 490 * 7. Classes: It is a compile time error if a generic class declares a type v
ariable with the |
| 491 * same name as the class or any of its members or constructors. |
| 492 */ |
| 493 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER = const
CompileTimeErrorCode.con1('CONFLICTING_TYPE_VARIABLE_AND_MEMBER', 14, "'{0}' ca
nnot be used to name a type varaible and member in this class"); |
| 494 |
| 495 /** |
| 496 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 497 * uncaught exception being thrown. |
| 498 */ |
| 499 static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = const C
ompileTimeErrorCode.con1('CONST_CONSTRUCTOR_THROWS_EXCEPTION', 15, "'const' cons
tructors cannot throw exceptions"); |
| 500 |
| 501 /** |
| 502 * 10.6.3 Constant Constructors: It is a compile-time error if a constant cons
tructor is declared |
| 503 * by a class C if any instance variable declared in C is initialized with an
expression that is |
| 504 * not a constant expression. |
| 505 */ |
| 506 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_
NON_CONST = const CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_FIELD_INITIA
LIZED_BY_NON_CONST', 16, "Can't define the 'const' constructor because the field
'{0}' is initialized with a non-constant value"); |
| 507 |
| 508 /** |
| 509 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
or implicitly, in |
| 510 * the initializer list of a constant constructor must specify a constant cons
tructor of the |
| 511 * superclass of the immediately enclosing class or a compile-time error occur
s. |
| 512 * |
| 513 * 9 Mixins: For each generative constructor named ... an implicitly declared
constructor named |
| 514 * ... is declared. |
| 515 */ |
| 516 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN = const Compile
TimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_MIXIN', 17, "Constant constructor can
not be declared for a class with a mixin"); |
| 517 |
| 518 /** |
| 519 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
or implicitly, in |
| 520 * the initializer list of a constant constructor must specify a constant cons
tructor of the |
| 521 * superclass of the immediately enclosing class or a compile-time error occur
s. |
| 522 */ |
| 523 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER = con
st CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER', 18, "Cons
tant constructor cannot call non-constant super constructor of '{0}'"); |
| 524 |
| 525 /** |
| 526 * 7.6.3 Constant Constructors: It is a compile-time error if a constant const
ructor is declared |
| 527 * by a class that has a non-final instance variable. |
| 528 * |
| 529 * The above refers to both locally declared and inherited instance variables. |
| 530 */ |
| 531 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = con
st CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 19, "Cann
ot define the 'const' constructor for a class with non-final fields"); |
| 532 |
| 533 /** |
| 534 * 12.12.2 Const: It is a compile-time error if <i>T</i> is a deferred type. |
| 535 */ |
| 536 static const CompileTimeErrorCode CONST_DEFERRED_CLASS = const CompileTimeErro
rCode.con1('CONST_DEFERRED_CLASS', 20, "Deferred classes cannot be created with
'const'"); |
| 537 |
| 538 /** |
| 539 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error
if o is not |
| 540 * <b>null</b> and the interface of the class of <i>o</i> is not a subtype of
the static type of |
| 541 * the field <i>v</i>. |
| 542 * |
| 543 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 544 * uncaught exception being thrown. |
| 545 * |
| 546 * @param initializerType the name of the type of the initializer expression |
| 547 * @param fieldType the name of the type of the field |
| 548 */ |
| 549 static const CompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = con
st CompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', 21, "The
initializer type '{0}' cannot be assigned to the field type '{1}'"); |
| 550 |
| 551 /** |
| 552 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is
declared as a |
| 553 * constant variable. |
| 554 */ |
| 555 static const CompileTimeErrorCode CONST_FORMAL_PARAMETER = const CompileTimeEr
rorCode.con1('CONST_FORMAL_PARAMETER', 22, "Parameters cannot be 'const'"); |
| 556 |
| 557 /** |
| 558 * 5 Variables: A constant variable must be initialized to a compile-time cons
tant or a |
| 559 * compile-time error occurs. |
| 560 */ |
| 561 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE =
const CompileTimeErrorCode.con1('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 23,
"'const' variables must be constant value"); |
| 562 |
| 563 /** |
| 564 * 5 Variables: A constant variable must be initialized to a compile-time cons
tant or a |
| 565 * compile-time error occurs. |
| 566 * |
| 567 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 568 * deferred prefix. |
| 569 */ |
| 570 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FR
OM_DEFERRED_LIBRARY = const CompileTimeErrorCode.con1('CONST_INITIALIZED_WITH_NO
N_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', 24, "Constant values from a deferred li
brary cannot be used to initialized a 'const' variable"); |
| 571 |
| 572 /** |
| 573 * 7.5 Instance Variables: It is a compile-time error if an instance variable
is declared to be |
| 574 * constant. |
| 575 */ |
| 576 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = const CompileTimeErro
rCode.con1('CONST_INSTANCE_FIELD', 25, "Only static fields can be declared as 'c
onst'"); |
| 577 |
| 578 /** |
| 579 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant
map literal is an |
| 580 * instance of a class that implements the operator <i>==</i> unless the key i
s a string or |
| 581 * integer. |
| 582 */ |
| 583 static const CompileTimeErrorCode CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQU
ALS = const CompileTimeErrorCode.con1('CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_
EQUALS', 26, "The constant map entry key expression type '{0}' cannot override t
he == operator"); |
| 584 |
| 585 /** |
| 586 * 5 Variables: A constant variable must be initialized to a compile-time cons
tant (12.1) or a |
| 587 * compile-time error occurs. |
| 588 * |
| 589 * @param name the name of the uninitialized final variable |
| 590 */ |
| 591 static const CompileTimeErrorCode CONST_NOT_INITIALIZED = const CompileTimeErr
orCode.con1('CONST_NOT_INITIALIZED', 27, "The const variable '{0}' must be initi
alized"); |
| 592 |
| 593 /** |
| 594 * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
where e, e1 and e2 |
| 595 * are constant expressions that evaluate to a boolean value. |
| 596 */ |
| 597 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = const CompileTimeErro
rCode.con1('CONST_EVAL_TYPE_BOOL', 28, "An expression of type 'bool' was expecte
d"); |
| 598 |
| 599 /** |
| 600 * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where
e1 and e2 are |
| 601 * constant expressions that evaluate to a numeric, string or boolean value or
to null. |
| 602 */ |
| 603 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = const Comp
ileTimeErrorCode.con1('CONST_EVAL_TYPE_BOOL_NUM_STRING', 29, "An expression of t
ype 'bool', 'num', 'String' or 'null' was expected"); |
| 604 |
| 605 /** |
| 606 * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, e1 |
e2, e1 >> e2 or e1 |
| 607 * << e2, where e, e1 and e2 are constant expressions that evaluate to an inte
ger value or to |
| 608 * null. |
| 609 */ |
| 610 static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = const CompileTimeError
Code.con1('CONST_EVAL_TYPE_INT', 30, "An expression of type 'int' was expected")
; |
| 611 |
| 612 /** |
| 613 * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 *
e2, e1 / e2, e1 ~/ |
| 614 * e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, where e, e1 and e2 are
constant |
| 615 * expressions that evaluate to a numeric value or to null.. |
| 616 */ |
| 617 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = const CompileTimeError
Code.con1('CONST_EVAL_TYPE_NUM', 31, "An expression of type 'num' was expected")
; |
| 618 |
| 619 /** |
| 620 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 621 * uncaught exception being thrown. |
| 622 */ |
| 623 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = const CompileT
imeErrorCode.con1('CONST_EVAL_THROWS_EXCEPTION', 32, "Evaluation of this constan
t expression causes exception"); |
| 624 |
| 625 /** |
| 626 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 627 * uncaught exception being thrown. |
| 628 */ |
| 629 static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = const CompileTimeE
rrorCode.con1('CONST_EVAL_THROWS_IDBZE', 33, "Evaluation of this constant expres
sion throws IntegerDivisionByZeroException"); |
| 630 |
| 631 /** |
| 632 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, &
hellip;, |
| 633 * U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time error if <i>S
</i> is not a |
| 634 * generic type with <i>m</i> type parameters. |
| 635 * |
| 636 * @param typeName the name of the type being referenced (<i>S</i>) |
| 637 * @param parameterCount the number of type parameters that were declared |
| 638 * @param argumentCount the number of type arguments provided |
| 639 * @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS |
| 640 * @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS |
| 641 */ |
| 642 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = const C
ompileTimeErrorCode.con1('CONST_WITH_INVALID_TYPE_PARAMETERS', 34, "The type '{0
}' is declared with {1} type parameters, but {2} type arguments were given"); |
| 643 |
| 644 /** |
| 645 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, &hellip
;, a<sub>n</sub>, |
| 646 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub
>)</i> it is a |
| 647 * compile-time error if the type <i>T</i> does not declare a constant constru
ctor with the same |
| 648 * name as the declaration of <i>T</i>. |
| 649 */ |
| 650 static const CompileTimeErrorCode CONST_WITH_NON_CONST = const CompileTimeErro
rCode.con1('CONST_WITH_NON_CONST', 35, "The constructor being called is not a 'c
onst' constructor"); |
| 651 |
| 652 /** |
| 653 * 12.11.2 Const: In all of the above cases, it is a compile-time error if <i>
a<sub>i</sub>, 1 |
| 654 * <= i <= n + k</i>, is not a compile-time constant expression. |
| 655 */ |
| 656 static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = const Com
pileTimeErrorCode.con1('CONST_WITH_NON_CONSTANT_ARGUMENT', 36, "Arguments of a c
onstant creation must be constant expressions"); |
| 657 |
| 658 /** |
| 659 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class access
ible in the current |
| 660 * scope, optionally followed by type arguments. |
| 661 * |
| 662 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, &hel
lip;, a<sub>n</sub>, |
| 663 * x<sub>n+1</sub>: a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>
)</i> it is a |
| 664 * compile-time error if <i>T</i> is not a class accessible in the current sco
pe, optionally |
| 665 * followed by type arguments. |
| 666 * |
| 667 * @param name the name of the non-type element |
| 668 */ |
| 669 static const CompileTimeErrorCode CONST_WITH_NON_TYPE = const CompileTimeError
Code.con1('CONST_WITH_NON_TYPE', 37, "The name '{0}' is not a class"); |
| 670 |
| 671 /** |
| 672 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type par
ameters. |
| 673 */ |
| 674 static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = const CompileTi
meErrorCode.con1('CONST_WITH_TYPE_PARAMETERS', 38, "The constant creation cannot
use a type parameter"); |
| 675 |
| 676 /** |
| 677 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
a constant |
| 678 * constructor declared by the type <i>T</i>. |
| 679 * |
| 680 * @param typeName the name of the type |
| 681 * @param constructorName the name of the requested constant constructor |
| 682 */ |
| 683 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = const Com
pileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR', 39, "The class '{0}'
does not have a constant constructor '{1}'"); |
| 684 |
| 685 /** |
| 686 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
a constant |
| 687 * constructor declared by the type <i>T</i>. |
| 688 * |
| 689 * @param typeName the name of the type |
| 690 */ |
| 691 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = c
onst CompileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 40, "
The class '{0}' does not have a default constant constructor"); |
| 692 |
| 693 /** |
| 694 * 15.3.1 Typedef: It is a compile-time error if any default values are specif
ied in the signature |
| 695 * of a function type alias. |
| 696 */ |
| 697 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = const
CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 41, "Default
values aren't allowed in typedefs"); |
| 698 |
| 699 /** |
| 700 * 6.2.1 Required Formals: By means of a function signature that names the par
ameter and describes |
| 701 * its type as a function type. It is a compile-time error if any default valu
es are specified in |
| 702 * the signature of such a function type. |
| 703 */ |
| 704 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER =
const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', 42,
"Default values aren't allowed in function type parameters"); |
| 705 |
| 706 /** |
| 707 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly specifie
s a default value |
| 708 * for an optional parameter. |
| 709 */ |
| 710 static const CompileTimeErrorCode DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRU
CTOR = const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CON
STRUCTOR', 43, "Default values aren't allowed in factory constructors that redir
ect to another constructor"); |
| 711 |
| 712 /** |
| 713 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi
th the same name |
| 714 * declared in the same scope. |
| 715 */ |
| 716 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = const Compil
eTimeErrorCode.con1('DUPLICATE_CONSTRUCTOR_DEFAULT', 44, "The default constructo
r is already defined"); |
| 717 |
| 718 /** |
| 719 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi
th the same name |
| 720 * declared in the same scope. |
| 721 * |
| 722 * @param duplicateName the name of the duplicate entity |
| 723 */ |
| 724 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = const CompileTi
meErrorCode.con1('DUPLICATE_CONSTRUCTOR_NAME', 45, "The constructor with name '{
0}' is already defined"); |
| 725 |
| 726 /** |
| 727 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi
th the same name |
| 728 * declared in the same scope. |
| 729 * |
| 730 * 7 Classes: It is a compile-time error if a class declares two members of th
e same name. |
| 731 * |
| 732 * 7 Classes: It is a compile-time error if a class has an instance member and
a static member |
| 733 * with the same name. |
| 734 * |
| 735 * @param duplicateName the name of the duplicate entity |
| 736 */ |
| 737 static const CompileTimeErrorCode DUPLICATE_DEFINITION = const CompileTimeErro
rCode.con1('DUPLICATE_DEFINITION', 46, "The name '{0}' is already defined"); |
| 738 |
| 739 /** |
| 740 * 7. Classes: It is a compile-time error if a class has an instance member an
d a static member |
| 741 * with the same name. |
| 742 * |
| 743 * This covers the additional duplicate definition cases where inheritance has
to be considered. |
| 744 * |
| 745 * @param className the name of the class that has conflicting instance/static
members |
| 746 * @param name the name of the conflicting members |
| 747 * @see #DUPLICATE_DEFINITION |
| 748 */ |
| 749 static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = const Com
pileTimeErrorCode.con1('DUPLICATE_DEFINITION_INHERITANCE', 47, "The name '{0}' i
s already defined in '{1}'"); |
| 750 |
| 751 /** |
| 752 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if <i>q<sub>
i</sub> = |
| 753 * q<sub>j</sub></i> for any <i>i != j</i> [where <i>q<sub>i</sub></i> is the
label for a named |
| 754 * argument]. |
| 755 */ |
| 756 static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = const CompileTime
ErrorCode.con1('DUPLICATE_NAMED_ARGUMENT', 48, "The argument for the named param
eter '{0}' was already specified"); |
| 757 |
| 758 /** |
| 759 * SDK implementation libraries can be exported only by other SDK libraries. |
| 760 * |
| 761 * @param uri the uri pointing to a library |
| 762 */ |
| 763 static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = const CompileTimeE
rrorCode.con1('EXPORT_INTERNAL_LIBRARY', 49, "The library '{0}' is internal and
cannot be exported"); |
| 764 |
| 765 /** |
| 766 * 14.2 Exports: It is a compile-time error if the compilation unit found at t
he specified URI is |
| 767 * not a library declaration. |
| 768 * |
| 769 * @param uri the uri pointing to a non-library declaration |
| 770 */ |
| 771 static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = const CompileTimeErr
orCode.con1('EXPORT_OF_NON_LIBRARY', 50, "The exported library '{0}' must not ha
ve a part-of directive"); |
| 772 |
| 773 /** |
| 774 * Enum proposal: It is a compile-time error to subclass, mix-in or implement
an enum. |
| 775 */ |
| 776 static const CompileTimeErrorCode EXTENDS_ENUM = const CompileTimeErrorCode.co
n1('EXTENDS_ENUM', 51, "Classes cannot extend an enum"); |
| 777 |
| 778 /** |
| 779 * 7.9 Superclasses: It is a compile-time error if the extends clause of a cla
ss <i>C</i> includes |
| 780 * a type expression that does not denote a class available in the lexical sco
pe of <i>C</i>. |
| 781 * |
| 782 * @param typeName the name of the superclass that was not found |
| 783 */ |
| 784 static const CompileTimeErrorCode EXTENDS_NON_CLASS = const CompileTimeErrorCo
de.con1('EXTENDS_NON_CLASS', 52, "Classes can only extend other classes"); |
| 785 |
| 786 /** |
| 787 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i
mplement Null. |
| 788 * |
| 789 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement int. |
| 790 * |
| 791 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement double. |
| 792 * |
| 793 * 12.3 Numbers: It is a compile-time error for any type other than the types
int and double to |
| 794 * attempt to extend or implement num. |
| 795 * |
| 796 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend
or implement bool. |
| 797 * |
| 798 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o
r implement String. |
| 799 * |
| 800 * @param typeName the name of the type that cannot be extended |
| 801 * @see #IMPLEMENTS_DISALLOWED_CLASS |
| 802 */ |
| 803 static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = const CompileTime
ErrorCode.con1('EXTENDS_DISALLOWED_CLASS', 53, "Classes cannot extend '{0}'"); |
| 804 |
| 805 /** |
| 806 * 7.9 Superclasses: It is a compile-time error if the extends clause of a cla
ss <i>C</i> includes |
| 807 * a deferred type expression. |
| 808 * |
| 809 * @param typeName the name of the type that cannot be extended |
| 810 * @see #IMPLEMENTS_DEFERRED_CLASS |
| 811 * @see #MIXIN_DEFERRED_CLASS |
| 812 */ |
| 813 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = const CompileTimeEr
rorCode.con1('EXTENDS_DEFERRED_CLASS', 54, "This class cannot extend the deferre
d class '{0}'"); |
| 814 |
| 815 /** |
| 816 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</
i> or if <i>m > |
| 817 * n</i>. |
| 818 * |
| 819 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 820 * uncaught exception being thrown. |
| 821 * |
| 822 * @param requiredCount the maximum number of positional arguments |
| 823 * @param argumentCount the actual number of positional arguments given |
| 824 */ |
| 825 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = const CompileTi
meErrorCode.con1('EXTRA_POSITIONAL_ARGUMENTS', 55, "{0} positional arguments exp
ected, but {1} found"); |
| 826 |
| 827 /** |
| 828 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile time |
| 829 * error if more than one initializer corresponding to a given instance variab
le appears in |
| 830 * <i>k</i>'s list. |
| 831 */ |
| 832 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS =
const CompileTimeErrorCode.con1('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 5
6, "The field '{0}' cannot be initialized twice in the same constructor"); |
| 833 |
| 834 /** |
| 835 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile time |
| 836 * error if <i>k</i>'s initializer list contains an initializer for a variable
that is initialized |
| 837 * by means of an initializing formal of <i>k</i>. |
| 838 */ |
| 839 static const CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZ
ER = const CompileTimeErrorCode.con1('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIAL
IZER', 57, "Fields cannot be initialized in both the parameter list and the init
ializers"); |
| 840 |
| 841 /** |
| 842 * 5 Variables: It is a compile-time error if a final instance variable that h
as is initialized by |
| 843 * means of an initializing formal of a constructor is also initialized elsewh
ere in the same |
| 844 * constructor. |
| 845 * |
| 846 * @param name the name of the field in question |
| 847 */ |
| 848 static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = const Com
pileTimeErrorCode.con1('FINAL_INITIALIZED_MULTIPLE_TIMES', 58, "'{0}' is a final
field and so can only be set once"); |
| 849 |
| 850 /** |
| 851 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin
g formal is used by |
| 852 * a function other than a non-redirecting generative constructor. |
| 853 */ |
| 854 static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = cons
t CompileTimeErrorCode.con1('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', 59, "Initia
lizing formal fields cannot be used in factory constructors"); |
| 855 |
| 856 /** |
| 857 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin
g formal is used by |
| 858 * a function other than a non-redirecting generative constructor. |
| 859 */ |
| 860 static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = cons
t CompileTimeErrorCode.con1('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 60, "Initia
lizing formal fields can only be used in constructors"); |
| 861 |
| 862 /** |
| 863 * 7.6.1 Generative Constructors: A generative constructor may be redirecting,
in which case its |
| 864 * only action is to invoke another generative constructor. |
| 865 * |
| 866 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin
g formal is used by |
| 867 * a function other than a non-redirecting generative constructor. |
| 868 */ |
| 869 static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR =
const CompileTimeErrorCode.con1('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', 61,
"The redirecting constructor cannot have a field initializer"); |
| 870 |
| 871 /** |
| 872 * 7.2 Getters: It is a compile-time error if a class has both a getter and a
method with the same |
| 873 * name. |
| 874 * |
| 875 * @param name the conflicting name of the getter and method |
| 876 */ |
| 877 static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = const Com
pileTimeErrorCode.con1('GETTER_AND_METHOD_WITH_SAME_NAME', 62, "'{0}' cannot be
used to name a getter, there is already a method with the same name"); |
| 878 |
| 879 /** |
| 880 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o
f a class <i>C</i> |
| 881 * specifies a malformed type or deferred type as a superinterface. |
| 882 * |
| 883 * @param typeName the name of the type that cannot be extended |
| 884 * @see #EXTENDS_DEFERRED_CLASS |
| 885 * @see #MIXIN_DEFERRED_CLASS |
| 886 */ |
| 887 static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS = const CompileTim
eErrorCode.con1('IMPLEMENTS_DEFERRED_CLASS', 63, "This class cannot implement th
e deferred class '{0}'"); |
| 888 |
| 889 /** |
| 890 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i
mplement Null. |
| 891 * |
| 892 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement int. |
| 893 * |
| 894 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement double. |
| 895 * |
| 896 * 12.3 Numbers: It is a compile-time error for any type other than the types
int and double to |
| 897 * attempt to extend or implement num. |
| 898 * |
| 899 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend
or implement bool. |
| 900 * |
| 901 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o
r implement String. |
| 902 * |
| 903 * @param typeName the name of the type that cannot be implemented |
| 904 * @see #EXTENDS_DISALLOWED_CLASS |
| 905 */ |
| 906 static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = const CompileT
imeErrorCode.con1('IMPLEMENTS_DISALLOWED_CLASS', 64, "Classes cannot implement '
{0}'"); |
| 907 |
| 908 /** |
| 909 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o
f a class includes |
| 910 * type dynamic. |
| 911 */ |
| 912 static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC = const CompileTimeErrorC
ode.con1('IMPLEMENTS_DYNAMIC', 65, "Classes cannot implement 'dynamic'"); |
| 913 |
| 914 /** |
| 915 * Enum proposal: It is a compile-time error to subclass, mix-in or implement
an enum. |
| 916 */ |
| 917 static const CompileTimeErrorCode IMPLEMENTS_ENUM = const CompileTimeErrorCode
.con1('IMPLEMENTS_ENUM', 66, "Classes cannot implement an enum"); |
| 918 |
| 919 /** |
| 920 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o
f a class <i>C</i> |
| 921 * includes a type expression that does not denote a class available in the le
xical scope of |
| 922 * <i>C</i>. |
| 923 * |
| 924 * @param typeName the name of the interface that was not found |
| 925 */ |
| 926 static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = const CompileTimeErro
rCode.con1('IMPLEMENTS_NON_CLASS', 67, "Classes can only implement other classes
"); |
| 927 |
| 928 /** |
| 929 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears
more than once in |
| 930 * the implements clause of a class. |
| 931 * |
| 932 * @param className the name of the class that is implemented more than once |
| 933 */ |
| 934 static const CompileTimeErrorCode IMPLEMENTS_REPEATED = const CompileTimeError
Code.con1('IMPLEMENTS_REPEATED', 68, "'{0}' can only be implemented once"); |
| 935 |
| 936 /** |
| 937 * 7.10 Superinterfaces: It is a compile-time error if the superclass of a cla
ss <i>C</i> appears |
| 938 * in the implements clause of <i>C</i>. |
| 939 * |
| 940 * @param className the name of the class that appears in both "extends" and "
implements" clauses |
| 941 */ |
| 942 static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = const CompileTimeEr
rorCode.con1('IMPLEMENTS_SUPER_CLASS', 69, "'{0}' cannot be used in both 'extend
s' and 'implements' clauses"); |
| 943 |
| 944 /** |
| 945 * 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the
right hand side of |
| 946 * an initializer. |
| 947 * |
| 948 * 12.10 This: It is a compile-time error if this appears in a top-level funct
ion or variable |
| 949 * initializer, in a factory constructor, or in a static method or variable in
itializer, or in the |
| 950 * initializer of an instance variable. |
| 951 * |
| 952 * @param name the name of the type in question |
| 953 */ |
| 954 static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = con
st CompileTimeErrorCode.con1('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', 70, "Only
static members can be accessed in initializers"); |
| 955 |
| 956 /** |
| 957 * SDK implementation libraries can be imported only by other SDK libraries. |
| 958 * |
| 959 * @param uri the uri pointing to a library |
| 960 */ |
| 961 static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = const CompileTimeE
rrorCode.con1('IMPORT_INTERNAL_LIBRARY', 71, "The library '{0}' is internal and
cannot be imported"); |
| 962 |
| 963 /** |
| 964 * 14.1 Imports: It is a compile-time error if the specified URI of an immedia
te import does not |
| 965 * refer to a library declaration. |
| 966 * |
| 967 * @param uri the uri pointing to a non-library declaration |
| 968 * @see StaticWarningCode#IMPORT_OF_NON_LIBRARY |
| 969 */ |
| 970 static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = const CompileTimeErr
orCode.con1('IMPORT_OF_NON_LIBRARY', 72, "The imported library '{0}' must not ha
ve a part-of directive"); |
| 971 |
| 972 /** |
| 973 * 13.9 Switch: It is a compile-time error if values of the expressions <i>e<s
ub>k</sub></i> are |
| 974 * not instances of the same class <i>C</i>, for all <i>1 <= k <= n</i>. |
| 975 * |
| 976 * @param expressionSource the expression source code that is the unexpected t
ype |
| 977 * @param expectedType the name of the expected type |
| 978 */ |
| 979 static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = const C
ompileTimeErrorCode.con1('INCONSISTENT_CASE_EXPRESSION_TYPES', 73, "Case express
ions must have the same types, '{0}' is not a '{1}'"); |
| 980 |
| 981 /** |
| 982 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile-time |
| 983 * error if <i>k</i>'s initializer list contains an initializer for a variable
that is not an |
| 984 * instance variable declared in the immediately surrounding class. |
| 985 * |
| 986 * @param id the name of the initializing formal that is not an instance varia
ble in the |
| 987 * immediately enclosing class |
| 988 * @see #INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD |
| 989 */ |
| 990 static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = const C
ompileTimeErrorCode.con1('INITIALIZER_FOR_NON_EXISTANT_FIELD', 74, "'{0}' is not
a variable in the enclosing class"); |
| 991 |
| 992 /** |
| 993 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile-time |
| 994 * error if <i>k</i>'s initializer list contains an initializer for a variable
that is not an |
| 995 * instance variable declared in the immediately surrounding class. |
| 996 * |
| 997 * @param id the name of the initializing formal that is a static variable in
the immediately |
| 998 * enclosing class |
| 999 * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD |
| 1000 */ |
| 1001 static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = const Compile
TimeErrorCode.con1('INITIALIZER_FOR_STATIC_FIELD', 75, "'{0}' is a static variab
le in the enclosing class, variables initialized in a constructor cannot be stat
ic"); |
| 1002 |
| 1003 /** |
| 1004 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this.
id</i>. It is a |
| 1005 * compile-time error if <i>id</i> is not the name of an instance variable of
the immediately |
| 1006 * enclosing class. |
| 1007 * |
| 1008 * @param id the name of the initializing formal that is not an instance varia
ble in the |
| 1009 * immediately enclosing class |
| 1010 * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD |
| 1011 * @see #INITIALIZER_FOR_NON_EXISTANT_FIELD |
| 1012 */ |
| 1013 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD =
const CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD', 7
6, "'{0}' is not a variable in the enclosing class"); |
| 1014 |
| 1015 /** |
| 1016 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this.
id</i>. It is a |
| 1017 * compile-time error if <i>id</i> is not the name of an instance variable of
the immediately |
| 1018 * enclosing class. |
| 1019 * |
| 1020 * @param id the name of the initializing formal that is a static variable in
the immediately |
| 1021 * enclosing class |
| 1022 * @see #INITIALIZER_FOR_STATIC_FIELD |
| 1023 */ |
| 1024 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = const
CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_STATIC_FIELD', 77, "'{0}' is
a static field in the enclosing class, fields initialized in a constructor cann
ot be static"); |
| 1025 |
| 1026 /** |
| 1027 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property extr
action |
| 1028 * <b>this</b>.<i>id</i>. |
| 1029 */ |
| 1030 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY = const
CompileTimeErrorCode.con1('INSTANCE_MEMBER_ACCESS_FROM_FACTORY', 78, "Instance m
embers cannot be accessed from a factory constructor"); |
| 1031 |
| 1032 /** |
| 1033 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property extr
action |
| 1034 * <b>this</b>.<i>id</i>. |
| 1035 */ |
| 1036 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = const C
ompileTimeErrorCode.con1('INSTANCE_MEMBER_ACCESS_FROM_STATIC', 79, "Instance mem
bers cannot be accessed from a static method"); |
| 1037 |
| 1038 /** |
| 1039 * Enum proposal: It is also a compile-time error to explicitly instantiate an
enum via 'new' or |
| 1040 * 'const' or to access its private fields. |
| 1041 */ |
| 1042 static const CompileTimeErrorCode INSTANTIATE_ENUM = const CompileTimeErrorCod
e.con1('INSTANTIATE_ENUM', 80, "Enums cannot be instantiated"); |
| 1043 |
| 1044 /** |
| 1045 * 11 Metadata: Metadata consists of a series of annotations, each of which be
gin with the |
| 1046 * character @, followed by a constant expression that must be either a refere
nce to a |
| 1047 * compile-time constant variable, or a call to a constant constructor. |
| 1048 */ |
| 1049 static const CompileTimeErrorCode INVALID_ANNOTATION = const CompileTimeErrorC
ode.con1('INVALID_ANNOTATION', 81, "Annotation can be only constant variable or
constant constructor invocation"); |
| 1050 |
| 1051 /** |
| 1052 * 11 Metadata: Metadata consists of a series of annotations, each of which be
gin with the |
| 1053 * character @, followed by a constant expression that must be either a refere
nce to a |
| 1054 * compile-time constant variable, or a call to a constant constructor. |
| 1055 * |
| 1056 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 1057 * deferred prefix. |
| 1058 */ |
| 1059 static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY = c
onst CompileTimeErrorCode.con1('INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY', 82, "
Constant values from a deferred library cannot be used as annotations"); |
| 1060 |
| 1061 /** |
| 1062 * TODO(brianwilkerson) Remove this when we have decided on how to report erro
rs in compile-time |
| 1063 * constants. Until then, this acts as a placeholder for more informative erro
rs. |
| 1064 * |
| 1065 * See TODOs in ConstantVisitor |
| 1066 */ |
| 1067 static const CompileTimeErrorCode INVALID_CONSTANT = const CompileTimeErrorCod
e.con1('INVALID_CONSTANT', 83, "Invalid constant value"); |
| 1068 |
| 1069 /** |
| 1070 * 7.6 Constructors: It is a compile-time error if the name of a constructor i
s not a constructor |
| 1071 * name. |
| 1072 */ |
| 1073 static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = const CompileTime
ErrorCode.con1('INVALID_CONSTRUCTOR_NAME', 84, "Invalid constructor name"); |
| 1074 |
| 1075 /** |
| 1076 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of
the immediately |
| 1077 * enclosing class. |
| 1078 */ |
| 1079 static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = const Com
pileTimeErrorCode.con1('INVALID_FACTORY_NAME_NOT_A_CLASS', 85, "The name of the
immediately enclosing class expected"); |
| 1080 |
| 1081 /** |
| 1082 * 12.10 This: It is a compile-time error if this appears in a top-level funct
ion or variable |
| 1083 * initializer, in a factory constructor, or in a static method or variable in
itializer, or in the |
| 1084 * initializer of an instance variable. |
| 1085 */ |
| 1086 static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = const CompileTim
eErrorCode.con1('INVALID_REFERENCE_TO_THIS', 86, "Invalid reference to 'this' ex
pression"); |
| 1087 |
| 1088 /** |
| 1089 * 12.6 Lists: It is a compile time error if the type argument of a constant l
ist literal includes |
| 1090 * a type parameter. |
| 1091 * |
| 1092 * @name the name of the type parameter |
| 1093 */ |
| 1094 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = const
CompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 87, "Constant l
ist literals cannot include a type parameter as a type argument, such as '{0}'")
; |
| 1095 |
| 1096 /** |
| 1097 * 12.7 Maps: It is a compile time error if the type arguments of a constant m
ap literal include a |
| 1098 * type parameter. |
| 1099 * |
| 1100 * @name the name of the type parameter |
| 1101 */ |
| 1102 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = const C
ompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 88, "Constant map
literals cannot include a type parameter as a type argument, such as '{0}'"); |
| 1103 |
| 1104 /** |
| 1105 * 14.2 Exports: It is a compile-time error if the compilation unit found at t
he specified URI is |
| 1106 * not a library declaration. |
| 1107 * |
| 1108 * 14.1 Imports: It is a compile-time error if the compilation unit found at t
he specified URI is |
| 1109 * not a library declaration. |
| 1110 * |
| 1111 * 14.3 Parts: It is a compile time error if the contents of the URI are not a
valid part |
| 1112 * declaration. |
| 1113 * |
| 1114 * @param uri the URI that is invalid |
| 1115 * @see #URI_DOES_NOT_EXIST |
| 1116 */ |
| 1117 static const CompileTimeErrorCode INVALID_URI = const CompileTimeErrorCode.con
1('INVALID_URI', 89, "Invalid URI syntax: '{0}'"); |
| 1118 |
| 1119 /** |
| 1120 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su
b></i> exists within |
| 1121 * the innermost function in which <i>s<sub>b</sub></i> occurs. |
| 1122 * |
| 1123 * 13.14 Continue: It is a compile-time error if no such statement or case cla
use |
| 1124 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub
>c</sub></i> occurs. |
| 1125 * |
| 1126 * @param labelName the name of the unresolvable label |
| 1127 */ |
| 1128 static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = const CompileTimeErro
rCode.con1('LABEL_IN_OUTER_SCOPE', 90, "Cannot reference label '{0}' declared in
an outer method"); |
| 1129 |
| 1130 /** |
| 1131 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su
b></i> exists within |
| 1132 * the innermost function in which <i>s<sub>b</sub></i> occurs. |
| 1133 * |
| 1134 * 13.14 Continue: It is a compile-time error if no such statement or case cla
use |
| 1135 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub
>c</sub></i> occurs. |
| 1136 * |
| 1137 * @param labelName the name of the unresolvable label |
| 1138 */ |
| 1139 static const CompileTimeErrorCode LABEL_UNDEFINED = const CompileTimeErrorCode
.con1('LABEL_UNDEFINED', 91, "Cannot reference undefined label '{0}'"); |
| 1140 |
| 1141 /** |
| 1142 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i>
... |
| 1143 * <i>e<sub>n</sub></i>] is evaluated as follows: |
| 1144 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and
second argument |
| 1145 * <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> |
| 1146 * |
| 1147 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 1148 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 1149 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 1150 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 1151 * j <= m</i>. |
| 1152 */ |
| 1153 static const CompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const Com
pileTimeErrorCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 92, "The element type
'{0}' cannot be assigned to the list type '{1}'"); |
| 1154 |
| 1155 /** |
| 1156 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</su
b></i> : |
| 1157 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev
aluated as follows: |
| 1158 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s
ub></i> and second |
| 1159 * argument <i>e<sub>i</sub></i><i>, 1 <= i <= n</i> |
| 1160 * |
| 1161 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 1162 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 1163 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 1164 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 1165 * j <= m</i>. |
| 1166 */ |
| 1167 static const CompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const CompileT
imeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 93, "The element type '{0}' can
not be assigned to the map key type '{1}'"); |
| 1168 |
| 1169 /** |
| 1170 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</su
b></i> : |
| 1171 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev
aluated as follows: |
| 1172 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s
ub></i> and second |
| 1173 * argument <i>e<sub>i</sub></i><i>, 1 <= i <= n</i> |
| 1174 * |
| 1175 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 1176 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 1177 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 1178 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 1179 * j <= m</i>. |
| 1180 */ |
| 1181 static const CompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const Compil
eTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 94, "The element type '{0}'
cannot be assigned to the map value type '{1}'"); |
| 1182 |
| 1183 /** |
| 1184 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member
with the same name |
| 1185 * as <i>C</i>. |
| 1186 */ |
| 1187 static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = const CompileTimeEr
rorCode.con1('MEMBER_WITH_CLASS_NAME', 95, "Class members cannot have the same n
ame as the enclosing class"); |
| 1188 |
| 1189 /** |
| 1190 * 7.2 Getters: It is a compile-time error if a class has both a getter and a
method with the same |
| 1191 * name. |
| 1192 * |
| 1193 * @param name the conflicting name of the getter and method |
| 1194 */ |
| 1195 static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = const Com
pileTimeErrorCode.con1('METHOD_AND_GETTER_WITH_SAME_NAME', 96, "'{0}' cannot be
used to name a method, there is already a getter with the same name"); |
| 1196 |
| 1197 /** |
| 1198 * 12.1 Constants: A constant expression is ... a constant list literal. |
| 1199 */ |
| 1200 static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = const Compil
eTimeErrorCode.con1('MISSING_CONST_IN_LIST_LITERAL', 97, "List literals must be
prefixed with 'const' when used as a constant expression"); |
| 1201 |
| 1202 /** |
| 1203 * 12.1 Constants: A constant expression is ... a constant map literal. |
| 1204 */ |
| 1205 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = const Compile
TimeErrorCode.con1('MISSING_CONST_IN_MAP_LITERAL', 98, "Map literals must be pre
fixed with 'const' when used as a constant expression"); |
| 1206 |
| 1207 /** |
| 1208 * Enum proposal: It is a static warning if all of the following conditions ho
ld: |
| 1209 * * The switch statement does not have a 'default' clause. |
| 1210 * * The static type of <i>e</i> is an enumerated typed with elements <i>id<su
b>1</sub></i>, |
| 1211 * …, <i>id<sub>n</sub></i>. |
| 1212 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and {<i>i
d<sub>1</sub></i>, |
| 1213 * …, <i>id<sub>n</sub></i>} are not the same. |
| 1214 * |
| 1215 * @param constantName the name of the constant that is missing |
| 1216 */ |
| 1217 static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH = const Comp
ileTimeErrorCode.con2('MISSING_ENUM_CONSTANT_IN_SWITCH', 99, "Missing case claus
e for '{0}'", "Add a case clause for the missing constant or add a default claus
e."); |
| 1218 |
| 1219 /** |
| 1220 * 9 Mixins: It is a compile-time error if a declared or derived mixin explici
tly declares a |
| 1221 * constructor. |
| 1222 * |
| 1223 * @param typeName the name of the mixin that is invalid |
| 1224 */ |
| 1225 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = const CompileTi
meErrorCode.con1('MIXIN_DECLARES_CONSTRUCTOR', 100, "The class '{0}' cannot be u
sed as a mixin because it declares a constructor"); |
| 1226 |
| 1227 /** |
| 1228 * 9.1 Mixin Application: It is a compile-time error if the with clause of a m
ixin application |
| 1229 * <i>C</i> includes a deferred type expression. |
| 1230 * |
| 1231 * @param typeName the name of the type that cannot be extended |
| 1232 * @see #EXTENDS_DEFERRED_CLASS |
| 1233 * @see #IMPLEMENTS_DEFERRED_CLASS |
| 1234 */ |
| 1235 static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = const CompileTimeErro
rCode.con1('MIXIN_DEFERRED_CLASS', 101, "This class cannot mixin the deferred cl
ass '{0}'"); |
| 1236 |
| 1237 /** |
| 1238 * 9 Mixins: It is a compile-time error if a mixin is derived from a class who
se superclass is not |
| 1239 * Object. |
| 1240 * |
| 1241 * @param typeName the name of the mixin that is invalid |
| 1242 */ |
| 1243 static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = const Compi
leTimeErrorCode.con1('MIXIN_INHERITS_FROM_NOT_OBJECT', 102, "The class '{0}' can
not be used as a mixin because it extends a class other than Object"); |
| 1244 |
| 1245 /** |
| 1246 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i
mplement Null. |
| 1247 * |
| 1248 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement int. |
| 1249 * |
| 1250 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement double. |
| 1251 * |
| 1252 * 12.3 Numbers: It is a compile-time error for any type other than the types
int and double to |
| 1253 * attempt to extend or implement num. |
| 1254 * |
| 1255 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend
or implement bool. |
| 1256 * |
| 1257 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o
r implement String. |
| 1258 * |
| 1259 * @param typeName the name of the type that cannot be extended |
| 1260 * @see #IMPLEMENTS_DISALLOWED_CLASS |
| 1261 */ |
| 1262 static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = const CompileTim
eErrorCode.con1('MIXIN_OF_DISALLOWED_CLASS', 103, "Classes cannot mixin '{0}'"); |
| 1263 |
| 1264 /** |
| 1265 * Enum proposal: It is a compile-time error to subclass, mix-in or implement
an enum. |
| 1266 */ |
| 1267 static const CompileTimeErrorCode MIXIN_OF_ENUM = const CompileTimeErrorCode.c
on1('MIXIN_OF_ENUM', 104, "Classes cannot mixin an enum"); |
| 1268 |
| 1269 /** |
| 1270 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not deno
te a class or mixin |
| 1271 * available in the immediately enclosing scope. |
| 1272 */ |
| 1273 static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = const CompileTimeErrorC
ode.con1('MIXIN_OF_NON_CLASS', 105, "Classes can only mixin other classes"); |
| 1274 |
| 1275 /** |
| 1276 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers
to super. |
| 1277 */ |
| 1278 static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER = const CompileTimeEr
rorCode.con1('MIXIN_REFERENCES_SUPER', 106, "The class '{0}' cannot be used as a
mixin because it references 'super'"); |
| 1279 |
| 1280 /** |
| 1281 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not deno
te a class available |
| 1282 * in the immediately enclosing scope. |
| 1283 */ |
| 1284 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = const Comp
ileTimeErrorCode.con1('MIXIN_WITH_NON_CLASS_SUPERCLASS', 107, "Mixin can only be
applied to class"); |
| 1285 |
| 1286 /** |
| 1287 * 7.6.1 Generative Constructors: A generative constructor may be redirecting,
in which case its |
| 1288 * only action is to invoke another generative constructor. |
| 1289 */ |
| 1290 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS
= const CompileTimeErrorCode.con1('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS
', 108, "Constructor may have at most one 'this' redirection"); |
| 1291 |
| 1292 /** |
| 1293 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Th
en <i>k</i> may |
| 1294 * include at most one superinitializer in its initializer list or a compile t
ime error occurs. |
| 1295 */ |
| 1296 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = const CompileT
imeErrorCode.con1('MULTIPLE_SUPER_INITIALIZERS', 109, "Constructor may have at m
ost one 'super' initializer"); |
| 1297 |
| 1298 /** |
| 1299 * 11 Metadata: Metadata consists of a series of annotations, each of which be
gin with the |
| 1300 * character @, followed by a constant expression that must be either a refere
nce to a |
| 1301 * compile-time constant variable, or a call to a constant constructor. |
| 1302 */ |
| 1303 static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = const
CompileTimeErrorCode.con1('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', 110, "Annotatio
n creation must have arguments"); |
| 1304 |
| 1305 /** |
| 1306 * 7.6.1 Generative Constructors: If no superinitializer is provided, an impli
cit superinitializer |
| 1307 * of the form <b>super</b>() is added at the end of <i>k</i>'s initializer li
st, unless the |
| 1308 * enclosing class is class <i>Object</i>. |
| 1309 * |
| 1310 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i>
does not declare a |
| 1311 * generative constructor named <i>S</i> (respectively <i>S.id</i>) |
| 1312 */ |
| 1313 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = cons
t CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', 111, "The c
lass '{0}' does not have a default constructor"); |
| 1314 |
| 1315 /** |
| 1316 * 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it
implicitly has a |
| 1317 * default constructor C() : <b>super<b>() {}, unless <i>C</i> is class <i>Obj
ect</i>. |
| 1318 * |
| 1319 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i>
does not declare a |
| 1320 * generative constructor named <i>S</i> (respectively <i>S.id</i>) |
| 1321 */ |
| 1322 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = cons
t CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', 112, "The c
lass '{0}' does not have a default constructor"); |
| 1323 |
| 1324 /** |
| 1325 * 13.2 Expression Statements: It is a compile-time error if a non-constant ma
p literal that has |
| 1326 * no explicit type arguments appears in a place where a statement is expected
. |
| 1327 */ |
| 1328 static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = cons
t CompileTimeErrorCode.con1('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 113, "A non
-constant map literal without type arguments cannot be used as an expression sta
tement"); |
| 1329 |
| 1330 /** |
| 1331 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub
>11</sub> … |
| 1332 * label<sub>1j1</sub> case e<sub>1</sub>: s<sub>1</sub> … label<sub>n1
</sub> … |
| 1333 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</s
ub>}</i> or the form |
| 1334 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case e<sub>
1</sub>: |
| 1335 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case
e<sub>n</sub>: |
| 1336 * s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub>
k</sub></i> are not |
| 1337 * compile-time constants, for all <i>1 <= k <= n</i>. |
| 1338 */ |
| 1339 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = const Compile
TimeErrorCode.con1('NON_CONSTANT_CASE_EXPRESSION', 114, "Case expressions must b
e constant"); |
| 1340 |
| 1341 /** |
| 1342 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub
>11</sub> … |
| 1343 * label<sub>1j1</sub> case e<sub>1</sub>: s<sub>1</sub> … label<sub>n1
</sub> … |
| 1344 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</s
ub>}</i> or the form |
| 1345 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case e<sub>
1</sub>: |
| 1346 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case
e<sub>n</sub>: |
| 1347 * s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub>
k</sub></i> are not |
| 1348 * compile-time constants, for all <i>1 <= k <= n</i>. |
| 1349 * |
| 1350 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 1351 * deferred prefix. |
| 1352 */ |
| 1353 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_L
IBRARY = const CompileTimeErrorCode.con1('NON_CONSTANT_CASE_EXPRESSION_FROM_DEFE
RRED_LIBRARY', 115, "Constant values from a deferred library cannot be used as a
case expression"); |
| 1354 |
| 1355 /** |
| 1356 * 6.2.2 Optional Formals: It is a compile-time error if the default value of
an optional |
| 1357 * parameter is not a compile-time constant. |
| 1358 */ |
| 1359 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = const CompileTi
meErrorCode.con1('NON_CONSTANT_DEFAULT_VALUE', 116, "Default values of an option
al parameter must be constant"); |
| 1360 |
| 1361 /** |
| 1362 * 6.2.2 Optional Formals: It is a compile-time error if the default value of
an optional |
| 1363 * parameter is not a compile-time constant. |
| 1364 * |
| 1365 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 1366 * deferred prefix. |
| 1367 */ |
| 1368 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIB
RARY = const CompileTimeErrorCode.con1('NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED
_LIBRARY', 117, "Constant values from a deferred library cannot be used as a def
ault parameter value"); |
| 1369 |
| 1370 /** |
| 1371 * 12.6 Lists: It is a compile time error if an element of a constant list lit
eral is not a |
| 1372 * compile-time constant. |
| 1373 */ |
| 1374 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = const CompileTim
eErrorCode.con1('NON_CONSTANT_LIST_ELEMENT', 118, "'const' lists must have all c
onstant values"); |
| 1375 |
| 1376 /** |
| 1377 * 12.6 Lists: It is a compile time error if an element of a constant list lit
eral is not a |
| 1378 * compile-time constant. |
| 1379 * |
| 1380 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 1381 * deferred prefix. |
| 1382 */ |
| 1383 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBR
ARY = const CompileTimeErrorCode.con1('NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_L
IBRARY', 119, "Constant values from a deferred library cannot be used as values
in a 'const' list"); |
| 1384 |
| 1385 /** |
| 1386 * 12.7 Maps: It is a compile time error if either a key or a value of an entr
y in a constant map |
| 1387 * literal is not a compile-time constant. |
| 1388 */ |
| 1389 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = const CompileTimeErro
rCode.con1('NON_CONSTANT_MAP_KEY', 120, "The keys in a map must be constant"); |
| 1390 |
| 1391 /** |
| 1392 * 12.7 Maps: It is a compile time error if either a key or a value of an entr
y in a constant map |
| 1393 * literal is not a compile-time constant. |
| 1394 * |
| 1395 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 1396 * deferred prefix. |
| 1397 */ |
| 1398 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode.con1('NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY', 1
21, "Constant values from a deferred library cannot be used as keys in a map"); |
| 1399 |
| 1400 /** |
| 1401 * 12.7 Maps: It is a compile time error if either a key or a value of an entr
y in a constant map |
| 1402 * literal is not a compile-time constant. |
| 1403 */ |
| 1404 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = const CompileTimeEr
rorCode.con1('NON_CONSTANT_MAP_VALUE', 122, "The values in a 'const' map must be
constant"); |
| 1405 |
| 1406 /** |
| 1407 * 12.7 Maps: It is a compile time error if either a key or a value of an entr
y in a constant map |
| 1408 * literal is not a compile-time constant. |
| 1409 * |
| 1410 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 1411 * deferred prefix. |
| 1412 */ |
| 1413 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY
= const CompileTimeErrorCode.con1('NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY
', 123, "Constant values from a deferred library cannot be used as values in a '
const' map"); |
| 1414 |
| 1415 /** |
| 1416 * 11 Metadata: Metadata consists of a series of annotations, each of which be
gin with the |
| 1417 * character @, followed by a constant expression that must be either a refere
nce to a |
| 1418 * compile-time constant variable, or a call to a constant constructor. |
| 1419 * |
| 1420 * "From deferred library" case is covered by |
| 1421 * [CompileTimeErrorCode#INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY]. |
| 1422 */ |
| 1423 static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = const
CompileTimeErrorCode.con1('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', 124, "Annotatio
n creation can use only 'const' constructor"); |
| 1424 |
| 1425 /** |
| 1426 * 7.6.3 Constant Constructors: Any expression that appears within the initial
izer list of a |
| 1427 * constant constructor must be a potentially constant expression, or a compil
e-time error occurs. |
| 1428 */ |
| 1429 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = const Co
mpileTimeErrorCode.con1('NON_CONSTANT_VALUE_IN_INITIALIZER', 125, "Initializer e
xpressions in constant constructors must be constants"); |
| 1430 |
| 1431 /** |
| 1432 * 7.6.3 Constant Constructors: Any expression that appears within the initial
izer list of a |
| 1433 * constant constructor must be a potentially constant expression, or a compil
e-time error occurs. |
| 1434 * |
| 1435 * 12.1 Constants: A qualified reference to a static constant variable that is
not qualified by a |
| 1436 * deferred prefix. |
| 1437 */ |
| 1438 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFER
RED_LIBRARY = const CompileTimeErrorCode.con1('NON_CONSTANT_VALUE_IN_INITIALIZER
_FROM_DEFERRED_LIBRARY', 126, "Constant values from a deferred library cannot be
used as constant initializers"); |
| 1439 |
| 1440 /** |
| 1441 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i>
or if <i>m > n</i>. |
| 1442 * |
| 1443 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 1444 * uncaught exception being thrown. |
| 1445 * |
| 1446 * @param requiredCount the expected number of required arguments |
| 1447 * @param argumentCount the actual number of positional arguments given |
| 1448 */ |
| 1449 static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const Compil
eTimeErrorCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 127, "{0} required argument
(s) expected, but {1} found"); |
| 1450 |
| 1451 /** |
| 1452 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super
initializer appears |
| 1453 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ
e constructor. It is |
| 1454 * a compile-time error if class <i>S</i> does not declare a generative constr
uctor named <i>S</i> |
| 1455 * (respectively <i>S.id</i>) |
| 1456 */ |
| 1457 static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = const CompileTi
meErrorCode.con1('NON_GENERATIVE_CONSTRUCTOR', 128, "The generative constructor
'{0}' expected, but factory found"); |
| 1458 |
| 1459 /** |
| 1460 * 7.9 Superclasses: It is a compile-time error to specify an extends clause f
or class Object. |
| 1461 */ |
| 1462 static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = const C
ompileTimeErrorCode.con1('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 129, ""); |
| 1463 |
| 1464 /** |
| 1465 * 7.1.1 Operators: It is a compile-time error to declare an optional paramete
r in an operator. |
| 1466 */ |
| 1467 static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = const Compi
leTimeErrorCode.con1('OPTIONAL_PARAMETER_IN_OPERATOR', 130, "Optional parameters
are not allowed when defining an operator"); |
| 1468 |
| 1469 /** |
| 1470 * 14.3 Parts: It is a compile time error if the contents of the URI are not a
valid part |
| 1471 * declaration. |
| 1472 * |
| 1473 * @param uri the uri pointing to a non-library declaration |
| 1474 */ |
| 1475 static const CompileTimeErrorCode PART_OF_NON_PART = const CompileTimeErrorCod
e.con1('PART_OF_NON_PART', 131, "The included part '{0}' must have a part-of dir
ective"); |
| 1476 |
| 1477 /** |
| 1478 * 14.1 Imports: It is a compile-time error if the current library declares a
top-level member |
| 1479 * named <i>p</i>. |
| 1480 */ |
| 1481 static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = cons
t CompileTimeErrorCode.con1('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 132, "The n
ame '{0}' is already used as an import prefix and cannot be used to name a top-l
evel element"); |
| 1482 |
| 1483 /** |
| 1484 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named o
ptional parameter |
| 1485 * begins with an '_' character. |
| 1486 */ |
| 1487 static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = const CompileTi
meErrorCode.con1('PRIVATE_OPTIONAL_PARAMETER', 133, "Named optional parameters c
annot start with an underscore"); |
| 1488 |
| 1489 /** |
| 1490 * 12.1 Constants: It is a compile-time error if the value of a compile-time c
onstant expression |
| 1491 * depends on itself. |
| 1492 */ |
| 1493 static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = const Comp
ileTimeErrorCode.con1('RECURSIVE_COMPILE_TIME_CONSTANT', 134, ""); |
| 1494 |
| 1495 /** |
| 1496 * 7.6.1 Generative Constructors: A generative constructor may be redirecting,
in which case its |
| 1497 * only action is to invoke another generative constructor. |
| 1498 * |
| 1499 * TODO(scheglov) review this later, there are no explicit "it is a compile-ti
me error" in |
| 1500 * specification. But it was added to the co19 and there is same error for fac
tories. |
| 1501 * |
| 1502 * https://code.google.com/p/dart/issues/detail?id=954 |
| 1503 */ |
| 1504 static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = const Compi
leTimeErrorCode.con1('RECURSIVE_CONSTRUCTOR_REDIRECT', 135, "Cycle in redirectin
g generative constructors"); |
| 1505 |
| 1506 /** |
| 1507 * 7.6.2 Factories: It is a compile-time error if a redirecting factory constr
uctor redirects to |
| 1508 * itself, either directly or indirectly via a sequence of redirections. |
| 1509 */ |
| 1510 static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = const CompileTi
meErrorCode.con1('RECURSIVE_FACTORY_REDIRECT', 136, "Cycle in redirecting factor
y constructors"); |
| 1511 |
| 1512 /** |
| 1513 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas
s <i>C</i> is a |
| 1514 * superinterface of itself. |
| 1515 * |
| 1516 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi
nterface of itself. |
| 1517 * |
| 1518 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super
class of itself. |
| 1519 * |
| 1520 * @param className the name of the class that implements itself recursively |
| 1521 * @param strImplementsPath a string representation of the implements loop |
| 1522 */ |
| 1523 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = const Comp
ileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE', 137, "'{0}' cannot be a
superinterface of itself: {1}"); |
| 1524 |
| 1525 /** |
| 1526 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas
s <i>C</i> is a |
| 1527 * superinterface of itself. |
| 1528 * |
| 1529 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi
nterface of itself. |
| 1530 * |
| 1531 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super
class of itself. |
| 1532 * |
| 1533 * @param className the name of the class that implements itself recursively |
| 1534 */ |
| 1535 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EX
TENDS = const CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE_CA
SE_EXTENDS', 138, "'{0}' cannot extend itself"); |
| 1536 |
| 1537 /** |
| 1538 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas
s <i>C</i> is a |
| 1539 * superinterface of itself. |
| 1540 * |
| 1541 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi
nterface of itself. |
| 1542 * |
| 1543 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super
class of itself. |
| 1544 * |
| 1545 * @param className the name of the class that implements itself recursively |
| 1546 */ |
| 1547 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IM
PLEMENTS = const CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE
_CASE_IMPLEMENTS', 139, "'{0}' cannot implement itself"); |
| 1548 |
| 1549 /** |
| 1550 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas
s <i>C</i> is a |
| 1551 * superinterface of itself. |
| 1552 * |
| 1553 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi
nterface of itself. |
| 1554 * |
| 1555 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super
class of itself. |
| 1556 * |
| 1557 * @param className the name of the class that implements itself recursively |
| 1558 */ |
| 1559 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WI
TH = const CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_
WITH', 140, "'{0}' cannot use itself as a mixin"); |
| 1560 |
| 1561 /** |
| 1562 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th
e const modifier but |
| 1563 * <i>k'</i> is not a constant constructor. |
| 1564 */ |
| 1565 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = const Comp
ileTimeErrorCode.con1('REDIRECT_TO_MISSING_CONSTRUCTOR', 141, "The constructor '
{0}' could not be found in '{1}'"); |
| 1566 |
| 1567 /** |
| 1568 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th
e const modifier but |
| 1569 * <i>k'</i> is not a constant constructor. |
| 1570 */ |
| 1571 static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS = const CompileTimeErr
orCode.con1('REDIRECT_TO_NON_CLASS', 142, "The name '{0}' is not a type and cann
ot be used in a redirected constructor"); |
| 1572 |
| 1573 /** |
| 1574 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th
e const modifier but |
| 1575 * <i>k'</i> is not a constant constructor. |
| 1576 */ |
| 1577 static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = const Co
mpileTimeErrorCode.con1('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 143, "Constant fact
ory constructor cannot delegate to a non-constant constructor"); |
| 1578 |
| 1579 /** |
| 1580 * 7.6.1 Generative constructors: A generative constructor may be <i>redirecti
ng</i>, in which |
| 1581 * case its only action is to invoke another generative constructor. |
| 1582 */ |
| 1583 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR =
const CompileTimeErrorCode.con1('REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR', 1
44, "The constructor '{0}' could not be found in '{1}'"); |
| 1584 |
| 1585 /** |
| 1586 * 7.6.1 Generative constructors: A generative constructor may be <i>redirecti
ng</i>, in which |
| 1587 * case its only action is to invoke another generative constructor. |
| 1588 */ |
| 1589 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTR
UCTOR = const CompileTimeErrorCode.con1('REDIRECT_GENERATIVE_TO_NON_GENERATIVE_C
ONSTRUCTOR', 145, "Generative constructor cannot redirect to a factory construct
or"); |
| 1590 |
| 1591 /** |
| 1592 * 5 Variables: A local variable may only be referenced at a source code locat
ion that is after |
| 1593 * its initializer, if any, is complete, or a compile-time error occurs. |
| 1594 */ |
| 1595 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = const Compil
eTimeErrorCode.con1('REFERENCED_BEFORE_DECLARATION', 146, "Local variables canno
t be referenced before they are declared"); |
| 1596 |
| 1597 /** |
| 1598 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form <i>
rethrow;</i> is not |
| 1599 * enclosed within a on-catch clause. |
| 1600 */ |
| 1601 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = const CompileTimeErr
orCode.con1('RETHROW_OUTSIDE_CATCH', 147, "rethrow must be inside of a catch cla
use"); |
| 1602 |
| 1603 /** |
| 1604 * 13.12 Return: It is a compile-time error if a return statement of the form
<i>return e;</i> |
| 1605 * appears in a generative constructor. |
| 1606 */ |
| 1607 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = const Com
pileTimeErrorCode.con1('RETURN_IN_GENERATIVE_CONSTRUCTOR', 148, "Constructors ca
nnot return a value"); |
| 1608 |
| 1609 /** |
| 1610 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred imp
ort is used in |
| 1611 * another import clause. |
| 1612 */ |
| 1613 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = const CompileTimeEr
rorCode.con1('SHARED_DEFERRED_PREFIX', 149, "The prefix of a deferred import can
not be used in other import directives"); |
| 1614 |
| 1615 /** |
| 1616 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 1617 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n
+1</sub>, … |
| 1618 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a compile-time error if a supe
r method invocation |
| 1619 * occurs in a top-level function or variable initializer, in an instance vari
able initializer or |
| 1620 * initializer list, in class Object, in a factory constructor, or in a static
method or variable |
| 1621 * initializer. |
| 1622 */ |
| 1623 static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = const CompileTime
ErrorCode.con1('SUPER_IN_INVALID_CONTEXT', 150, "Invalid context for 'super' inv
ocation"); |
| 1624 |
| 1625 /** |
| 1626 * 7.6.1 Generative Constructors: A generative constructor may be redirecting,
in which case its |
| 1627 * only action is to invoke another generative constructor. |
| 1628 */ |
| 1629 static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = const Com
pileTimeErrorCode.con1('SUPER_IN_REDIRECTING_CONSTRUCTOR', 151, "The redirecting
constructor cannot have a 'super' initializer"); |
| 1630 |
| 1631 /** |
| 1632 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile-time |
| 1633 * error if a generative constructor of class Object includes a superinitializ
er. |
| 1634 */ |
| 1635 static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = const CompileT
imeErrorCode.con1('SUPER_INITIALIZER_IN_OBJECT', 152, ""); |
| 1636 |
| 1637 /** |
| 1638 * 12.11 Instance Creation: It is a static type warning if any of the type arg
uments to a |
| 1639 * constructor of a generic type <i>G</i> invoked by a new expression or a con
stant object |
| 1640 * expression are not subtypes of the bounds of the corresponding formal type
parameters of |
| 1641 * <i>G</i>. |
| 1642 * |
| 1643 * 12.11.1 New: If T is malformed a dynamic error occurs. In checked mode, if
T is mal-bounded a |
| 1644 * dynamic error occurs. |
| 1645 * |
| 1646 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time
constant would raise |
| 1647 * an exception. |
| 1648 * |
| 1649 * @param boundedTypeName the name of the type used in the instance creation t
hat should be |
| 1650 * limited by the bound as specified in the class declaration |
| 1651 * @param boundingTypeName the name of the bounding type |
| 1652 * @see StaticTypeWarningCode#TYPE_ARGUMENT_NOT_MATCHING_BOUNDS |
| 1653 */ |
| 1654 static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const Co
mpileTimeErrorCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 153, "'{0}' does no
t extend '{1}'"); |
| 1655 |
| 1656 /** |
| 1657 * 15.3.1 Typedef: Any self reference, either directly, or recursively via ano
ther typedef, is a |
| 1658 * compile time error. |
| 1659 */ |
| 1660 static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = const C
ompileTimeErrorCode.con1('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', 154, "Type alias
cannot reference itself directly or recursively via another typedef"); |
| 1661 |
| 1662 /** |
| 1663 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class access
ible in the current |
| 1664 * scope, optionally followed by type arguments. |
| 1665 */ |
| 1666 static const CompileTimeErrorCode UNDEFINED_CLASS = const CompileTimeErrorCode
.con1('UNDEFINED_CLASS', 155, "Undefined class '{0}'"); |
| 1667 |
| 1668 /** |
| 1669 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super
initializer appears |
| 1670 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ
e constructor. It is |
| 1671 * a compile-time error if class <i>S</i> does not declare a generative constr
uctor named <i>S</i> |
| 1672 * (respectively <i>S.id</i>) |
| 1673 */ |
| 1674 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = const
CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 156, "The cla
ss '{0}' does not have a generative constructor '{1}'"); |
| 1675 |
| 1676 /** |
| 1677 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super
initializer appears |
| 1678 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ
e constructor. It is |
| 1679 * a compile-time error if class <i>S</i> does not declare a generative constr
uctor named <i>S</i> |
| 1680 * (respectively <i>S.id</i>) |
| 1681 */ |
| 1682 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT
= const CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT
', 157, "The class '{0}' does not have a default generative constructor"); |
| 1683 |
| 1684 /** |
| 1685 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>,
<i>1<=i<=l</i>, |
| 1686 * must have a corresponding named parameter in the set {<i>p<sub>n+1</sub></i
> ... |
| 1687 * <i>p<sub>n+k</sub></i>} or a static warning occurs. |
| 1688 * |
| 1689 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 1690 * uncaught exception being thrown. |
| 1691 * |
| 1692 * @param name the name of the requested named parameter |
| 1693 */ |
| 1694 static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = const CompileTim
eErrorCode.con1('UNDEFINED_NAMED_PARAMETER', 158, "The named parameter '{0}' is
not defined"); |
| 1695 |
| 1696 /** |
| 1697 * 14.2 Exports: It is a compile-time error if the compilation unit found at t
he specified URI is |
| 1698 * not a library declaration. |
| 1699 * |
| 1700 * 14.1 Imports: It is a compile-time error if the compilation unit found at t
he specified URI is |
| 1701 * not a library declaration. |
| 1702 * |
| 1703 * 14.3 Parts: It is a compile time error if the contents of the URI are not a
valid part |
| 1704 * declaration. |
| 1705 * |
| 1706 * @param uri the URI pointing to a non-existent file |
| 1707 * @see #INVALID_URI |
| 1708 */ |
| 1709 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = const CompileTimeErrorC
ode.con1('URI_DOES_NOT_EXIST', 159, "Target of URI does not exist: '{0}'"); |
| 1710 |
| 1711 /** |
| 1712 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time
constant, or if |
| 1713 * <i>x</i> involves string interpolation. |
| 1714 * |
| 1715 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time co
nstant, or if |
| 1716 * <i>s</i> involves string interpolation. |
| 1717 * |
| 1718 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that d
escribes a URI is |
| 1719 * not a compile-time constant, or if <i>x</i> involves string interpolation. |
| 1720 */ |
| 1721 static const CompileTimeErrorCode URI_WITH_INTERPOLATION = const CompileTimeEr
rorCode.con1('URI_WITH_INTERPOLATION', 160, "URIs cannot use string interpolatio
n"); |
| 1722 |
| 1723 /** |
| 1724 * 7.1.1 Operators: It is a compile-time error if the arity of the user-declar
ed operator []= is |
| 1725 * not 2. It is a compile time error if the arity of a user-declared operator
with one of the |
| 1726 * names: <, >, <=, >=, ==, +, /, ~/, *, %, |, ^, &, <<, >
;>, [] is not 1. |
| 1727 * It is a compile time error if the arity of the user-declared operator - is
not 0 or 1. It is a |
| 1728 * compile time error if the arity of the user-declared operator ~ is not 0. |
| 1729 * |
| 1730 * @param operatorName the name of the declared operator |
| 1731 * @param expectedNumberOfParameters the number of parameters expected |
| 1732 * @param actualNumberOfParameters the number of parameters found in the opera
tor declaration |
| 1733 */ |
| 1734 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = co
nst CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 161, "O
perator '{0}' should declare exactly {1} parameter(s), but {2} found"); |
| 1735 |
| 1736 /** |
| 1737 * 7.1.1 Operators: It is a compile time error if the arity of the user-declar
ed operator - is not |
| 1738 * 0 or 1. |
| 1739 * |
| 1740 * @param actualNumberOfParameters the number of parameters found in the opera
tor declaration |
| 1741 */ |
| 1742 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINU
S = const CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MIN
US', 162, "Operator '-' should declare 0 or 1 parameter, but {0} found"); |
| 1743 |
| 1744 /** |
| 1745 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list
does not include |
| 1746 * exactly one required formal parameter <i>p</i>. |
| 1747 */ |
| 1748 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = cons
t CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 163, "Sette
rs should declare exactly one required parameter"); |
| 1749 |
| 1750 static const List<CompileTimeErrorCode> values = const [ |
| 1751 ACCESS_PRIVATE_ENUM_FIELD, |
| 1752 AMBIGUOUS_EXPORT, |
| 1753 ARGUMENT_DEFINITION_TEST_NON_PARAMETER, |
| 1754 BUILT_IN_IDENTIFIER_AS_TYPE, |
| 1755 BUILT_IN_IDENTIFIER_AS_TYPE_NAME, |
| 1756 BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, |
| 1757 BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME, |
| 1758 CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, |
| 1759 COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, |
| 1760 CONFLICTING_GETTER_AND_METHOD, |
| 1761 CONFLICTING_METHOD_AND_GETTER, |
| 1762 CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, |
| 1763 CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, |
| 1764 CONFLICTING_TYPE_VARIABLE_AND_CLASS, |
| 1765 CONFLICTING_TYPE_VARIABLE_AND_MEMBER, |
| 1766 CONST_CONSTRUCTOR_THROWS_EXCEPTION, |
| 1767 CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST, |
| 1768 CONST_CONSTRUCTOR_WITH_MIXIN, |
| 1769 CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, |
| 1770 CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, |
| 1771 CONST_DEFERRED_CLASS, |
| 1772 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE, |
| 1773 CONST_FORMAL_PARAMETER, |
| 1774 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, |
| 1775 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY, |
| 1776 CONST_INSTANCE_FIELD, |
| 1777 CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, |
| 1778 CONST_NOT_INITIALIZED, |
| 1779 CONST_EVAL_TYPE_BOOL, |
| 1780 CONST_EVAL_TYPE_BOOL_NUM_STRING, |
| 1781 CONST_EVAL_TYPE_INT, |
| 1782 CONST_EVAL_TYPE_NUM, |
| 1783 CONST_EVAL_THROWS_EXCEPTION, |
| 1784 CONST_EVAL_THROWS_IDBZE, |
| 1785 CONST_WITH_INVALID_TYPE_PARAMETERS, |
| 1786 CONST_WITH_NON_CONST, |
| 1787 CONST_WITH_NON_CONSTANT_ARGUMENT, |
| 1788 CONST_WITH_NON_TYPE, |
| 1789 CONST_WITH_TYPE_PARAMETERS, |
| 1790 CONST_WITH_UNDEFINED_CONSTRUCTOR, |
| 1791 CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, |
| 1792 DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, |
| 1793 DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER, |
| 1794 DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR, |
| 1795 DUPLICATE_CONSTRUCTOR_DEFAULT, |
| 1796 DUPLICATE_CONSTRUCTOR_NAME, |
| 1797 DUPLICATE_DEFINITION, |
| 1798 DUPLICATE_DEFINITION_INHERITANCE, |
| 1799 DUPLICATE_NAMED_ARGUMENT, |
| 1800 EXPORT_INTERNAL_LIBRARY, |
| 1801 EXPORT_OF_NON_LIBRARY, |
| 1802 EXTENDS_ENUM, |
| 1803 EXTENDS_NON_CLASS, |
| 1804 EXTENDS_DISALLOWED_CLASS, |
| 1805 EXTENDS_DEFERRED_CLASS, |
| 1806 EXTRA_POSITIONAL_ARGUMENTS, |
| 1807 FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, |
| 1808 FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, |
| 1809 FINAL_INITIALIZED_MULTIPLE_TIMES, |
| 1810 FIELD_INITIALIZER_FACTORY_CONSTRUCTOR, |
| 1811 FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, |
| 1812 FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, |
| 1813 GETTER_AND_METHOD_WITH_SAME_NAME, |
| 1814 IMPLEMENTS_DEFERRED_CLASS, |
| 1815 IMPLEMENTS_DISALLOWED_CLASS, |
| 1816 IMPLEMENTS_DYNAMIC, |
| 1817 IMPLEMENTS_ENUM, |
| 1818 IMPLEMENTS_NON_CLASS, |
| 1819 IMPLEMENTS_REPEATED, |
| 1820 IMPLEMENTS_SUPER_CLASS, |
| 1821 IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, |
| 1822 IMPORT_INTERNAL_LIBRARY, |
| 1823 IMPORT_OF_NON_LIBRARY, |
| 1824 INCONSISTENT_CASE_EXPRESSION_TYPES, |
| 1825 INITIALIZER_FOR_NON_EXISTANT_FIELD, |
| 1826 INITIALIZER_FOR_STATIC_FIELD, |
| 1827 INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, |
| 1828 INITIALIZING_FORMAL_FOR_STATIC_FIELD, |
| 1829 INSTANCE_MEMBER_ACCESS_FROM_FACTORY, |
| 1830 INSTANCE_MEMBER_ACCESS_FROM_STATIC, |
| 1831 INSTANTIATE_ENUM, |
| 1832 INVALID_ANNOTATION, |
| 1833 INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY, |
| 1834 INVALID_CONSTANT, |
| 1835 INVALID_CONSTRUCTOR_NAME, |
| 1836 INVALID_FACTORY_NAME_NOT_A_CLASS, |
| 1837 INVALID_REFERENCE_TO_THIS, |
| 1838 INVALID_TYPE_ARGUMENT_IN_CONST_LIST, |
| 1839 INVALID_TYPE_ARGUMENT_IN_CONST_MAP, |
| 1840 INVALID_URI, |
| 1841 LABEL_IN_OUTER_SCOPE, |
| 1842 LABEL_UNDEFINED, |
| 1843 LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, |
| 1844 MAP_KEY_TYPE_NOT_ASSIGNABLE, |
| 1845 MAP_VALUE_TYPE_NOT_ASSIGNABLE, |
| 1846 MEMBER_WITH_CLASS_NAME, |
| 1847 METHOD_AND_GETTER_WITH_SAME_NAME, |
| 1848 MISSING_CONST_IN_LIST_LITERAL, |
| 1849 MISSING_CONST_IN_MAP_LITERAL, |
| 1850 MISSING_ENUM_CONSTANT_IN_SWITCH, |
| 1851 MIXIN_DECLARES_CONSTRUCTOR, |
| 1852 MIXIN_DEFERRED_CLASS, |
| 1853 MIXIN_INHERITS_FROM_NOT_OBJECT, |
| 1854 MIXIN_OF_DISALLOWED_CLASS, |
| 1855 MIXIN_OF_ENUM, |
| 1856 MIXIN_OF_NON_CLASS, |
| 1857 MIXIN_REFERENCES_SUPER, |
| 1858 MIXIN_WITH_NON_CLASS_SUPERCLASS, |
| 1859 MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS, |
| 1860 MULTIPLE_SUPER_INITIALIZERS, |
| 1861 NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS, |
| 1862 NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT, |
| 1863 NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, |
| 1864 NON_CONST_MAP_AS_EXPRESSION_STATEMENT, |
| 1865 NON_CONSTANT_CASE_EXPRESSION, |
| 1866 NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY, |
| 1867 NON_CONSTANT_DEFAULT_VALUE, |
| 1868 NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY, |
| 1869 NON_CONSTANT_LIST_ELEMENT, |
| 1870 NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY, |
| 1871 NON_CONSTANT_MAP_KEY, |
| 1872 NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY, |
| 1873 NON_CONSTANT_MAP_VALUE, |
| 1874 NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY, |
| 1875 NON_CONSTANT_ANNOTATION_CONSTRUCTOR, |
| 1876 NON_CONSTANT_VALUE_IN_INITIALIZER, |
| 1877 NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY, |
| 1878 NOT_ENOUGH_REQUIRED_ARGUMENTS, |
| 1879 NON_GENERATIVE_CONSTRUCTOR, |
| 1880 OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, |
| 1881 OPTIONAL_PARAMETER_IN_OPERATOR, |
| 1882 PART_OF_NON_PART, |
| 1883 PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, |
| 1884 PRIVATE_OPTIONAL_PARAMETER, |
| 1885 RECURSIVE_COMPILE_TIME_CONSTANT, |
| 1886 RECURSIVE_CONSTRUCTOR_REDIRECT, |
| 1887 RECURSIVE_FACTORY_REDIRECT, |
| 1888 RECURSIVE_INTERFACE_INHERITANCE, |
| 1889 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS, |
| 1890 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS, |
| 1891 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH, |
| 1892 REDIRECT_TO_MISSING_CONSTRUCTOR, |
| 1893 REDIRECT_TO_NON_CLASS, |
| 1894 REDIRECT_TO_NON_CONST_CONSTRUCTOR, |
| 1895 REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR, |
| 1896 REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR, |
| 1897 REFERENCED_BEFORE_DECLARATION, |
| 1898 RETHROW_OUTSIDE_CATCH, |
| 1899 RETURN_IN_GENERATIVE_CONSTRUCTOR, |
| 1900 SHARED_DEFERRED_PREFIX, |
| 1901 SUPER_IN_INVALID_CONTEXT, |
| 1902 SUPER_IN_REDIRECTING_CONSTRUCTOR, |
| 1903 SUPER_INITIALIZER_IN_OBJECT, |
| 1904 TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, |
| 1905 TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
| 1906 UNDEFINED_CLASS, |
| 1907 UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, |
| 1908 UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, |
| 1909 UNDEFINED_NAMED_PARAMETER, |
| 1910 URI_DOES_NOT_EXIST, |
| 1911 URI_WITH_INTERPOLATION, |
| 1912 WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, |
| 1913 WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS, |
| 1914 WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]; |
| 1915 |
| 1916 /** |
| 1917 * The template used to create the message to be displayed for this error. |
| 1918 */ |
| 1919 final String message; |
| 1920 |
| 1921 /** |
| 1922 * The template used to create the correction to be displayed for this error,
or `null` if |
| 1923 * there is no correction information for this error. |
| 1924 */ |
| 1925 final String correction; |
| 1926 |
| 1927 /** |
| 1928 * Initialize a newly created error code to have the given message. |
| 1929 * |
| 1930 * @param message the message template used to create the message to be displa
yed for the error |
| 1931 */ |
| 1932 const CompileTimeErrorCode.con1(String name, int ordinal, String message) : th
is.con2(name, ordinal, message, null); |
| 1933 |
| 1934 /** |
| 1935 * Initialize a newly created error code to have the given message and correct
ion. |
| 1936 * |
| 1937 * @param message the template used to create the message to be displayed for
the error |
| 1938 * @param correction the template used to create the correction to be displaye
d for the error |
| 1939 */ |
| 1940 const CompileTimeErrorCode.con2(String name, int ordinal, this.message, this.c
orrection) : super(name, ordinal); |
| 1941 |
| 1942 @override |
| 1943 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity; |
| 1944 |
| 1945 @override |
| 1946 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 1947 |
| 1948 @override |
| 1949 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 1950 } |
| 1951 |
| 1952 /** |
| 1953 * The interface `ErrorCode` defines the behavior common to objects representing
error codes |
| 1954 * associated with [AnalysisError]. |
| 1955 * |
| 1956 * Generally, we want to provide messages that consist of three sentences: 1. wh
at is wrong, 2. why |
| 1957 * is it wrong, and 3. how do I fix it. However, we combine the first two in the
result of |
| 1958 * [getMessage] and the last in the result of [getCorrection]. |
| 1959 */ |
| 1960 abstract class ErrorCode { |
| 1961 /** |
| 1962 * Return the template used to create the correction to be displayed for this
error, or |
| 1963 * `null` if there is no correction information for this error. The correction
should |
| 1964 * indicate how the user can fix the error. |
| 1965 * |
| 1966 * @return the template used to create the correction to be displayed for this
error |
| 1967 */ |
| 1968 String get correction; |
| 1969 |
| 1970 /** |
| 1971 * Return the severity of this error. |
| 1972 * |
| 1973 * @return the severity of this error |
| 1974 */ |
| 1975 ErrorSeverity get errorSeverity; |
| 1976 |
| 1977 /** |
| 1978 * Return the template used to create the message to be displayed for this err
or. The message |
| 1979 * should indicate what is wrong and why it is wrong. |
| 1980 * |
| 1981 * @return the template used to create the message to be displayed for this er
ror |
| 1982 */ |
| 1983 String get message; |
| 1984 |
| 1985 /** |
| 1986 * Return the type of the error. |
| 1987 * |
| 1988 * @return the type of the error |
| 1989 */ |
| 1990 ErrorType get type; |
| 1991 |
| 1992 /** |
| 1993 * Return a unique name for this error code. |
| 1994 * |
| 1995 * @return a unique name for this error code |
| 1996 */ |
| 1997 String get uniqueName; |
| 1998 } |
| 1999 |
| 2000 /** |
| 2001 * The enumeration `ErrorProperty` defines the properties that can be associated
with an |
| 2002 * [AnalysisError]. |
| 2003 */ |
| 2004 class ErrorProperty extends Enum<ErrorProperty> { |
| 2005 /** |
| 2006 * A property whose value is an array of [ExecutableElement] that should |
| 2007 * be but are not implemented by a concrete class. |
| 2008 */ |
| 2009 static const ErrorProperty UNIMPLEMENTED_METHODS = const ErrorProperty('UNIMPL
EMENTED_METHODS', 0); |
| 2010 |
| 2011 static const List<ErrorProperty> values = const [UNIMPLEMENTED_METHODS]; |
| 2012 |
| 2013 const ErrorProperty(String name, int ordinal) : super(name, ordinal); |
| 2014 } |
| 2015 |
| 2016 /** |
| 2017 * Instances of the class `ErrorReporter` wrap an error listener with utility me
thods used to |
| 2018 * create the errors being reported. |
| 2019 */ |
| 2020 class ErrorReporter { |
| 2021 /** |
| 2022 * The error listener to which errors will be reported. |
| 2023 */ |
| 2024 final AnalysisErrorListener _errorListener; |
| 2025 |
| 2026 /** |
| 2027 * The default source to be used when reporting errors. |
| 2028 */ |
| 2029 final Source _defaultSource; |
| 2030 |
| 2031 /** |
| 2032 * The source to be used when reporting errors. |
| 2033 */ |
| 2034 Source _source; |
| 2035 |
| 2036 /** |
| 2037 * Initialize a newly created error reporter that will report errors to the gi
ven listener. |
| 2038 * |
| 2039 * @param errorListener the error listener to which errors will be reported |
| 2040 * @param defaultSource the default source to be used when reporting errors |
| 2041 */ |
| 2042 ErrorReporter(this._errorListener, this._defaultSource) { |
| 2043 if (_errorListener == null) { |
| 2044 throw new IllegalArgumentException("An error listener must be provided"); |
| 2045 } else if (_defaultSource == null) { |
| 2046 throw new IllegalArgumentException("A default source must be provided"); |
| 2047 } |
| 2048 this._source = _defaultSource; |
| 2049 } |
| 2050 |
| 2051 /** |
| 2052 * Creates an error with properties with the given error code and arguments. |
| 2053 * |
| 2054 * @param errorCode the error code of the error to be reported |
| 2055 * @param node the node specifying the location of the error |
| 2056 * @param arguments the arguments to the error, used to compose the error mess
age |
| 2057 */ |
| 2058 AnalysisErrorWithProperties newErrorWithProperties(ErrorCode errorCode, AstNod
e node, List<Object> arguments) => new AnalysisErrorWithProperties.con2(_source,
node.offset, node.length, errorCode, arguments); |
| 2059 |
| 2060 /** |
| 2061 * Report a passed error. |
| 2062 * |
| 2063 * @param error the error to report |
| 2064 */ |
| 2065 void reportError(AnalysisError error) { |
| 2066 _errorListener.onError(error); |
| 2067 } |
| 2068 |
| 2069 /** |
| 2070 * Report an error with the given error code and arguments. |
| 2071 * |
| 2072 * @param errorCode the error code of the error to be reported |
| 2073 * @param element the element which name should be used as the location of the
error |
| 2074 * @param arguments the arguments to the error, used to compose the error mess
age |
| 2075 */ |
| 2076 void reportErrorForElement(ErrorCode errorCode, Element element, List<Object>
arguments) { |
| 2077 reportErrorForOffset(errorCode, element.nameOffset, element.displayName.leng
th, arguments); |
| 2078 } |
| 2079 |
| 2080 /** |
| 2081 * Report an error with the given error code and arguments. |
| 2082 * |
| 2083 * If the arguments contain the names of two or more types, the method |
| 2084 * [reportTypeErrorForNode] should be used and the types |
| 2085 * themselves (rather than their names) should be passed as arguments. |
| 2086 * |
| 2087 * @param errorCode the error code of the error to be reported |
| 2088 * @param node the node specifying the location of the error |
| 2089 * @param arguments the arguments to the error, used to compose the error mess
age |
| 2090 */ |
| 2091 void reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> argume
nts) { |
| 2092 reportErrorForOffset(errorCode, node.offset, node.length, arguments); |
| 2093 } |
| 2094 |
| 2095 /** |
| 2096 * Report an error with the given error code and arguments. |
| 2097 * |
| 2098 * @param errorCode the error code of the error to be reported |
| 2099 * @param offset the offset of the location of the error |
| 2100 * @param length the length of the location of the error |
| 2101 * @param arguments the arguments to the error, used to compose the error mess
age |
| 2102 */ |
| 2103 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Ob
ject> arguments) { |
| 2104 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error
Code, arguments)); |
| 2105 } |
| 2106 |
| 2107 /** |
| 2108 * Report an error with the given error code and arguments. |
| 2109 * |
| 2110 * @param errorCode the error code of the error to be reported |
| 2111 * @param token the token specifying the location of the error |
| 2112 * @param arguments the arguments to the error, used to compose the error mess
age |
| 2113 */ |
| 2114 void reportErrorForToken(ErrorCode errorCode, Token token, List<Object> argume
nts) { |
| 2115 reportErrorForOffset(errorCode, token.offset, token.length, arguments); |
| 2116 } |
| 2117 |
| 2118 /** |
| 2119 * Report an error with the given error code and arguments. The arguments are
expected to contain |
| 2120 * two or more types. Convert the types into strings by using the display name
s of the types, |
| 2121 * unless there are two or more types with the same names, in which case the e
xtended display |
| 2122 * names of the types will be used in order to clarify the message. |
| 2123 * |
| 2124 * If there are not two or more types in the argument list, the method |
| 2125 * [reportErrorForNode] should be used instead. |
| 2126 * |
| 2127 * @param errorCode the error code of the error to be reported |
| 2128 * @param node the node specifying the location of the error |
| 2129 * @param arguments the arguments to the error, used to compose the error mess
age |
| 2130 */ |
| 2131 void reportTypeErrorForNode(ErrorCode errorCode, AstNode node, List<Object> ar
guments) { |
| 2132 _convertTypeNames(arguments); |
| 2133 reportErrorForOffset(errorCode, node.offset, node.length, arguments); |
| 2134 } |
| 2135 |
| 2136 /** |
| 2137 * Set the source to be used when reporting errors. Setting the source to `nul
l` will cause |
| 2138 * the default source to be used. |
| 2139 * |
| 2140 * @param source the source to be used when reporting errors |
| 2141 */ |
| 2142 void set source(Source source) { |
| 2143 this._source = source == null ? _defaultSource : source; |
| 2144 } |
| 2145 |
| 2146 /** |
| 2147 * Given an array of arguments that is expected to contain two or more types,
convert the types |
| 2148 * into strings by using the display names of the types, unless there are two
or more types with |
| 2149 * the same names, in which case the extended display names of the types will
be used in order to |
| 2150 * clarify the message. |
| 2151 * |
| 2152 * @param arguments the arguments that are to be converted |
| 2153 */ |
| 2154 void _convertTypeNames(List<Object> arguments) { |
| 2155 if (_hasEqualTypeNames(arguments)) { |
| 2156 int count = arguments.length; |
| 2157 for (int i = 0; i < count; i++) { |
| 2158 Object argument = arguments[i]; |
| 2159 if (argument is DartType) { |
| 2160 DartType type = argument; |
| 2161 Element element = type.element; |
| 2162 if (element == null) { |
| 2163 arguments[i] = type.displayName; |
| 2164 } else { |
| 2165 arguments[i] = element.getExtendedDisplayName(type.displayName); |
| 2166 } |
| 2167 } |
| 2168 } |
| 2169 } else { |
| 2170 int count = arguments.length; |
| 2171 for (int i = 0; i < count; i++) { |
| 2172 Object argument = arguments[i]; |
| 2173 if (argument is DartType) { |
| 2174 arguments[i] = argument.displayName; |
| 2175 } |
| 2176 } |
| 2177 } |
| 2178 } |
| 2179 |
| 2180 /** |
| 2181 * Return `true` if the given array of arguments contains two or more types wi
th the same |
| 2182 * display name. |
| 2183 * |
| 2184 * @param arguments the arguments being tested |
| 2185 * @return `true` if the array of arguments contains two or more types with th
e same display |
| 2186 * name |
| 2187 */ |
| 2188 bool _hasEqualTypeNames(List<Object> arguments) { |
| 2189 int count = arguments.length; |
| 2190 HashSet<String> typeNames = new HashSet<String>(); |
| 2191 for (int i = 0; i < count; i++) { |
| 2192 if (arguments[i] is DartType && !typeNames.add((arguments[i] as DartType).
displayName)) { |
| 2193 return true; |
| 2194 } |
| 2195 } |
| 2196 return false; |
| 2197 } |
| 2198 } |
| 2199 |
| 2200 /** |
| 2201 * Instances of the enumeration `ErrorSeverity` represent the severity of an [Er
rorCode] |
| 2202 * . |
| 2203 */ |
| 2204 class ErrorSeverity extends Enum<ErrorSeverity> { |
| 2205 /** |
| 2206 * The severity representing a non-error. This is never used for any error cod
e, but is useful for |
| 2207 * clients. |
| 2208 */ |
| 2209 static const ErrorSeverity NONE = const ErrorSeverity('NONE', 0, " ", "none"); |
| 2210 |
| 2211 /** |
| 2212 * The severity representing an informational level analysis issue. |
| 2213 */ |
| 2214 static const ErrorSeverity INFO = const ErrorSeverity('INFO', 1, "I", "info"); |
| 2215 |
| 2216 /** |
| 2217 * The severity representing a warning. Warnings can become errors if the `-We
rror` command |
| 2218 * line flag is specified. |
| 2219 */ |
| 2220 static const ErrorSeverity WARNING = const ErrorSeverity('WARNING', 2, "W", "w
arning"); |
| 2221 |
| 2222 /** |
| 2223 * The severity representing an error. |
| 2224 */ |
| 2225 static const ErrorSeverity ERROR = const ErrorSeverity('ERROR', 3, "E", "error
"); |
| 2226 |
| 2227 static const List<ErrorSeverity> values = const [NONE, INFO, WARNING, ERROR]; |
| 2228 |
| 2229 /** |
| 2230 * The name of the severity used when producing machine output. |
| 2231 */ |
| 2232 final String machineCode; |
| 2233 |
| 2234 /** |
| 2235 * The name of the severity used when producing readable output. |
| 2236 */ |
| 2237 final String displayName; |
| 2238 |
| 2239 /** |
| 2240 * Initialize a newly created severity with the given names. |
| 2241 * |
| 2242 * @param machineCode the name of the severity used when producing machine out
put |
| 2243 * @param displayName the name of the severity used when producing readable ou
tput |
| 2244 */ |
| 2245 const ErrorSeverity(String name, int ordinal, this.machineCode, this.displayNa
me) : super(name, ordinal); |
| 2246 |
| 2247 /** |
| 2248 * Return the severity constant that represents the greatest severity. |
| 2249 * |
| 2250 * @param severity the severity being compared against |
| 2251 * @return the most sever of this or the given severity |
| 2252 */ |
| 2253 ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal
? this : severity; |
| 2254 } |
| 2255 |
| 2256 /** |
| 2257 * Instances of the enumeration `ErrorType` represent the type of an [ErrorCode]
. |
| 2258 */ |
| 2259 class ErrorType extends Enum<ErrorType> { |
| 2260 /** |
| 2261 * Task (todo) comments in user code. |
| 2262 */ |
| 2263 static const ErrorType TODO = const ErrorType('TODO', 0, ErrorSeverity.INFO); |
| 2264 |
| 2265 /** |
| 2266 * Extra analysis run over the code to follow best practices, which are not in
the Dart Language |
| 2267 * Specification. |
| 2268 */ |
| 2269 static const ErrorType HINT = const ErrorType('HINT', 1, ErrorSeverity.INFO); |
| 2270 |
| 2271 /** |
| 2272 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported |
| 2273 * by a Dart compiler before the erroneous code is executed. |
| 2274 */ |
| 2275 static const ErrorType COMPILE_TIME_ERROR = const ErrorType('COMPILE_TIME_ERRO
R', 2, ErrorSeverity.ERROR); |
| 2276 |
| 2277 /** |
| 2278 * Suggestions made in situations where the user has deviated from recommended
pub programming |
| 2279 * practices. |
| 2280 */ |
| 2281 static const ErrorType PUB_SUGGESTION = const ErrorType('PUB_SUGGESTION', 3, E
rrorSeverity.WARNING); |
| 2282 |
| 2283 /** |
| 2284 * Static warnings are those warnings reported by the static checker. They hav
e no effect on |
| 2285 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. |
| 2286 */ |
| 2287 static const ErrorType STATIC_WARNING = const ErrorType('STATIC_WARNING', 4, E
rrorSeverity.WARNING); |
| 2288 |
| 2289 /** |
| 2290 * Many, but not all, static warnings relate to types, in which case they are
known as static type |
| 2291 * warnings. |
| 2292 */ |
| 2293 static const ErrorType STATIC_TYPE_WARNING = const ErrorType('STATIC_TYPE_WARN
ING', 5, ErrorSeverity.WARNING); |
| 2294 |
| 2295 /** |
| 2296 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. |
| 2297 */ |
| 2298 static const ErrorType SYNTACTIC_ERROR = const ErrorType('SYNTACTIC_ERROR', 6,
ErrorSeverity.ERROR); |
| 2299 |
| 2300 /** |
| 2301 * Angular specific semantic problems. |
| 2302 */ |
| 2303 static const ErrorType ANGULAR = const ErrorType('ANGULAR', 7, ErrorSeverity.I
NFO); |
| 2304 |
| 2305 /** |
| 2306 * Polymer specific semantic problems. |
| 2307 */ |
| 2308 static const ErrorType POLYMER = const ErrorType('POLYMER', 8, ErrorSeverity.I
NFO); |
| 2309 |
| 2310 static const List<ErrorType> values = const [ |
| 2311 TODO, |
| 2312 HINT, |
| 2313 COMPILE_TIME_ERROR, |
| 2314 PUB_SUGGESTION, |
| 2315 STATIC_WARNING, |
| 2316 STATIC_TYPE_WARNING, |
| 2317 SYNTACTIC_ERROR, |
| 2318 ANGULAR, |
| 2319 POLYMER]; |
| 2320 |
| 2321 /** |
| 2322 * The severity of this type of error. |
| 2323 */ |
| 2324 final ErrorSeverity severity; |
| 2325 |
| 2326 /** |
| 2327 * Initialize a newly created error type to have the given severity. |
| 2328 * |
| 2329 * @param severity the severity of this type of error |
| 2330 */ |
| 2331 const ErrorType(String name, int ordinal, this.severity) : super(name, ordinal
); |
| 2332 |
| 2333 String get displayName => name.toLowerCase().replaceAll('_', ' '); |
| 2334 } |
| 2335 |
| 2336 /** |
| 2337 * The enumeration `HintCode` defines the hints and coding recommendations for b
est practices |
| 2338 * which are not mentioned in the Dart Language Specification. |
| 2339 */ |
| 2340 class HintCode extends Enum<HintCode> implements ErrorCode { |
| 2341 /** |
| 2342 * This hint is generated anywhere where the |
| 2343 * [StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated,
if we used |
| 2344 * propagated information for the warnings. |
| 2345 * |
| 2346 * @param actualType the name of the actual argument type |
| 2347 * @param expectedType the name of the expected type |
| 2348 * @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE |
| 2349 */ |
| 2350 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode.con1('ARGU
MENT_TYPE_NOT_ASSIGNABLE', 0, "The argument type '{0}' cannot be assigned to the
parameter type '{1}'"); |
| 2351 |
| 2352 /** |
| 2353 * Dead code is code that is never reached, this can happen for instance if a
statement follows a |
| 2354 * return statement. |
| 2355 */ |
| 2356 static const HintCode DEAD_CODE = const HintCode.con1('DEAD_CODE', 1, "Dead co
de"); |
| 2357 |
| 2358 /** |
| 2359 * Dead code is code that is never reached. This case covers cases where the u
ser has catch |
| 2360 * clauses after `catch (e)` or `on Object catch (e)`. |
| 2361 */ |
| 2362 static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode.con1('D
EAD_CODE_CATCH_FOLLOWING_CATCH', 2, "Dead code, catch clauses after a 'catch (e)
' or an 'on Object catch (e)' are never reached"); |
| 2363 |
| 2364 /** |
| 2365 * Dead code is code that is never reached. This case covers cases where the u
ser has an on-catch |
| 2366 * clause such as `on A catch (e)`, where a supertype of `A` was already caugh
t. |
| 2367 * |
| 2368 * @param subtypeName name of the subtype |
| 2369 * @param supertypeName name of the supertype |
| 2370 */ |
| 2371 static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = const HintCode.con1('DEAD_C
ODE_ON_CATCH_SUBTYPE', 3, "Dead code, this on-catch block will never be executed
since '{0}' is a subtype of '{1}'"); |
| 2372 |
| 2373 /** |
| 2374 * Deprecated members should not be invoked or used. |
| 2375 * |
| 2376 * @param memberName the name of the member |
| 2377 */ |
| 2378 static const HintCode DEPRECATED_MEMBER_USE = const HintCode.con1('DEPRECATED_
MEMBER_USE', 4, "'{0}' is deprecated"); |
| 2379 |
| 2380 /** |
| 2381 * Duplicate imports. |
| 2382 */ |
| 2383 static const HintCode DUPLICATE_IMPORT = const HintCode.con1('DUPLICATE_IMPORT
', 5, "Duplicate import"); |
| 2384 |
| 2385 /** |
| 2386 * Hint to use the ~/ operator. |
| 2387 */ |
| 2388 static const HintCode DIVISION_OPTIMIZATION = const HintCode.con1('DIVISION_OP
TIMIZATION', 6, "The operator x ~/ y is more efficient than (x / y).toInt()"); |
| 2389 |
| 2390 /** |
| 2391 * Hint for the `x is double` type checks. |
| 2392 */ |
| 2393 static const HintCode IS_DOUBLE = const HintCode.con1('IS_DOUBLE', 7, "When co
mpiled to JS, this test might return true when the left hand side is an int"); |
| 2394 |
| 2395 /** |
| 2396 * Hint for the `x is int` type checks. |
| 2397 */ |
| 2398 static const HintCode IS_INT = const HintCode.con1('IS_INT', 8, "When compiled
to JS, this test might return true when the left hand side is a double"); |
| 2399 |
| 2400 /** |
| 2401 * Hint for the `x is! double` type checks. |
| 2402 */ |
| 2403 static const HintCode IS_NOT_DOUBLE = const HintCode.con1('IS_NOT_DOUBLE', 9,
"When compiled to JS, this test might return false when the left hand side is an
int"); |
| 2404 |
| 2405 /** |
| 2406 * Hint for the `x is! int` type checks. |
| 2407 */ |
| 2408 static const HintCode IS_NOT_INT = const HintCode.con1('IS_NOT_INT', 10, "When
compiled to JS, this test might return false when the left hand side is a doubl
e"); |
| 2409 |
| 2410 /** |
| 2411 * Deferred libraries shouldn't define a top level function 'loadLibrary'. |
| 2412 */ |
| 2413 static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = const HintC
ode.con1('IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION', 11, "The library '{0}' de
fines a top-level function named 'loadLibrary' which is hidden by deferring this
library"); |
| 2414 |
| 2415 /** |
| 2416 * This hint is generated anywhere where the [StaticTypeWarningCode#INVALID_AS
SIGNMENT] |
| 2417 * would have been generated, if we used propagated information for the warnin
gs. |
| 2418 * |
| 2419 * @param rhsTypeName the name of the right hand side type |
| 2420 * @param lhsTypeName the name of the left hand side type |
| 2421 * @see StaticTypeWarningCode#INVALID_ASSIGNMENT |
| 2422 */ |
| 2423 static const HintCode INVALID_ASSIGNMENT = const HintCode.con1('INVALID_ASSIGN
MENT', 12, "A value of type '{0}' cannot be assigned to a variable of type '{1}'
"); |
| 2424 |
| 2425 /** |
| 2426 * Generate a hint for methods or functions that have a return type, but do no
t have a non-void |
| 2427 * return statement on all branches. At the end of methods or functions with n
o return, Dart |
| 2428 * implicitly returns `null`, avoiding these implicit returns is considered a
best practice. |
| 2429 * |
| 2430 * @param returnType the name of the declared return type |
| 2431 */ |
| 2432 static const HintCode MISSING_RETURN = const HintCode.con2('MISSING_RETURN', 1
3, "This function declares a return type of '{0}', but does not end with a retur
n statement", "Either add a return statement or change the return type to 'void'
"); |
| 2433 |
| 2434 /** |
| 2435 * A getter with the override annotation does not override an existing getter. |
| 2436 */ |
| 2437 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode.con1(
'OVERRIDE_ON_NON_OVERRIDING_GETTER', 14, "Getter does not override an inherited
getter"); |
| 2438 |
| 2439 /** |
| 2440 * A method with the override annotation does not override an existing method. |
| 2441 */ |
| 2442 static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode.con1(
'OVERRIDE_ON_NON_OVERRIDING_METHOD', 15, "Method does not override an inherited
method"); |
| 2443 |
| 2444 /** |
| 2445 * A setter with the override annotation does not override an existing setter. |
| 2446 */ |
| 2447 static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode.con1(
'OVERRIDE_ON_NON_OVERRIDING_SETTER', 16, "Setter does not override an inherited
setter"); |
| 2448 |
| 2449 /** |
| 2450 * Hint for classes that override equals, but not hashCode. |
| 2451 * |
| 2452 * @param className the name of the current class |
| 2453 */ |
| 2454 static const HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = const HintCode.con1(
'OVERRIDE_EQUALS_BUT_NOT_HASH_CODE', 17, "The class '{0}' overrides 'operator=='
, but not 'get hashCode'"); |
| 2455 |
| 2456 /** |
| 2457 * Type checks of the type `x is! Null` should be done with `x != null`. |
| 2458 */ |
| 2459 static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode.con1('TYPE_CHECK
_IS_NOT_NULL', 18, "Tests for non-null should be done with '!= null'"); |
| 2460 |
| 2461 /** |
| 2462 * Type checks of the type `x is Null` should be done with `x == null`. |
| 2463 */ |
| 2464 static const HintCode TYPE_CHECK_IS_NULL = const HintCode.con1('TYPE_CHECK_IS_
NULL', 19, "Tests for null should be done with '== null'"); |
| 2465 |
| 2466 /** |
| 2467 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_
GETTER] or |
| 2468 * [StaticWarningCode#UNDEFINED_GETTER] would have been generated, if we used
propagated |
| 2469 * information for the warnings. |
| 2470 * |
| 2471 * @param getterName the name of the getter |
| 2472 * @param enclosingType the name of the enclosing type where the getter is bei
ng looked for |
| 2473 * @see StaticTypeWarningCode#UNDEFINED_GETTER |
| 2474 * @see StaticWarningCode#UNDEFINED_GETTER |
| 2475 */ |
| 2476 static const HintCode UNDEFINED_GETTER = const HintCode.con1('UNDEFINED_GETTER
', 20, "There is no such getter '{0}' in '{1}'"); |
| 2477 |
| 2478 /** |
| 2479 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_
METHOD] would |
| 2480 * have been generated, if we used propagated information for the warnings. |
| 2481 * |
| 2482 * @param methodName the name of the method that is undefined |
| 2483 * @param typeName the resolved type name that the method lookup is happening
on |
| 2484 * @see StaticTypeWarningCode#UNDEFINED_METHOD |
| 2485 */ |
| 2486 static const HintCode UNDEFINED_METHOD = const HintCode.con1('UNDEFINED_METHOD
', 21, "The method '{0}' is not defined for the class '{1}'"); |
| 2487 |
| 2488 /** |
| 2489 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_
OPERATOR] |
| 2490 * would have been generated, if we used propagated information for the warnin
gs. |
| 2491 * |
| 2492 * @param operator the name of the operator |
| 2493 * @param enclosingType the name of the enclosing type where the operator is b
eing looked for |
| 2494 * @see StaticTypeWarningCode#UNDEFINED_OPERATOR |
| 2495 */ |
| 2496 static const HintCode UNDEFINED_OPERATOR = const HintCode.con1('UNDEFINED_OPER
ATOR', 22, "There is no such operator '{0}' in '{1}'"); |
| 2497 |
| 2498 /** |
| 2499 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_
SETTER] or |
| 2500 * [StaticWarningCode#UNDEFINED_SETTER] would have been generated, if we used
propagated |
| 2501 * information for the warnings. |
| 2502 * |
| 2503 * @param setterName the name of the setter |
| 2504 * @param enclosingType the name of the enclosing type where the setter is bei
ng looked for |
| 2505 * @see StaticTypeWarningCode#UNDEFINED_SETTER |
| 2506 * @see StaticWarningCode#UNDEFINED_SETTER |
| 2507 */ |
| 2508 static const HintCode UNDEFINED_SETTER = const HintCode.con1('UNDEFINED_SETTER
', 23, "There is no such setter '{0}' in '{1}'"); |
| 2509 |
| 2510 /** |
| 2511 * Unnecessary cast. |
| 2512 */ |
| 2513 static const HintCode UNNECESSARY_CAST = const HintCode.con1('UNNECESSARY_CAST
', 24, "Unnecessary cast"); |
| 2514 |
| 2515 /** |
| 2516 * Unnecessary type checks, the result is always true. |
| 2517 */ |
| 2518 static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode.con1('UNNE
CESSARY_TYPE_CHECK_FALSE', 25, "Unnecessary type check, the result is always fal
se"); |
| 2519 |
| 2520 /** |
| 2521 * Unnecessary type checks, the result is always false. |
| 2522 */ |
| 2523 static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode.con1('UNNEC
ESSARY_TYPE_CHECK_TRUE', 26, "Unnecessary type check, the result is always true"
); |
| 2524 |
| 2525 /** |
| 2526 * Unused imports are imports which are never not used. |
| 2527 */ |
| 2528 static const HintCode UNUSED_IMPORT = const HintCode.con1('UNUSED_IMPORT', 27,
"Unused import"); |
| 2529 |
| 2530 /** |
| 2531 * Hint for cases where the source expects a method or function to return a no
n-void result, but |
| 2532 * the method or function signature returns void. |
| 2533 * |
| 2534 * @param name the name of the method or function that returns void |
| 2535 */ |
| 2536 static const HintCode USE_OF_VOID_RESULT = const HintCode.con1('USE_OF_VOID_RE
SULT', 28, "The result of '{0}' is being used, even though it is declared to be
'void'"); |
| 2537 |
| 2538 static const List<HintCode> values = const [ |
| 2539 ARGUMENT_TYPE_NOT_ASSIGNABLE, |
| 2540 DEAD_CODE, |
| 2541 DEAD_CODE_CATCH_FOLLOWING_CATCH, |
| 2542 DEAD_CODE_ON_CATCH_SUBTYPE, |
| 2543 DEPRECATED_MEMBER_USE, |
| 2544 DUPLICATE_IMPORT, |
| 2545 DIVISION_OPTIMIZATION, |
| 2546 IS_DOUBLE, |
| 2547 IS_INT, |
| 2548 IS_NOT_DOUBLE, |
| 2549 IS_NOT_INT, |
| 2550 IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION, |
| 2551 INVALID_ASSIGNMENT, |
| 2552 MISSING_RETURN, |
| 2553 OVERRIDE_ON_NON_OVERRIDING_GETTER, |
| 2554 OVERRIDE_ON_NON_OVERRIDING_METHOD, |
| 2555 OVERRIDE_ON_NON_OVERRIDING_SETTER, |
| 2556 OVERRIDE_EQUALS_BUT_NOT_HASH_CODE, |
| 2557 TYPE_CHECK_IS_NOT_NULL, |
| 2558 TYPE_CHECK_IS_NULL, |
| 2559 UNDEFINED_GETTER, |
| 2560 UNDEFINED_METHOD, |
| 2561 UNDEFINED_OPERATOR, |
| 2562 UNDEFINED_SETTER, |
| 2563 UNNECESSARY_CAST, |
| 2564 UNNECESSARY_TYPE_CHECK_FALSE, |
| 2565 UNNECESSARY_TYPE_CHECK_TRUE, |
| 2566 UNUSED_IMPORT, |
| 2567 USE_OF_VOID_RESULT]; |
| 2568 |
| 2569 /** |
| 2570 * The template used to create the message to be displayed for this error. |
| 2571 */ |
| 2572 final String message; |
| 2573 |
| 2574 /** |
| 2575 * The template used to create the correction to be displayed for this error,
or `null` if |
| 2576 * there is no correction information for this error. |
| 2577 */ |
| 2578 final String correction; |
| 2579 |
| 2580 /** |
| 2581 * Initialize a newly created error code to have the given message. |
| 2582 * |
| 2583 * @param message the message template used to create the message to be displa
yed for the error |
| 2584 */ |
| 2585 const HintCode.con1(String name, int ordinal, String message) : this.con2(name
, ordinal, message, null); |
| 2586 |
| 2587 /** |
| 2588 * Initialize a newly created error code to have the given message and correct
ion. |
| 2589 * |
| 2590 * @param message the template used to create the message to be displayed for
the error |
| 2591 * @param correction the template used to create the correction to be displaye
d for the error |
| 2592 */ |
| 2593 const HintCode.con2(String name, int ordinal, this.message, this.correction) :
super(name, ordinal); |
| 2594 |
| 2595 @override |
| 2596 ErrorSeverity get errorSeverity => ErrorType.HINT.severity; |
| 2597 |
| 2598 @override |
| 2599 ErrorType get type => ErrorType.HINT; |
| 2600 |
| 2601 @override |
| 2602 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 2603 } |
| 2604 |
| 2605 /** |
| 2606 * The enumeration `HtmlWarningCode` defines the error codes used for warnings i
n HTML files. |
| 2607 * The convention for this class is for the name of the error code to indicate t
he problem that |
| 2608 * caused the error to be generated and for the error message to explain what is
wrong and, when |
| 2609 * appropriate, how the problem can be corrected. |
| 2610 */ |
| 2611 class HtmlWarningCode extends Enum<HtmlWarningCode> implements ErrorCode { |
| 2612 /** |
| 2613 * An error code indicating that the value of the 'src' attribute of a Dart sc
ript tag is not a |
| 2614 * valid URI. |
| 2615 * |
| 2616 * @param uri the URI that is invalid |
| 2617 */ |
| 2618 static const HtmlWarningCode INVALID_URI = const HtmlWarningCode.con1('INVALID
_URI', 0, "Invalid URI syntax: '{0}'"); |
| 2619 |
| 2620 /** |
| 2621 * An error code indicating that the value of the 'src' attribute of a Dart sc
ript tag references |
| 2622 * a file that does not exist. |
| 2623 * |
| 2624 * @param uri the URI pointing to a non-existent file |
| 2625 */ |
| 2626 static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode.con1('
URI_DOES_NOT_EXIST', 1, "Target of URI does not exist: '{0}'"); |
| 2627 |
| 2628 static const List<HtmlWarningCode> values = const [INVALID_URI, URI_DOES_NOT_E
XIST]; |
| 2629 |
| 2630 /** |
| 2631 * The template used to create the message to be displayed for this error. |
| 2632 */ |
| 2633 final String message; |
| 2634 |
| 2635 /** |
| 2636 * The template used to create the correction to be displayed for this error,
or `null` if |
| 2637 * there is no correction information for this error. |
| 2638 */ |
| 2639 final String correction; |
| 2640 |
| 2641 /** |
| 2642 * Initialize a newly created error code to have the given message. |
| 2643 * |
| 2644 * @param message the message template used to create the message to be displa
yed for the error |
| 2645 */ |
| 2646 const HtmlWarningCode.con1(String name, int ordinal, String message) : this.co
n2(name, ordinal, message, null); |
| 2647 |
| 2648 /** |
| 2649 * Initialize a newly created error code to have the given message and correct
ion. |
| 2650 * |
| 2651 * @param message the template used to create the message to be displayed for
the error |
| 2652 * @param correction the template used to create the correction to be displaye
d for the error |
| 2653 */ |
| 2654 const HtmlWarningCode.con2(String name, int ordinal, this.message, this.correc
tion) : super(name, ordinal); |
| 2655 |
| 2656 @override |
| 2657 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; |
| 2658 |
| 2659 @override |
| 2660 ErrorType get type => ErrorType.STATIC_WARNING; |
| 2661 |
| 2662 @override |
| 2663 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 2664 } |
| 2665 |
| 2666 /** |
| 2667 * The enumeration `PolymerCode` defines Polymer specific problems. |
| 2668 */ |
| 2669 class PolymerCode extends Enum<PolymerCode> implements ErrorCode { |
| 2670 static const PolymerCode ATTRIBUTE_FIELD_NOT_PUBLISHED = const PolymerCode('AT
TRIBUTE_FIELD_NOT_PUBLISHED', 0, "Field '{0}' in '{1}' must be @published"); |
| 2671 |
| 2672 static const PolymerCode DUPLICATE_ATTRIBUTE_DEFINITION = const PolymerCode('D
UPLICATE_ATTRIBUTE_DEFINITION', 1, "The attribute '{0}' is already defined"); |
| 2673 |
| 2674 static const PolymerCode EMPTY_ATTRIBUTES = const PolymerCode('EMPTY_ATTRIBUTE
S', 2, "Empty 'attributes' attribute is useless"); |
| 2675 |
| 2676 static const PolymerCode INVALID_ATTRIBUTE_NAME = const PolymerCode('INVALID_A
TTRIBUTE_NAME', 3, "'{0}' is not a valid name for a custom element attribute"); |
| 2677 |
| 2678 static const PolymerCode INVALID_TAG_NAME = const PolymerCode('INVALID_TAG_NAM
E', 4, "'{0}' is not a valid name for a custom element"); |
| 2679 |
| 2680 static const PolymerCode MISSING_TAG_NAME = const PolymerCode('MISSING_TAG_NAM
E', 5, "Missing tag name of the custom element. Please include an attribute like
name='your-tag-name'"); |
| 2681 |
| 2682 static const PolymerCode UNDEFINED_ATTRIBUTE_FIELD = const PolymerCode('UNDEFI
NED_ATTRIBUTE_FIELD', 6, "There is no such field '{0}' in '{1}'"); |
| 2683 |
| 2684 static const List<PolymerCode> values = const [ |
| 2685 ATTRIBUTE_FIELD_NOT_PUBLISHED, |
| 2686 DUPLICATE_ATTRIBUTE_DEFINITION, |
| 2687 EMPTY_ATTRIBUTES, |
| 2688 INVALID_ATTRIBUTE_NAME, |
| 2689 INVALID_TAG_NAME, |
| 2690 MISSING_TAG_NAME, |
| 2691 UNDEFINED_ATTRIBUTE_FIELD]; |
| 2692 |
| 2693 /** |
| 2694 * The template used to create the message to be displayed for this error. |
| 2695 */ |
| 2696 final String message; |
| 2697 |
| 2698 /** |
| 2699 * Initialize a newly created error code to have the given message. |
| 2700 * |
| 2701 * @param message the message template used to create the message to be displa
yed for the error |
| 2702 */ |
| 2703 const PolymerCode(String name, int ordinal, this.message) : super(name, ordina
l); |
| 2704 |
| 2705 @override |
| 2706 String get correction => null; |
| 2707 |
| 2708 @override |
| 2709 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 2710 |
| 2711 @override |
| 2712 ErrorType get type => ErrorType.POLYMER; |
| 2713 |
| 2714 @override |
| 2715 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 2716 } |
| 2717 |
| 2718 /** |
| 2719 * The enumeration `PubSuggestionCode` defines the suggestions used for reportin
g deviations |
| 2720 * from pub best practices. The convention for this class is for the name of the
bad practice to |
| 2721 * indicate the problem that caused the suggestion to be generated and for the m
essage to explain |
| 2722 * what is wrong and, when appropriate, how the situation can be corrected. |
| 2723 */ |
| 2724 class PubSuggestionCode extends Enum<PubSuggestionCode> implements ErrorCode { |
| 2725 /** |
| 2726 * It is a bad practice for a source file in a package "lib" directory hierarc
hy to traverse |
| 2727 * outside that directory hierarchy. For example, a source file in the "lib" d
irectory should not |
| 2728 * contain a directive such as `import '../web/some.dart'` which references a
file outside |
| 2729 * the lib directory. |
| 2730 */ |
| 2731 static const PubSuggestionCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE
= const PubSuggestionCode.con1('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
0, "A file in the 'lib' directory hierarchy should not reference a file outside
that hierarchy"); |
| 2732 |
| 2733 /** |
| 2734 * It is a bad practice for a source file ouside a package "lib" directory hie
rarchy to traverse |
| 2735 * into that directory hierarchy. For example, a source file in the "web" dire
ctory should not |
| 2736 * contain a directive such as `import '../lib/some.dart'` which references a
file inside |
| 2737 * the lib directory. |
| 2738 */ |
| 2739 static const PubSuggestionCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE
= const PubSuggestionCode.con1('FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE',
1, "A file outside the 'lib' directory hierarchy should not reference a file in
side that hierarchy. Use a package: reference instead."); |
| 2740 |
| 2741 /** |
| 2742 * It is a bad practice for a package import to reference anything outside the
given package, or |
| 2743 * more generally, it is bad practice for a package import to contain a "..".
For example, a |
| 2744 * source file should not contain a directive such as `import 'package:foo/../
some.dart'`. |
| 2745 */ |
| 2746 static const PubSuggestionCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const PubSugg
estionCode.con1('PACKAGE_IMPORT_CONTAINS_DOT_DOT', 2, "A package import should n
ot contain '..'"); |
| 2747 |
| 2748 static const List<PubSuggestionCode> values = const [ |
| 2749 FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE, |
| 2750 FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE, |
| 2751 PACKAGE_IMPORT_CONTAINS_DOT_DOT]; |
| 2752 |
| 2753 /** |
| 2754 * The template used to create the message to be displayed for this error. |
| 2755 */ |
| 2756 final String message; |
| 2757 |
| 2758 /** |
| 2759 * The template used to create the correction to be displayed for this error,
or `null` if |
| 2760 * there is no correction information for this error. |
| 2761 */ |
| 2762 final String correction; |
| 2763 |
| 2764 /** |
| 2765 * Initialize a newly created error code to have the given message. |
| 2766 * |
| 2767 * @param message the message template used to create the message to be displa
yed for the error |
| 2768 */ |
| 2769 const PubSuggestionCode.con1(String name, int ordinal, String message) : this.
con2(name, ordinal, message, null); |
| 2770 |
| 2771 /** |
| 2772 * Initialize a newly created error code to have the given message and correct
ion. |
| 2773 * |
| 2774 * @param message the template used to create the message to be displayed for
the error |
| 2775 * @param correction the template used to create the correction to be displaye
d for the error |
| 2776 */ |
| 2777 const PubSuggestionCode.con2(String name, int ordinal, this.message, this.corr
ection) : super(name, ordinal); |
| 2778 |
| 2779 @override |
| 2780 ErrorSeverity get errorSeverity => ErrorType.PUB_SUGGESTION.severity; |
| 2781 |
| 2782 @override |
| 2783 ErrorType get type => ErrorType.PUB_SUGGESTION; |
| 2784 |
| 2785 @override |
| 2786 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 2787 } |
| 2788 |
| 2789 /** |
| 2790 * The enumeration `StaticTypeWarningCode` defines the error codes used for stat
ic type |
| 2791 * warnings. The convention for this class is for the name of the error code to
indicate the problem |
| 2792 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 2793 * when appropriate, how the problem can be corrected. |
| 2794 */ |
| 2795 class StaticTypeWarningCode extends Enum<StaticTypeWarningCode> implements Error
Code { |
| 2796 /** |
| 2797 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose clas
s implements the |
| 2798 * built-in class <i>List<E></i> is allocated. |
| 2799 * |
| 2800 * @param numTypeArgument the number of provided type arguments |
| 2801 */ |
| 2802 static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = const St
aticTypeWarningCode.con1('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', 0, "List literal re
quires exactly one type arguments or none, but {0} found"); |
| 2803 |
| 2804 /** |
| 2805 * 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class
implements the |
| 2806 * built-in class <i>Map<K, V></i> is allocated. |
| 2807 * |
| 2808 * @param numTypeArgument the number of provided type arguments |
| 2809 */ |
| 2810 static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = const Sta
ticTypeWarningCode.con1('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', 1, "Map literal requi
res exactly two type arguments or none, but {0} found"); |
| 2811 |
| 2812 /** |
| 2813 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
It is a static type |
| 2814 * warning if <i>T</i> does not have an accessible instance setter named <i>v=
</i>. |
| 2815 * |
| 2816 * @see #UNDEFINED_SETTER |
| 2817 */ |
| 2818 static const StaticTypeWarningCode INACCESSIBLE_SETTER = const StaticTypeWarni
ngCode.con1('INACCESSIBLE_SETTER', 2, ""); |
| 2819 |
| 2820 /** |
| 2821 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause m
ultiple members |
| 2822 * <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the same name <i>n</i> t
hat would be |
| 2823 * inherited (because identically named members existed in several superinterf
aces) then at most |
| 2824 * one member is inherited. |
| 2825 * |
| 2826 * If the static types <i>T<sub>1</sub>, …, T<sub>k</sub></i> of the me
mbers |
| 2827 * <i>m<sub>1</sub>, …, m<sub>k</sub></i> are not identical, then there
must be a member |
| 2828 * <i>m<sub>x</sub></i> such that <i>T<sub>x</sub> <: T<sub>i</sub>, 1 <
= x <= k</i> for |
| 2829 * all <i>i, 1 <= i <= k</i>, or a static type warning occurs. The membe
r that is inherited |
| 2830 * is <i>m<sub>x</sub></i>, if it exists; otherwise: |
| 2831 * * Let <i>numberOfPositionals</i>(<i>f</i>) denote the number of positional
parameters of a |
| 2832 * function <i>f</i>, and let <i>numberOfRequiredParams</i>(<i>f</i>) denote t
he number of |
| 2833 * required parameters of a function <i>f</i>. Furthermore, let <i>s</i> denot
e the set of all |
| 2834 * named parameters of the <i>m<sub>1</sub>, …, m<sub>k</sub></i>. Then
let |
| 2835 * * <i>h = max(numberOfPositionals(m<sub>i</sub>)),</i> |
| 2836 * * <i>r = min(numberOfRequiredParams(m<sub>i</sub>)), for all <i>i</i>, 1 <=
i <= k.</i> |
| 2837 * If <i>r <= h</i> then <i>I</i> has a method named <i>n</i>, with <i>r</i> r
equired parameters |
| 2838 * of type <b>dynamic</b>, <i>h</i> positional parameters of type <b>dynamic</
b>, named parameters |
| 2839 * <i>s</i> of type <b>dynamic</b> and return type <b>dynamic</b>. |
| 2840 * * Otherwise none of the members <i>m<sub>1</sub>, …, m<sub>k</sub></
i> is inherited. |
| 2841 */ |
| 2842 static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = const Sta
ticTypeWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE', 3, "'{0}' is inherite
d by at least two interfaces inconsistently, from {1}"); |
| 2843 |
| 2844 /** |
| 2845 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does n
ot have an |
| 2846 * accessible (3.2) instance member named <i>m</i>. |
| 2847 * |
| 2848 * @param memberName the name of the static member |
| 2849 * @see UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER |
| 2850 */ |
| 2851 static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = const St
aticTypeWarningCode.con1('INSTANCE_ACCESS_TO_STATIC_MEMBER', 4, "Static member '
{0}' cannot be accessed using instance access"); |
| 2852 |
| 2853 /** |
| 2854 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i
> may not be |
| 2855 * assigned to the static type of <i>v</i>. The static type of the expression
<i>v = e</i> is the |
| 2856 * static type of <i>e</i>. |
| 2857 * |
| 2858 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i
> may not be |
| 2859 * assigned to the static type of <i>C.v</i>. The static type of the expressio
n <i>C.v = e</i> is |
| 2860 * the static type of <i>e</i>. |
| 2861 * |
| 2862 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
It is a static type |
| 2863 * warning if the static type of <i>e<sub>2</sub></i> may not be assigned to <
i>T</i>. |
| 2864 * |
| 2865 * @param rhsTypeName the name of the right hand side type |
| 2866 * @param lhsTypeName the name of the left hand side type |
| 2867 */ |
| 2868 static const StaticTypeWarningCode INVALID_ASSIGNMENT = const StaticTypeWarnin
gCode.con1('INVALID_ASSIGNMENT', 5, "A value of type '{0}' cannot be assigned to
a variable of type '{1}'"); |
| 2869 |
| 2870 /** |
| 2871 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the
form |
| 2872 * <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</
sub>, … |
| 2873 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. |
| 2874 * |
| 2875 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if
<i>T</i> does not |
| 2876 * have an accessible instance member named <i>m</i>. If <i>T.m</i> exists, it
is a static warning |
| 2877 * if the type <i>F</i> of <i>T.m</i> may not be assigned to a function type.
If <i>T.m</i> does |
| 2878 * not exist, or if <i>F</i> is not a function type, the static type of <i>i</
i> is dynamic. |
| 2879 * |
| 2880 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i>
of <i>C.m</i> may |
| 2881 * not be assigned to a function type. |
| 2882 * |
| 2883 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 2884 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n
+1</sub>, … |
| 2885 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If <i>S.m</i> exists, it is a static
warning if the type |
| 2886 * <i>F</i> of <i>S.m</i> may not be assigned to a function type. |
| 2887 * |
| 2888 * @param nonFunctionIdentifier the name of the identifier that is not a funct
ion type |
| 2889 */ |
| 2890 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = const StaticTy
peWarningCode.con1('INVOCATION_OF_NON_FUNCTION', 6, "'{0}' is not a method"); |
| 2891 |
| 2892 /** |
| 2893 * 12.14.4 Function Expression Invocation: A function expression invocation <i
>i</i> has the form |
| 2894 * <i>e<sub>f</sub>(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a
<sub>n+1</sub>, |
| 2895 * …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i>
is an expression. |
| 2896 * |
| 2897 * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub>
</i> may not be |
| 2898 * assigned to a function type. |
| 2899 */ |
| 2900 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = con
st StaticTypeWarningCode.con1('INVOCATION_OF_NON_FUNCTION_EXPRESSION', 7, "Canno
t invoke a non-function"); |
| 2901 |
| 2902 /** |
| 2903 * 12.20 Conditional: It is a static type warning if the type of <i>e<sub>1</s
ub></i> may not be |
| 2904 * assigned to bool. |
| 2905 * |
| 2906 * 13.5 If: It is a static type warning if the type of the expression <i>b</i>
may not be assigned |
| 2907 * to bool. |
| 2908 * |
| 2909 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be
assigned to bool. |
| 2910 * |
| 2911 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be assi
gned to bool. |
| 2912 */ |
| 2913 static const StaticTypeWarningCode NON_BOOL_CONDITION = const StaticTypeWarnin
gCode.con1('NON_BOOL_CONDITION', 8, "Conditions must have a static type of 'bool
'"); |
| 2914 |
| 2915 /** |
| 2916 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not b
e assigned to either |
| 2917 * bool or () → bool |
| 2918 */ |
| 2919 static const StaticTypeWarningCode NON_BOOL_EXPRESSION = const StaticTypeWarni
ngCode.con1('NON_BOOL_EXPRESSION', 9, "Assertions must be on either a 'bool' or
'() -> bool'"); |
| 2920 |
| 2921 /** |
| 2922 * 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the expr
ession |
| 2923 * <i>e</i>?<b>false<b> : <b>true</b>. |
| 2924 * |
| 2925 * 12.20 Conditional: It is a static type warning if the type of <i>e<sub>1</s
ub></i> may not be |
| 2926 * assigned to bool. |
| 2927 */ |
| 2928 static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION = const Static
TypeWarningCode.con1('NON_BOOL_NEGATION_EXPRESSION', 10, "Negation argument must
have a static type of 'bool'"); |
| 2929 |
| 2930 /** |
| 2931 * 12.21 Logical Boolean Expressions: It is a static type warning if the stati
c types of both of |
| 2932 * <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> may not be assigned to bool. |
| 2933 * |
| 2934 * @param operator the lexeme of the logical operator |
| 2935 */ |
| 2936 static const StaticTypeWarningCode NON_BOOL_OPERAND = const StaticTypeWarningC
ode.con1('NON_BOOL_OPERAND', 11, "The operands of the '{0}' operator must be ass
ignable to 'bool'"); |
| 2937 |
| 2938 /** |
| 2939 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>,
1 <= i <= |
| 2940 * n</i> does not denote a type in the enclosing lexical scope. |
| 2941 */ |
| 2942 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = const StaticTyp
eWarningCode.con1('NON_TYPE_AS_TYPE_ARGUMENT', 12, "The name '{0}' is not a type
and cannot be used as a parameterized type"); |
| 2943 |
| 2944 /** |
| 2945 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not b
e assigned to the |
| 2946 * declared return type of the immediately enclosing function. |
| 2947 * |
| 2948 * @param actualReturnType the return type as declared in the return statement |
| 2949 * @param expectedReturnType the expected return type as defined by the method |
| 2950 * @param methodName the name of the method |
| 2951 */ |
| 2952 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = const StaticTypeWa
rningCode.con1('RETURN_OF_INVALID_TYPE', 13, "The return type '{0}' is not a '{1
}', as defined by the method '{2}'"); |
| 2953 |
| 2954 /** |
| 2955 * 12.11 Instance Creation: It is a static type warning if any of the type arg
uments to a |
| 2956 * constructor of a generic type <i>G</i> invoked by a new expression or a con
stant object |
| 2957 * expression are not subtypes of the bounds of the corresponding formal type
parameters of |
| 2958 * <i>G</i>. |
| 2959 * |
| 2960 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member <i>m</
i> of <i>G</i>, then |
| 2961 * the static type of the member <i>m</i> of <i>G<A<sub>1</sub>, …, |
| 2962 * A<sub>n</sub>></i> is <i>[A<sub>1</sub>, …, A<sub>n</sub>/T<sub>1
</sub>, …, |
| 2963 * T<sub>n</sub>]S</i> where <i>T<sub>1</sub>, …, T<sub>n</sub></i> are
the formal type |
| 2964 * parameters of <i>G</i>. Let <i>B<sub>i</sub></i> be the bounds of <i>T<sub>
i</sub>, 1 <= i |
| 2965 * <= n</i>. It is a static type warning if <i>A<sub>i</sub></i> is not a s
ubtype of |
| 2966 * <i>[A<sub>1</sub>, …, A<sub>n</sub>/T<sub>1</sub>, …, |
| 2967 * T<sub>n</sub>]B<sub>i</sub>, 1 <= i <= n</i>. |
| 2968 * |
| 2969 * 7.6.2 Factories: It is a static type warning if any of the type arguments t
o <i>k'</i> are not |
| 2970 * subtypes of the bounds of the corresponding formal type parameters of type. |
| 2971 * |
| 2972 * @param boundedTypeName the name of the type used in the instance creation t
hat should be |
| 2973 * limited by the bound as specified in the class declaration |
| 2974 * @param boundingTypeName the name of the bounding type |
| 2975 * @see #TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND |
| 2976 */ |
| 2977 static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const S
taticTypeWarningCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 14, "'{0}' does n
ot extend '{1}'"); |
| 2978 |
| 2979 /** |
| 2980 * 10 Generics: It is a static type warning if a type parameter is a supertype
of its upper bound. |
| 2981 * |
| 2982 * @param typeParameterName the name of the type parameter |
| 2983 * @see #TYPE_ARGUMENT_NOT_MATCHING_BOUNDS |
| 2984 */ |
| 2985 static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND = con
st StaticTypeWarningCode.con1('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND', 15, "'{0}
' cannot be a supertype of its upper bound"); |
| 2986 |
| 2987 /** |
| 2988 * 12.17 Getter Invocation: It is a static warning if there is no class <i>C</
i> in the enclosing |
| 2989 * lexical scope of <i>i</i>, or if <i>C</i> does not declare, implicitly or e
xplicitly, a getter |
| 2990 * named <i>m</i>. |
| 2991 * |
| 2992 * @param constantName the name of the enumeration constant that is not define
d |
| 2993 * @param enumName the name of the enumeration used to access the constant |
| 2994 */ |
| 2995 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = const StaticTypeW
arningCode.con1('UNDEFINED_ENUM_CONSTANT', 16, "There is no constant named '{0}'
in '{1}'"); |
| 2996 |
| 2997 /** |
| 2998 * 12.15.3 Unqualified Invocation: If there exists a lexically visible declara
tion named |
| 2999 * <i>id</i>, let <i>f<sub>id</sub></i> be the innermost such declaration. The
n: [skip]. |
| 3000 * Otherwise, <i>f<sub>id</sub></i> is considered equivalent to the ordinary m
ethod invocation |
| 3001 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, <i>x
<sub>n+1</sub></i> : |
| 3002 * <i>a<sub>n+1</sub></i>, ..., <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i
>). |
| 3003 * |
| 3004 * @param methodName the name of the method that is undefined |
| 3005 */ |
| 3006 static const StaticTypeWarningCode UNDEFINED_FUNCTION = const StaticTypeWarnin
gCode.con1('UNDEFINED_FUNCTION', 17, "The function '{0}' is not defined"); |
| 3007 |
| 3008 /** |
| 3009 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is
a static type |
| 3010 * warning if <i>T</i> does not have a getter named <i>m</i>. |
| 3011 * |
| 3012 * @param getterName the name of the getter |
| 3013 * @param enclosingType the name of the enclosing type where the getter is bei
ng looked for |
| 3014 */ |
| 3015 static const StaticTypeWarningCode UNDEFINED_GETTER = const StaticTypeWarningC
ode.con1('UNDEFINED_GETTER', 18, "There is no such getter '{0}' in '{1}'"); |
| 3016 |
| 3017 /** |
| 3018 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. I
t is a static type |
| 3019 * warning if <i>T</i> does not have an accessible instance member named <i>m<
/i>. |
| 3020 * |
| 3021 * @param methodName the name of the method that is undefined |
| 3022 * @param typeName the resolved type name that the method lookup is happening
on |
| 3023 */ |
| 3024 static const StaticTypeWarningCode UNDEFINED_METHOD = const StaticTypeWarningC
ode.con1('UNDEFINED_METHOD', 19, "The method '{0}' is not defined for the class
'{1}'"); |
| 3025 |
| 3026 /** |
| 3027 * 12.18 Assignment: Evaluation of an assignment of the form |
| 3028 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is equiva
lent to the |
| 3029 * evaluation of the expression (a, i, e){a.[]=(i, e); return e;} (<i>e<sub>1<
/sub></i>, |
| 3030 * <i>e<sub>2</sub></i>, <i>e<sub>2</sub></i>). |
| 3031 * |
| 3032 * 12.29 Assignable Expressions: An assignable expression of the form |
| 3033 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method invocat
ion of the operator |
| 3034 * method [] on <i>e<sub>1</sub></i> with argument <i>e<sub>2</sub></i>. |
| 3035 * |
| 3036 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. I
t is a static type |
| 3037 * warning if <i>T</i> does not have an accessible instance member named <i>m<
/i>. |
| 3038 * |
| 3039 * @param operator the name of the operator |
| 3040 * @param enclosingType the name of the enclosing type where the operator is b
eing looked for |
| 3041 */ |
| 3042 static const StaticTypeWarningCode UNDEFINED_OPERATOR = const StaticTypeWarnin
gCode.con1('UNDEFINED_OPERATOR', 20, "There is no such operator '{0}' in '{1}'")
; |
| 3043 |
| 3044 /** |
| 3045 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
It is a static type |
| 3046 * warning if <i>T</i> does not have an accessible instance setter named <i>v=
</i>. |
| 3047 * |
| 3048 * @param setterName the name of the setter |
| 3049 * @param enclosingType the name of the enclosing type where the setter is bei
ng looked for |
| 3050 * @see #INACCESSIBLE_SETTER |
| 3051 */ |
| 3052 static const StaticTypeWarningCode UNDEFINED_SETTER = const StaticTypeWarningC
ode.con1('UNDEFINED_SETTER', 21, "There is no such setter '{0}' in '{1}'"); |
| 3053 |
| 3054 /** |
| 3055 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 3056 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n
+1</sub>, … |
| 3057 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static type warning if <i>S<
/i> does not have an |
| 3058 * accessible instance member named <i>m</i>. |
| 3059 * |
| 3060 * @param methodName the name of the method that is undefined |
| 3061 * @param typeName the resolved type name that the method lookup is happening
on |
| 3062 */ |
| 3063 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = const StaticTypeWa
rningCode.con1('UNDEFINED_SUPER_METHOD', 22, "There is no such method '{0}' in '
{1}'"); |
| 3064 |
| 3065 /** |
| 3066 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does n
ot have an |
| 3067 * accessible (3.2) instance member named <i>m</i>. |
| 3068 * |
| 3069 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used
when we are |
| 3070 * able to find the name defined in a supertype. It exists to provide a more i
nformative error |
| 3071 * message. |
| 3072 */ |
| 3073 static const StaticTypeWarningCode UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_M
EMBER = const StaticTypeWarningCode.con1('UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STA
TIC_MEMBER', 23, "Static members from supertypes must be qualified by the name o
f the defining type"); |
| 3074 |
| 3075 /** |
| 3076 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a
generic type with |
| 3077 * exactly <i>n</i> type parameters. |
| 3078 * |
| 3079 * @param typeName the name of the type being referenced (<i>G</i>) |
| 3080 * @param parameterCount the number of type parameters that were declared |
| 3081 * @param argumentCount the number of type arguments provided |
| 3082 * @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS |
| 3083 * @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS |
| 3084 */ |
| 3085 static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = const Stat
icTypeWarningCode.con1('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 24, "The type '{0}' is
declared with {1} type parameters, but {2} type arguments were given"); |
| 3086 |
| 3087 static const List<StaticTypeWarningCode> values = const [ |
| 3088 EXPECTED_ONE_LIST_TYPE_ARGUMENTS, |
| 3089 EXPECTED_TWO_MAP_TYPE_ARGUMENTS, |
| 3090 INACCESSIBLE_SETTER, |
| 3091 INCONSISTENT_METHOD_INHERITANCE, |
| 3092 INSTANCE_ACCESS_TO_STATIC_MEMBER, |
| 3093 INVALID_ASSIGNMENT, |
| 3094 INVOCATION_OF_NON_FUNCTION, |
| 3095 INVOCATION_OF_NON_FUNCTION_EXPRESSION, |
| 3096 NON_BOOL_CONDITION, |
| 3097 NON_BOOL_EXPRESSION, |
| 3098 NON_BOOL_NEGATION_EXPRESSION, |
| 3099 NON_BOOL_OPERAND, |
| 3100 NON_TYPE_AS_TYPE_ARGUMENT, |
| 3101 RETURN_OF_INVALID_TYPE, |
| 3102 TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, |
| 3103 TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, |
| 3104 UNDEFINED_ENUM_CONSTANT, |
| 3105 UNDEFINED_FUNCTION, |
| 3106 UNDEFINED_GETTER, |
| 3107 UNDEFINED_METHOD, |
| 3108 UNDEFINED_OPERATOR, |
| 3109 UNDEFINED_SETTER, |
| 3110 UNDEFINED_SUPER_METHOD, |
| 3111 UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, |
| 3112 WRONG_NUMBER_OF_TYPE_ARGUMENTS]; |
| 3113 |
| 3114 /** |
| 3115 * The template used to create the message to be displayed for this error. |
| 3116 */ |
| 3117 final String message; |
| 3118 |
| 3119 /** |
| 3120 * The template used to create the correction to be displayed for this error,
or `null` if |
| 3121 * there is no correction information for this error. |
| 3122 */ |
| 3123 final String correction; |
| 3124 |
| 3125 /** |
| 3126 * Initialize a newly created error code to have the given message. |
| 3127 * |
| 3128 * @param message the message template used to create the message to be displa
yed for the error |
| 3129 */ |
| 3130 const StaticTypeWarningCode.con1(String name, int ordinal, String message) : t
his.con2(name, ordinal, message, null); |
| 3131 |
| 3132 /** |
| 3133 * Initialize a newly created error code to have the given message and correct
ion. |
| 3134 * |
| 3135 * @param message the template used to create the message to be displayed for
the error |
| 3136 * @param correction the template used to create the correction to be displaye
d for the error |
| 3137 */ |
| 3138 const StaticTypeWarningCode.con2(String name, int ordinal, this.message, this.
correction) : super(name, ordinal); |
| 3139 |
| 3140 @override |
| 3141 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; |
| 3142 |
| 3143 @override |
| 3144 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; |
| 3145 |
| 3146 @override |
| 3147 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 3148 } |
| 3149 |
| 3150 /** |
| 3151 * The enumeration `StaticWarningCode` defines the error codes used for static w
arnings. The |
| 3152 * convention for this class is for the name of the error code to indicate the p
roblem that caused |
| 3153 * the error to be generated and for the error message to explain what is wrong
and, when |
| 3154 * appropriate, how the problem can be corrected. |
| 3155 */ |
| 3156 class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode { |
| 3157 /** |
| 3158 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and <i
>N</i> is introduced |
| 3159 * into the top level scope <i>L</i> by more than one import then: |
| 3160 * <ol> |
| 3161 * * A static warning occurs. |
| 3162 * * If <i>N</i> is referenced as a function, getter or setter, a <i>NoSuchMet
hodError</i> is |
| 3163 * raised. |
| 3164 * * If <i>N</i> is referenced as a type, it is treated as a malformed type. |
| 3165 * </ol> |
| 3166 * |
| 3167 * @param ambiguousTypeName the name of the ambiguous type |
| 3168 * @param firstLibraryName the name of the first library that the type is foun
d |
| 3169 * @param secondLibraryName the name of the second library that the type is fo
und |
| 3170 */ |
| 3171 static const StaticWarningCode AMBIGUOUS_IMPORT = const StaticWarningCode.con1
('AMBIGUOUS_IMPORT', 0, "The name '{0}' is defined in the libraries {1}"); |
| 3172 |
| 3173 /** |
| 3174 * 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>,
1 <= i <= n+ |
| 3175 * k</i> may not be assigned to the type of the corresponding formal parameter
of the constructor |
| 3176 * <i>T.id</i> (respectively <i>T</i>). |
| 3177 * |
| 3178 * 12.11.2 Const: It is a static warning if the static type of <i>a<sub>i</sub
>, 1 <= i <= |
| 3179 * n+ k</i> may not be assigned to the type of the corresponding formal parame
ter of the |
| 3180 * constructor <i>T.id</i> (respectively <i>T</i>). |
| 3181 * |
| 3182 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 3183 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 3184 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 3185 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 3186 * j <= m</i>. |
| 3187 * |
| 3188 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub>, 1 &
lt;= i <= l</i>, |
| 3189 * must have a corresponding named parameter in the set <i>{p<sub>n+1</sub>, &
hellip; |
| 3190 * p<sub>n+k</sub>}</i> or a static warning occurs. It is a static warning if |
| 3191 * <i>T<sub>m+j</sub></i> may not be assigned to <i>S<sub>r</sub></i>, where <
i>r = q<sub>j</sub>, |
| 3192 * 1 <= j <= l</i>. |
| 3193 * |
| 3194 * @param actualType the name of the actual argument type |
| 3195 * @param expectedType the name of the expected type |
| 3196 */ |
| 3197 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const StaticWarn
ingCode.con1('ARGUMENT_TYPE_NOT_ASSIGNABLE', 1, "The argument type '{0}' cannot
be assigned to the parameter type '{1}'"); |
| 3198 |
| 3199 /** |
| 3200 * 5 Variables: Attempting to assign to a final variable elsewhere will cause
a NoSuchMethodError |
| 3201 * to be thrown, because no setter is defined for it. The assignment will also
give rise to a |
| 3202 * static warning for the same reason. |
| 3203 * |
| 3204 * A constant variable is always implicitly final. |
| 3205 */ |
| 3206 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode.c
on1('ASSIGNMENT_TO_CONST', 2, "Constant variables cannot be assigned a value"); |
| 3207 |
| 3208 /** |
| 3209 * 5 Variables: Attempting to assign to a final variable elsewhere will cause
a NoSuchMethodError |
| 3210 * to be thrown, because no setter is defined for it. The assignment will also
give rise to a |
| 3211 * static warning for the same reason. |
| 3212 */ |
| 3213 static const StaticWarningCode ASSIGNMENT_TO_FINAL = const StaticWarningCode.c
on1('ASSIGNMENT_TO_FINAL', 3, "'{0}' cannot be used as a setter, it is final"); |
| 3214 |
| 3215 /** |
| 3216 * 5 Variables: Attempting to assign to a final variable elsewhere will cause
a NoSuchMethodError |
| 3217 * to be thrown, because no setter is defined for it. The assignment will also
give rise to a |
| 3218 * static warning for the same reason. |
| 3219 */ |
| 3220 static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER = const StaticWar
ningCode.con1('ASSIGNMENT_TO_FINAL_NO_SETTER', 4, "No setter named '{0}' in clas
s '{1}'"); |
| 3221 |
| 3222 /** |
| 3223 * 12.18 Assignment: It is as static warning if an assignment of the form <i>v
= e</i> occurs |
| 3224 * inside a top level or static function (be it function, method, getter, or s
etter) or variable |
| 3225 * initializer and there is neither a local variable declaration with name <i>
v</i> nor setter |
| 3226 * declaration with name <i>v=</i> in the lexical scope enclosing the assignme
nt. |
| 3227 */ |
| 3228 static const StaticWarningCode ASSIGNMENT_TO_FUNCTION = const StaticWarningCod
e.con1('ASSIGNMENT_TO_FUNCTION', 5, "Functions cannot be assigned a value"); |
| 3229 |
| 3230 /** |
| 3231 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
It is a static type |
| 3232 * warning if <i>T</i> does not have an accessible instance setter named <i>v=
</i>. |
| 3233 */ |
| 3234 static const StaticWarningCode ASSIGNMENT_TO_METHOD = const StaticWarningCode.
con1('ASSIGNMENT_TO_METHOD', 6, "Methods cannot be assigned a value"); |
| 3235 |
| 3236 /** |
| 3237 * 13.9 Switch: It is a static warning if the last statement of the statement
sequence |
| 3238 * <i>s<sub>k</sub></i> is not a break, continue, return or throw statement. |
| 3239 */ |
| 3240 static const StaticWarningCode CASE_BLOCK_NOT_TERMINATED = const StaticWarning
Code.con1('CASE_BLOCK_NOT_TERMINATED', 7, "The last statement of the 'case' shou
ld be 'break', 'continue', 'return' or 'throw'"); |
| 3241 |
| 3242 /** |
| 3243 * 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type
available in the |
| 3244 * current lexical scope. |
| 3245 */ |
| 3246 static const StaticWarningCode CAST_TO_NON_TYPE = const StaticWarningCode.con1
('CAST_TO_NON_TYPE', 8, "The name '{0}' is not a type and cannot be used in an '
as' expression"); |
| 3247 |
| 3248 /** |
| 3249 * 7.4 Abstract Instance Members: It is a static warning if an abstract member
is declared or |
| 3250 * inherited in a concrete class. |
| 3251 */ |
| 3252 static const StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = const Sta
ticWarningCode.con1('CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', 9, "'{0}' must have a
method body because '{1}' is not abstract"); |
| 3253 |
| 3254 /** |
| 3255 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and <i
>N</i> would be |
| 3256 * introduced into the top level scope of <i>L</i> by an import from a library
whose URI begins |
| 3257 * with <i>dart:</i> and an import from a library whose URI does not begin wit
h <i>dart:</i>: |
| 3258 * * The import from <i>dart:</i> is implicitly extended by a hide N clause. |
| 3259 * * A static warning is issued. |
| 3260 * |
| 3261 * @param ambiguousName the ambiguous name |
| 3262 * @param sdkLibraryName the name of the dart: library that the element is fou
nd |
| 3263 * @param otherLibraryName the name of the non-dart: library that the element
is found |
| 3264 */ |
| 3265 static const StaticWarningCode CONFLICTING_DART_IMPORT = const StaticWarningCo
de.con1('CONFLICTING_DART_IMPORT', 10, "Element '{0}' from SDK library '{1}' is
implicitly hidden by '{2}'"); |
| 3266 |
| 3267 /** |
| 3268 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an instanc
e getter named |
| 3269 * <i>v</i> and an accessible static member named <i>v</i> or <i>v=</i> is dec
lared in a |
| 3270 * superclass of <i>C</i>. |
| 3271 * |
| 3272 * @param superName the name of the super class declaring a static member |
| 3273 */ |
| 3274 static const StaticWarningCode CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMB
ER = const StaticWarningCode.con1('CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_ME
MBER', 11, "Superclass '{0}' declares static member with the same name"); |
| 3275 |
| 3276 /** |
| 3277 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares a
n instance method |
| 3278 * named <i>n</i> and has a setter named <i>n=</i>. |
| 3279 */ |
| 3280 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER = const Stat
icWarningCode.con1('CONFLICTING_INSTANCE_METHOD_SETTER', 12, "Class '{0}' declar
es instance method '{1}', but also has a setter with the same name from '{2}'"); |
| 3281 |
| 3282 /** |
| 3283 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares a
n instance method |
| 3284 * named <i>n</i> and has a setter named <i>n=</i>. |
| 3285 */ |
| 3286 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 = const Sta
ticWarningCode.con1('CONFLICTING_INSTANCE_METHOD_SETTER2', 13, "Class '{0}' decl
ares the setter '{1}', but also has an instance method in the same class"); |
| 3287 |
| 3288 /** |
| 3289 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an instanc
e setter named |
| 3290 * <i>v=</i> and an accessible static member named <i>v=</i> or <i>v</i> is de
clared in a |
| 3291 * superclass of <i>C</i>. |
| 3292 * |
| 3293 * @param superName the name of the super class declaring a static member |
| 3294 */ |
| 3295 static const StaticWarningCode CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMB
ER = const StaticWarningCode.con1('CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_ME
MBER', 14, "Superclass '{0}' declares static member with the same name"); |
| 3296 |
| 3297 /** |
| 3298 * 7.2 Getters: It is a static warning if a class declares a static getter nam
ed <i>v</i> and also |
| 3299 * has a non-static setter named <i>v=</i>. |
| 3300 */ |
| 3301 static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER =
const StaticWarningCode.con1('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', 1
5, "Class '{0}' declares non-static setter with the same name"); |
| 3302 |
| 3303 /** |
| 3304 * 7.3 Setters: It is a static warning if a class declares a static setter nam
ed <i>v=</i> and |
| 3305 * also has a non-static member named <i>v</i>. |
| 3306 */ |
| 3307 static const StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER =
const StaticWarningCode.con1('CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER', 1
6, "Class '{0}' declares non-static member with the same name"); |
| 3308 |
| 3309 /** |
| 3310 * 12.11.2 Const: Given an instance creation expression of the form <i>const q
(a<sub>1</sub>, |
| 3311 * … a<sub>n</sub>)</i> it is a static warning if <i>q</i> is the const
ructor of an |
| 3312 * abstract class but <i>q</i> is not a factory constructor. |
| 3313 */ |
| 3314 static const StaticWarningCode CONST_WITH_ABSTRACT_CLASS = const StaticWarning
Code.con1('CONST_WITH_ABSTRACT_CLASS', 17, "Abstract classes cannot be created w
ith a 'const' expression"); |
| 3315 |
| 3316 /** |
| 3317 * 12.7 Maps: It is a static warning if the values of any two keys in a map li
teral are equal. |
| 3318 */ |
| 3319 static const StaticWarningCode EQUAL_KEYS_IN_MAP = const StaticWarningCode.con
1('EQUAL_KEYS_IN_MAP', 18, "Keys in a map cannot be equal"); |
| 3320 |
| 3321 /** |
| 3322 * 14.2 Exports: It is a static warning to export two different libraries with
the same name. |
| 3323 * |
| 3324 * @param uri1 the uri pointing to a first library |
| 3325 * @param uri2 the uri pointing to a second library |
| 3326 * @param name the shared name of the exported libraries |
| 3327 */ |
| 3328 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAME = const StaticWa
rningCode.con1('EXPORT_DUPLICATED_LIBRARY_NAME', 19, "The exported libraries '{0
}' and '{1}' should not have the same name '{2}'"); |
| 3329 |
| 3330 /** |
| 3331 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</
i> or if <i>m > |
| 3332 * n</i>. |
| 3333 * |
| 3334 * @param requiredCount the maximum number of positional arguments |
| 3335 * @param argumentCount the actual number of positional arguments given |
| 3336 * @see #NOT_ENOUGH_REQUIRED_ARGUMENTS |
| 3337 */ |
| 3338 static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = const StaticWarnin
gCode.con1('EXTRA_POSITIONAL_ARGUMENTS', 20, "{0} positional arguments expected,
but {1} found"); |
| 3339 |
| 3340 /** |
| 3341 * 5. Variables: It is a static warning if a final instance variable that has
been initialized at |
| 3342 * its point of declaration is also initialized in a constructor. |
| 3343 */ |
| 3344 static const StaticWarningCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATIO
N = const StaticWarningCode.con1('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATI
ON', 21, "Values cannot be set in the constructor if they are final, and have al
ready been set"); |
| 3345 |
| 3346 /** |
| 3347 * 5. Variables: It is a static warning if a final instance variable that has
been initialized at |
| 3348 * its point of declaration is also initialized in a constructor. |
| 3349 * |
| 3350 * @param name the name of the field in question |
| 3351 */ |
| 3352 static const StaticWarningCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTO
R = const StaticWarningCode.con1('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCT
OR', 22, "'{0}' is final and was given a value when it was declared, so it canno
t be set to a new value"); |
| 3353 |
| 3354 /** |
| 3355 * 7.6.1 Generative Constructors: Execution of an initializer of the form <b>t
his</b>.<i>v</i> = |
| 3356 * <i>e</i> proceeds as follows: First, the expression <i>e</i> is evaluated t
o an object |
| 3357 * <i>o</i>. Then, the instance variable <i>v</i> of the object denoted by thi
s is bound to |
| 3358 * <i>o</i>. |
| 3359 * |
| 3360 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 3361 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 3362 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 3363 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 3364 * j <= m</i>. |
| 3365 * |
| 3366 * @param initializerType the name of the type of the initializer expression |
| 3367 * @param fieldType the name of the type of the field |
| 3368 */ |
| 3369 static const StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE = const Static
WarningCode.con1('FIELD_INITIALIZER_NOT_ASSIGNABLE', 23, "The initializer type '
{0}' cannot be assigned to the field type '{1}'"); |
| 3370 |
| 3371 /** |
| 3372 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this.
id</i>. It is a |
| 3373 * static warning if the static type of <i>id</i> is not assignable to <i>T<su
b>id</sub></i>. |
| 3374 * |
| 3375 * @param parameterType the name of the type of the field formal parameter |
| 3376 * @param fieldType the name of the type of the field |
| 3377 */ |
| 3378 static const StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = cons
t StaticWarningCode.con1('FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', 24, "The pa
rameter type '{0}' is incompatable with the field type '{1}'"); |
| 3379 |
| 3380 /** |
| 3381 * 5 Variables: It is a static warning if a library, static or local variable
<i>v</i> is final |
| 3382 * and <i>v</i> is not initialized at its point of declaration. |
| 3383 * |
| 3384 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> declar
ed in the |
| 3385 * immediately enclosing class must have an initializer in <i>k</i>'s initiali
zer list unless it |
| 3386 * has already been initialized by one of the following means: |
| 3387 * * Initialization at the declaration of <i>f</i>. |
| 3388 * * Initialization by means of an initializing formal of <i>k</i>. |
| 3389 * or a static warning occurs. |
| 3390 * |
| 3391 * @param name the name of the uninitialized final variable |
| 3392 */ |
| 3393 static const StaticWarningCode FINAL_NOT_INITIALIZED = const StaticWarningCode
.con1('FINAL_NOT_INITIALIZED', 25, "The final variable '{0}' must be initialized
"); |
| 3394 |
| 3395 /** |
| 3396 * 15.5 Function Types: It is a static warning if a concrete class implements
Function and does |
| 3397 * not have a concrete method named call(). |
| 3398 */ |
| 3399 static const StaticWarningCode FUNCTION_WITHOUT_CALL = const StaticWarningCode
.con1('FUNCTION_WITHOUT_CALL', 26, "Concrete classes that implement Function mus
t implement the method call()"); |
| 3400 |
| 3401 /** |
| 3402 * 14.1 Imports: It is a static warning to import two different libraries with
the same name. |
| 3403 * |
| 3404 * @param uri1 the uri pointing to a first library |
| 3405 * @param uri2 the uri pointing to a second library |
| 3406 * @param name the shared name of the imported libraries |
| 3407 */ |
| 3408 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAME = const StaticWa
rningCode.con1('IMPORT_DUPLICATED_LIBRARY_NAME', 27, "The imported libraries '{0
}' and '{1}' should not have the same name '{2}'"); |
| 3409 |
| 3410 /** |
| 3411 * 14.1 Imports: It is a static warning if the specified URI of a deferred imp
ort does not refer |
| 3412 * to a library declaration. |
| 3413 * |
| 3414 * @param uri the uri pointing to a non-library declaration |
| 3415 * @see CompileTimeErrorCode#IMPORT_OF_NON_LIBRARY |
| 3416 */ |
| 3417 static const StaticWarningCode IMPORT_OF_NON_LIBRARY = const StaticWarningCode
.con1('IMPORT_OF_NON_LIBRARY', 28, "The imported library '{0}' must not have a p
art-of directive"); |
| 3418 |
| 3419 /** |
| 3420 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause m
ultiple members |
| 3421 * <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the same name <i>n</i> t
hat would be |
| 3422 * inherited (because identically named members existed in several superinterf
aces) then at most |
| 3423 * one member is inherited. |
| 3424 * |
| 3425 * If some but not all of the <i>m<sub>i</sub>, 1 <= i <= k</i> are gett
ers none of the |
| 3426 * <i>m<sub>i</sub></i> are inherited, and a static warning is issued. |
| 3427 */ |
| 3428 static const StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METH
OD = const StaticWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_ME
THOD', 29, "'{0}' is inherited as a getter and also a method"); |
| 3429 |
| 3430 /** |
| 3431 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares a
n instance method |
| 3432 * named <i>n</i> and an accessible static member named <i>n</i> is declared i
n a superclass of |
| 3433 * <i>C</i>. |
| 3434 * |
| 3435 * @param memberName the name of the member with the name conflict |
| 3436 * @param superclassName the name of the enclosing class that has the static m
ember |
| 3437 */ |
| 3438 static const StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S
TATIC = const StaticWarningCode.con1('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCL
ASS_STATIC', 30, "'{0}' collides with a static member in the superclass '{1}'"); |
| 3439 |
| 3440 /** |
| 3441 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a gette
r <i>m2</i> and the |
| 3442 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>. |
| 3443 * |
| 3444 * @param actualReturnTypeName the name of the expected return type |
| 3445 * @param expectedReturnType the name of the actual return type, not assignabl
e to the |
| 3446 * actualReturnTypeName |
| 3447 * @param className the name of the class where the overridden getter is decla
red |
| 3448 * @see #INVALID_METHOD_OVERRIDE_RETURN_TYPE |
| 3449 */ |
| 3450 static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = const Sta
ticWarningCode.con1('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 31, "The return type
'{0}' is not assignable to '{1}' as required by the getter it is overriding from
'{2}'"); |
| 3451 |
| 3452 /** |
| 3453 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3454 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the
type of <i>m2</i>. |
| 3455 * |
| 3456 * @param actualParamTypeName the name of the expected parameter type |
| 3457 * @param expectedParamType the name of the actual parameter type, not assigna
ble to the |
| 3458 * actualParamTypeName |
| 3459 * @param className the name of the class where the overridden method is decla
red |
| 3460 */ |
| 3461 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = cons
t StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 32, "The pa
rameter type '{0}' is not assignable to '{1}' as required by the method it is ov
erriding from '{2}'"); |
| 3462 |
| 3463 /** |
| 3464 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3465 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the
type of <i>m2</i>. |
| 3466 * |
| 3467 * @param actualParamTypeName the name of the expected parameter type |
| 3468 * @param expectedParamType the name of the actual parameter type, not assigna
ble to the |
| 3469 * actualParamTypeName |
| 3470 * @param className the name of the class where the overridden method is decla
red |
| 3471 * @see #INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE |
| 3472 */ |
| 3473 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = con
st StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 33, "The
parameter type '{0}' is not assignable to '{1}' as required by the method it is
overriding from '{2}'"); |
| 3474 |
| 3475 /** |
| 3476 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3477 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the
type of <i>m2</i>. |
| 3478 * |
| 3479 * @param actualParamTypeName the name of the expected parameter type |
| 3480 * @param expectedParamType the name of the actual parameter type, not assigna
ble to the |
| 3481 * actualParamTypeName |
| 3482 * @param className the name of the class where the overridden method is decla
red |
| 3483 */ |
| 3484 static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = c
onst StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 34, "
The parameter type '{0}' is not assignable to '{1}' as required by the method it
is overriding from '{2}'"); |
| 3485 |
| 3486 /** |
| 3487 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3488 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the
type of <i>m2</i>. |
| 3489 * |
| 3490 * @param actualReturnTypeName the name of the expected return type |
| 3491 * @param expectedReturnType the name of the actual return type, not assignabl
e to the |
| 3492 * actualReturnTypeName |
| 3493 * @param className the name of the class where the overridden method is decla
red |
| 3494 * @see #INVALID_GETTER_OVERRIDE_RETURN_TYPE |
| 3495 */ |
| 3496 static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = const Sta
ticWarningCode.con1('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 35, "The return type
'{0}' is not assignable to '{1}' as required by the method it is overriding from
'{2}'"); |
| 3497 |
| 3498 /** |
| 3499 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3500 * instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies
a default value for |
| 3501 * a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a diff
erent default value |
| 3502 * for <i>p</i>. |
| 3503 */ |
| 3504 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED
= const StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED
', 36, "Parameters cannot override default values, this method overrides '{0}.{1
}' where '{2}' has a different value"); |
| 3505 |
| 3506 /** |
| 3507 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3508 * instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies
a default value for |
| 3509 * a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a diff
erent default value |
| 3510 * for <i>p</i>. |
| 3511 */ |
| 3512 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSIT
IONAL = const StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_
POSITIONAL', 37, "Parameters cannot override default values, this method overrid
es '{0}.{1}' where this positional parameter has a different value"); |
| 3513 |
| 3514 /** |
| 3515 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3516 * instance member <i>m2</i> and <i>m1</i> does not declare all the named para
meters declared by |
| 3517 * <i>m2</i>. |
| 3518 * |
| 3519 * @param paramCount the number of named parameters in the overridden member |
| 3520 * @param className the name of the class from the overridden method |
| 3521 */ |
| 3522 static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCod
e.con1('INVALID_OVERRIDE_NAMED', 38, "Missing the named parameter '{0}' to match
the overridden method from '{1}'"); |
| 3523 |
| 3524 /** |
| 3525 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3526 * instance member <i>m2</i> and <i>m1</i> has fewer positional parameters tha
n <i>m2</i>. |
| 3527 * |
| 3528 * @param paramCount the number of positional parameters in the overridden mem
ber |
| 3529 * @param className the name of the class from the overridden method |
| 3530 */ |
| 3531 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = const StaticWarni
ngCode.con1('INVALID_OVERRIDE_POSITIONAL', 39, "Must have at least {0} parameter
s to match the overridden method from '{1}'"); |
| 3532 |
| 3533 /** |
| 3534 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 3535 * instance member <i>m2</i> and <i>m1</i> has a greater number of required pa
rameters than |
| 3536 * <i>m2</i>. |
| 3537 * |
| 3538 * @param paramCount the number of required parameters in the overridden membe
r |
| 3539 * @param className the name of the class from the overridden method |
| 3540 */ |
| 3541 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = const StaticWarning
Code.con1('INVALID_OVERRIDE_REQUIRED', 40, "Must have {0} required parameters or
less to match the overridden method from '{1}'"); |
| 3542 |
| 3543 /** |
| 3544 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a sette
r <i>m2</i> and the |
| 3545 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>. |
| 3546 * |
| 3547 * @param actualParamTypeName the name of the expected parameter type |
| 3548 * @param expectedParamType the name of the actual parameter type, not assigna
ble to the |
| 3549 * actualParamTypeName |
| 3550 * @param className the name of the class where the overridden setter is decla
red |
| 3551 * @see #INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE |
| 3552 */ |
| 3553 static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = con
st StaticWarningCode.con1('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', 41, "The
parameter type '{0}' is not assignable to '{1}' as required by the setter it is
overriding from '{2}'"); |
| 3554 |
| 3555 /** |
| 3556 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i>
… |
| 3557 * <i>e<sub>n</sub></i>] is evaluated as follows: |
| 3558 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and
second argument |
| 3559 * <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> |
| 3560 * |
| 3561 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 3562 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 3563 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 3564 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 3565 * j <= m</i>. |
| 3566 */ |
| 3567 static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const Static
WarningCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 42, "The element type '{0}'
cannot be assigned to the list type '{1}'"); |
| 3568 |
| 3569 /** |
| 3570 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</su
b></i> : |
| 3571 * <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>]
is evaluated as |
| 3572 * follows: |
| 3573 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s
ub></i> and second |
| 3574 * argument <i>e<sub>i</sub></i><i>, 1 <= i <= n</i> |
| 3575 * |
| 3576 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 3577 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 3578 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 3579 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 3580 * j <= m</i>. |
| 3581 */ |
| 3582 static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const StaticWarni
ngCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 43, "The element type '{0}' cannot be
assigned to the map key type '{1}'"); |
| 3583 |
| 3584 /** |
| 3585 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</su
b></i> : |
| 3586 * <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>]
is evaluated as |
| 3587 * follows: |
| 3588 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s
ub></i> and second |
| 3589 * argument <i>e<sub>i</sub></i><i>, 1 <= i <= n</i> |
| 3590 * |
| 3591 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 3592 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s
ub>, 1 <= i <= |
| 3593 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i>
q</i> of <i>f</i>. |
| 3594 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 3595 * j <= m</i>. |
| 3596 */ |
| 3597 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const StaticWar
ningCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 44, "The element type '{0}' canno
t be assigned to the map value type '{1}'"); |
| 3598 |
| 3599 /** |
| 3600 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i>
with argument type |
| 3601 * <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i
> may not be |
| 3602 * assigned to <i>S</i>. |
| 3603 */ |
| 3604 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = const Stat
icWarningCode.con1('MISMATCHED_GETTER_AND_SETTER_TYPES', 45, "The parameter type
for setter '{0}' is '{1}' which is not assignable to its getter (of type '{2}')
"); |
| 3605 |
| 3606 /** |
| 3607 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i>
with argument type |
| 3608 * <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i
> may not be |
| 3609 * assigned to <i>S</i>. |
| 3610 */ |
| 3611 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTY
PE = const StaticWarningCode.con1('MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPER
TYPE', 46, "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'"); |
| 3612 |
| 3613 /** |
| 3614 * 13.12 Return: It is a static warning if a function contains both one or mor
e return statements |
| 3615 * of the form <i>return;</i> and one or more return statements of the form <i
>return e;</i>. |
| 3616 */ |
| 3617 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode.co
n1('MIXED_RETURN_TYPES', 47, "Methods and functions cannot use return both with
and without values"); |
| 3618 |
| 3619 /** |
| 3620 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an abst
ract class and |
| 3621 * <i>q</i> is not a factory constructor. |
| 3622 */ |
| 3623 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = const StaticWarningCo
de.con1('NEW_WITH_ABSTRACT_CLASS', 48, "Abstract classes cannot be created with
a 'new' expression"); |
| 3624 |
| 3625 /** |
| 3626 * 15.8 Parameterized Types: Any use of a malbounded type gives rise to a stat
ic warning. |
| 3627 * |
| 3628 * @param typeName the name of the type being referenced (<i>S</i>) |
| 3629 * @param parameterCount the number of type parameters that were declared |
| 3630 * @param argumentCount the number of type arguments provided |
| 3631 * @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS |
| 3632 * @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS |
| 3633 */ |
| 3634 static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = const Static
WarningCode.con1('NEW_WITH_INVALID_TYPE_PARAMETERS', 49, "The type '{0}' is decl
ared with {1} type parameters, but {2} type arguments were given"); |
| 3635 |
| 3636 /** |
| 3637 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible i
n the current scope, |
| 3638 * optionally followed by type arguments. |
| 3639 * |
| 3640 * @param name the name of the non-type element |
| 3641 */ |
| 3642 static const StaticWarningCode NEW_WITH_NON_TYPE = const StaticWarningCode.con
1('NEW_WITH_NON_TYPE', 50, "The name '{0}' is not a class"); |
| 3643 |
| 3644 /** |
| 3645 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
current scope then: |
| 3646 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, a<sub>n<
/sub>, |
| 3647 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub
>)</i> it is a |
| 3648 * static warning if <i>T.id</i> is not the name of a constructor declared by
the type <i>T</i>. |
| 3649 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, x<
sub>n+1</sub>: |
| 3650 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a st
atic warning if the |
| 3651 * type <i>T</i> does not declare a constructor with the same name as the decl
aration of <i>T</i>. |
| 3652 */ |
| 3653 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = const StaticWa
rningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR', 51, "The class '{0}' does not h
ave a constructor '{1}'"); |
| 3654 |
| 3655 /** |
| 3656 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
current scope then: |
| 3657 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, a<sub>n<
/sub>, |
| 3658 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub
>)</i> it is a |
| 3659 * static warning if <i>T.id</i> is not the name of a constructor declared by
the type <i>T</i>. |
| 3660 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, x<
sub>n+1</sub>: |
| 3661 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a st
atic warning if the |
| 3662 * type <i>T</i> does not declare a constructor with the same name as the decl
aration of <i>T</i>. |
| 3663 */ |
| 3664 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = const
StaticWarningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 52, "The class
'{0}' does not have a default constructor"); |
| 3665 |
| 3666 /** |
| 3667 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
class inherits an |
| 3668 * abstract method. |
| 3669 * |
| 3670 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar
e its own |
| 3671 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf
ace of <i>C</i> |
| 3672 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not
declare or inherit |
| 3673 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F'
<: F</i>. |
| 3674 * |
| 3675 * 7.4 Abstract Instance Members: It is a static warning if an abstract member
is declared or |
| 3676 * inherited in a concrete class unless that member overrides a concrete one. |
| 3677 * |
| 3678 * @param memberName the name of the first member |
| 3679 * @param memberName the name of the second member |
| 3680 * @param memberName the name of the third member |
| 3681 * @param memberName the name of the fourth member |
| 3682 * @param additionalCount the number of additional missing members that aren't
listed |
| 3683 */ |
| 3684 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIV
E_PLUS = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMB
ER_FIVE_PLUS', 53, "Missing concrete implementation of {0}, {1}, {2}, {3} and {4
} more"); |
| 3685 |
| 3686 /** |
| 3687 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
class inherits an |
| 3688 * abstract method. |
| 3689 * |
| 3690 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar
e its own |
| 3691 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf
ace of <i>C</i> |
| 3692 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not
declare or inherit |
| 3693 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F'
<: F</i>. |
| 3694 * |
| 3695 * 7.4 Abstract Instance Members: It is a static warning if an abstract member
is declared or |
| 3696 * inherited in a concrete class unless that member overrides a concrete one. |
| 3697 * |
| 3698 * @param memberName the name of the first member |
| 3699 * @param memberName the name of the second member |
| 3700 * @param memberName the name of the third member |
| 3701 * @param memberName the name of the fourth member |
| 3702 */ |
| 3703 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOU
R = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FO
UR', 54, "Missing concrete implementation of {0}, {1}, {2} and {3}"); |
| 3704 |
| 3705 /** |
| 3706 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
class inherits an |
| 3707 * abstract method. |
| 3708 * |
| 3709 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar
e its own |
| 3710 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf
ace of <i>C</i> |
| 3711 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not
declare or inherit |
| 3712 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F'
<: F</i>. |
| 3713 * |
| 3714 * 7.4 Abstract Instance Members: It is a static warning if an abstract member
is declared or |
| 3715 * inherited in a concrete class unless that member overrides a concrete one. |
| 3716 * |
| 3717 * @param memberName the name of the member |
| 3718 */ |
| 3719 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE
= const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE
', 55, "Missing concrete implementation of {0}"); |
| 3720 |
| 3721 /** |
| 3722 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
class inherits an |
| 3723 * abstract method. |
| 3724 * |
| 3725 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar
e its own |
| 3726 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf
ace of <i>C</i> |
| 3727 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not
declare or inherit |
| 3728 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F'
<: F</i>. |
| 3729 * |
| 3730 * 7.4 Abstract Instance Members: It is a static warning if an abstract member
is declared or |
| 3731 * inherited in a concrete class unless that member overrides a concrete one. |
| 3732 * |
| 3733 * @param memberName the name of the first member |
| 3734 * @param memberName the name of the second member |
| 3735 * @param memberName the name of the third member |
| 3736 */ |
| 3737 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THR
EE = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_T
HREE', 56, "Missing concrete implementation of {0}, {1} and {2}"); |
| 3738 |
| 3739 /** |
| 3740 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
class inherits an |
| 3741 * abstract method. |
| 3742 * |
| 3743 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar
e its own |
| 3744 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf
ace of <i>C</i> |
| 3745 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not
declare or inherit |
| 3746 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F'
<: F</i>. |
| 3747 * |
| 3748 * 7.4 Abstract Instance Members: It is a static warning if an abstract member
is declared or |
| 3749 * inherited in a concrete class unless that member overrides a concrete one. |
| 3750 * |
| 3751 * @param memberName the name of the first member |
| 3752 * @param memberName the name of the second member |
| 3753 */ |
| 3754 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO
= const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO
', 57, "Missing concrete implementation of {0} and {1}"); |
| 3755 |
| 3756 /** |
| 3757 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, p<s
ub>2</sub>) s</i> or |
| 3758 * <i>on T s</i> matches an object <i>o</i> if the type of <i>o</i> is a subty
pe of <i>T</i>. It |
| 3759 * is a static warning if <i>T</i> does not denote a type available in the lex
ical scope of the |
| 3760 * catch clause. |
| 3761 * |
| 3762 * @param name the name of the non-type element |
| 3763 */ |
| 3764 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = const StaticWarningC
ode.con1('NON_TYPE_IN_CATCH_CLAUSE', 58, "The name '{0}' is not a type and canno
t be used in an on-catch clause"); |
| 3765 |
| 3766 /** |
| 3767 * 7.1.1 Operators: It is a static warning if the return type of the user-decl
ared operator []= is |
| 3768 * explicitly declared and not void. |
| 3769 */ |
| 3770 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = const StaticWarn
ingCode.con1('NON_VOID_RETURN_FOR_OPERATOR', 59, "The return type of the operato
r []= must be 'void'"); |
| 3771 |
| 3772 /** |
| 3773 * 7.3 Setters: It is a static warning if a setter declares a return type othe
r than void. |
| 3774 */ |
| 3775 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = const StaticWarnin
gCode.con1('NON_VOID_RETURN_FOR_SETTER', 60, "The return type of the setter must
be 'void'"); |
| 3776 |
| 3777 /** |
| 3778 * 15.1 Static Types: A type <i>T</i> is malformed iff: * <i>T</i> has the for
m <i>id</i> or the |
| 3779 * form <i>prefix.id</i>, and in the enclosing lexical scope, the name <i>id</
i> (respectively |
| 3780 * <i>prefix.id</i>) does not denote a type. * <i>T</i> denotes a type paramet
er in the |
| 3781 * enclosing lexical scope, but occurs in the signature or body of a static me
mber. * |
| 3782 * <i>T</i> is a parameterized type of the form <i>G<S<sub>1</sub>, .., S<s
ub>n</sub>></i>, |
| 3783 * |
| 3784 * Any use of a malformed type gives rise to a static warning. |
| 3785 * |
| 3786 * @param nonTypeName the name that is not a type |
| 3787 */ |
| 3788 static const StaticWarningCode NOT_A_TYPE = const StaticWarningCode.con1('NOT_
A_TYPE', 61, "{0} is not a type"); |
| 3789 |
| 3790 /** |
| 3791 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</
i> or if <i>m > |
| 3792 * n</i>. |
| 3793 * |
| 3794 * @param requiredCount the expected number of required arguments |
| 3795 * @param argumentCount the actual number of positional arguments given |
| 3796 * @see #EXTRA_POSITIONAL_ARGUMENTS |
| 3797 */ |
| 3798 static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const StaticWar
ningCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 62, "{0} required argument(s) exp
ected, but {1} found"); |
| 3799 |
| 3800 /** |
| 3801 * 14.3 Parts: It is a static warning if the referenced part declaration <i>p<
/i> names a library |
| 3802 * other than the current library as the library to which <i>p</i> belongs. |
| 3803 * |
| 3804 * @param expectedLibraryName the name of expected library name |
| 3805 * @param actualLibraryName the non-matching actual library name from the "par
t of" declaration |
| 3806 */ |
| 3807 static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY = const StaticWarning
Code.con1('PART_OF_DIFFERENT_LIBRARY', 63, "Expected this library to be part of
'{0}', not '{1}'"); |
| 3808 |
| 3809 /** |
| 3810 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> i
s not a subtype of |
| 3811 * the type of <i>k</i>. |
| 3812 * |
| 3813 * @param redirectedName the name of the redirected constructor |
| 3814 * @param redirectingName the name of the redirecting constructor |
| 3815 */ |
| 3816 static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = const Stati
cWarningCode.con1('REDIRECT_TO_INVALID_FUNCTION_TYPE', 64, "The redirected const
ructor '{0}' has incompatible parameters with '{1}'"); |
| 3817 |
| 3818 /** |
| 3819 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> i
s not a subtype of |
| 3820 * the type of <i>k</i>. |
| 3821 * |
| 3822 * @param redirectedName the name of the redirected constructor return type |
| 3823 * @param redirectingName the name of the redirecting constructor return type |
| 3824 */ |
| 3825 static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = const StaticW
arningCode.con1('REDIRECT_TO_INVALID_RETURN_TYPE', 65, "The return type '{0}' of
the redirected constructor is not assignable to '{1}'"); |
| 3826 |
| 3827 /** |
| 3828 * 7.6.2 Factories: It is a static warning if type does not denote a class acc
essible in the |
| 3829 * current scope; if type does denote such a class <i>C</i> it is a static war
ning if the |
| 3830 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const
ructor of <i>C</i>. |
| 3831 */ |
| 3832 static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = const StaticW
arningCode.con1('REDIRECT_TO_MISSING_CONSTRUCTOR', 66, "The constructor '{0}' co
uld not be found in '{1}'"); |
| 3833 |
| 3834 /** |
| 3835 * 7.6.2 Factories: It is a static warning if type does not denote a class acc
essible in the |
| 3836 * current scope; if type does denote such a class <i>C</i> it is a static war
ning if the |
| 3837 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const
ructor of <i>C</i>. |
| 3838 */ |
| 3839 static const StaticWarningCode REDIRECT_TO_NON_CLASS = const StaticWarningCode
.con1('REDIRECT_TO_NON_CLASS', 67, "The name '{0}' is not a type and cannot be u
sed in a redirected constructor"); |
| 3840 |
| 3841 /** |
| 3842 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return s
tatement of the form |
| 3843 * <i>return;</i> It is a static warning if both of the following conditions h
old: |
| 3844 * <ol> |
| 3845 * * <i>f</i> is not a generative constructor. |
| 3846 * * The return type of <i>f</i> may not be assigned to void. |
| 3847 * </ol> |
| 3848 */ |
| 3849 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode.
con1('RETURN_WITHOUT_VALUE', 68, "Missing return value after 'return'"); |
| 3850 |
| 3851 /** |
| 3852 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not decl
are a static method |
| 3853 * or getter <i>m</i>. |
| 3854 * |
| 3855 * @param memberName the name of the instance member |
| 3856 */ |
| 3857 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = const Static
WarningCode.con1('STATIC_ACCESS_TO_INSTANCE_MEMBER', 69, "Instance member '{0}'
cannot be accessed using static access"); |
| 3858 |
| 3859 /** |
| 3860 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be assi
gned to the type of |
| 3861 * <i>e<sub>k</sub></i>. |
| 3862 */ |
| 3863 static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = const Static
WarningCode.con1('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 70, "Type '{0}' of the swit
ch expression is not assignable to the type '{1}' of case expressions"); |
| 3864 |
| 3865 /** |
| 3866 * 15.1 Static Types: It is a static warning to use a deferred type in a type
annotation. |
| 3867 * |
| 3868 * @param name the name of the type that is deferred and being used in a type
annotation |
| 3869 */ |
| 3870 static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS = const StaticWa
rningCode.con1('TYPE_ANNOTATION_DEFERRED_CLASS', 71, "The deferred type '{0}' ca
nnot be used in a declaration, cast or type test"); |
| 3871 |
| 3872 /** |
| 3873 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type
available in the |
| 3874 * current lexical scope. |
| 3875 */ |
| 3876 static const StaticWarningCode TYPE_TEST_NON_TYPE = const StaticWarningCode.co
n1('TYPE_TEST_NON_TYPE', 72, "The name '{0}' is not a type and cannot be used in
an 'is' expression"); |
| 3877 |
| 3878 /** |
| 3879 * 10 Generics: However, a type parameter is considered to be a malformed type
when referenced by |
| 3880 * a static member. |
| 3881 * |
| 3882 * 15.1 Static Types: Any use of a malformed type gives rise to a static warni
ng. A malformed type |
| 3883 * is then interpreted as dynamic by the static type checker and the runtime. |
| 3884 */ |
| 3885 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = const Sta
ticWarningCode.con1('TYPE_PARAMETER_REFERENCED_BY_STATIC', 73, "Static members c
annot reference type parameters"); |
| 3886 |
| 3887 /** |
| 3888 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form |
| 3889 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</
sub>, … |
| 3890 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static warning if <i>C</i> d
oes not denote a |
| 3891 * class in the current scope. |
| 3892 * |
| 3893 * @param undefinedClassName the name of the undefined class |
| 3894 */ |
| 3895 static const StaticWarningCode UNDEFINED_CLASS = const StaticWarningCode.con1(
'UNDEFINED_CLASS', 74, "Undefined class '{0}'"); |
| 3896 |
| 3897 /** |
| 3898 * Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool". |
| 3899 */ |
| 3900 static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN = const StaticWarningCo
de.con1('UNDEFINED_CLASS_BOOLEAN', 75, "Undefined class 'boolean'; did you mean
'bool'?"); |
| 3901 |
| 3902 /** |
| 3903 * 12.17 Getter Invocation: It is a static warning if there is no class <i>C</
i> in the enclosing |
| 3904 * lexical scope of <i>i</i>, or if <i>C</i> does not declare, implicitly or e
xplicitly, a getter |
| 3905 * named <i>m</i>. |
| 3906 * |
| 3907 * @param getterName the name of the getter |
| 3908 * @param enclosingType the name of the enclosing type where the getter is bei
ng looked for |
| 3909 */ |
| 3910 static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode.con1
('UNDEFINED_GETTER', 76, "There is no such getter '{0}' in '{1}'"); |
| 3911 |
| 3912 /** |
| 3913 * 12.30 Identifier Reference: It is as static warning if an identifier expres
sion of the form |
| 3914 * <i>id</i> occurs inside a top level or static function (be it function, met
hod, getter, or |
| 3915 * setter) or variable initializer and there is no declaration <i>d</i> with n
ame <i>id</i> in the |
| 3916 * lexical scope enclosing the expression. |
| 3917 * |
| 3918 * @param name the name of the identifier |
| 3919 */ |
| 3920 static const StaticWarningCode UNDEFINED_IDENTIFIER = const StaticWarningCode.
con1('UNDEFINED_IDENTIFIER', 77, "Undefined name '{0}'"); |
| 3921 |
| 3922 /** |
| 3923 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>,
<i>1<=i<=l</i>, |
| 3924 * must have a corresponding named parameter in the set {<i>p<sub>n+1</sub></i
> … |
| 3925 * <i>p<sub>n+k</sub></i>} or a static warning occurs. |
| 3926 * |
| 3927 * @param name the name of the requested named parameter |
| 3928 */ |
| 3929 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = const StaticWarning
Code.con1('UNDEFINED_NAMED_PARAMETER', 78, "The named parameter '{0}' is not def
ined"); |
| 3930 |
| 3931 /** |
| 3932 * 12.18 Assignment: It is as static warning if an assignment of the form <i>v
= e</i> occurs |
| 3933 * inside a top level or static function (be it function, method, getter, or s
etter) or variable |
| 3934 * initializer and there is no declaration <i>d</i> with name <i>v=</i> in the
lexical scope |
| 3935 * enclosing the assignment. |
| 3936 * |
| 3937 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in t
he enclosing lexical |
| 3938 * scope of the assignment, or if <i>C</i> does not declare, implicitly or exp
licitly, a setter |
| 3939 * <i>v=</i>. |
| 3940 * |
| 3941 * @param setterName the name of the getter |
| 3942 * @param enclosingType the name of the enclosing type where the setter is bei
ng looked for |
| 3943 */ |
| 3944 static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode.con1
('UNDEFINED_SETTER', 79, "There is no such setter '{0}' in '{1}'"); |
| 3945 |
| 3946 /** |
| 3947 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not decl
are a static method |
| 3948 * or getter <i>m</i>. |
| 3949 * |
| 3950 * @param methodName the name of the method |
| 3951 * @param enclosingType the name of the enclosing type where the method is bei
ng looked for |
| 3952 */ |
| 3953 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = const Stati
cWarningCode.con1('UNDEFINED_STATIC_METHOD_OR_GETTER', 80, "There is no such sta
tic method, getter or setter '{0}' in '{1}'"); |
| 3954 |
| 3955 /** |
| 3956 * 7.2 Getters: It is a static warning if the return type of a getter is void. |
| 3957 */ |
| 3958 static const StaticWarningCode VOID_RETURN_FOR_GETTER = const StaticWarningCod
e.con1('VOID_RETURN_FOR_GETTER', 81, "The return type of the getter must not be
'void'"); |
| 3959 |
| 3960 static const List<StaticWarningCode> values = const [ |
| 3961 AMBIGUOUS_IMPORT, |
| 3962 ARGUMENT_TYPE_NOT_ASSIGNABLE, |
| 3963 ASSIGNMENT_TO_CONST, |
| 3964 ASSIGNMENT_TO_FINAL, |
| 3965 ASSIGNMENT_TO_FINAL_NO_SETTER, |
| 3966 ASSIGNMENT_TO_FUNCTION, |
| 3967 ASSIGNMENT_TO_METHOD, |
| 3968 CASE_BLOCK_NOT_TERMINATED, |
| 3969 CAST_TO_NON_TYPE, |
| 3970 CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, |
| 3971 CONFLICTING_DART_IMPORT, |
| 3972 CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, |
| 3973 CONFLICTING_INSTANCE_METHOD_SETTER, |
| 3974 CONFLICTING_INSTANCE_METHOD_SETTER2, |
| 3975 CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER, |
| 3976 CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, |
| 3977 CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER, |
| 3978 CONST_WITH_ABSTRACT_CLASS, |
| 3979 EQUAL_KEYS_IN_MAP, |
| 3980 EXPORT_DUPLICATED_LIBRARY_NAME, |
| 3981 EXTRA_POSITIONAL_ARGUMENTS, |
| 3982 FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, |
| 3983 FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, |
| 3984 FIELD_INITIALIZER_NOT_ASSIGNABLE, |
| 3985 FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, |
| 3986 FINAL_NOT_INITIALIZED, |
| 3987 FUNCTION_WITHOUT_CALL, |
| 3988 IMPORT_DUPLICATED_LIBRARY_NAME, |
| 3989 IMPORT_OF_NON_LIBRARY, |
| 3990 INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, |
| 3991 INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, |
| 3992 INVALID_GETTER_OVERRIDE_RETURN_TYPE, |
| 3993 INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE, |
| 3994 INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE, |
| 3995 INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE, |
| 3996 INVALID_METHOD_OVERRIDE_RETURN_TYPE, |
| 3997 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED, |
| 3998 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL, |
| 3999 INVALID_OVERRIDE_NAMED, |
| 4000 INVALID_OVERRIDE_POSITIONAL, |
| 4001 INVALID_OVERRIDE_REQUIRED, |
| 4002 INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE, |
| 4003 LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, |
| 4004 MAP_KEY_TYPE_NOT_ASSIGNABLE, |
| 4005 MAP_VALUE_TYPE_NOT_ASSIGNABLE, |
| 4006 MISMATCHED_GETTER_AND_SETTER_TYPES, |
| 4007 MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE, |
| 4008 MIXED_RETURN_TYPES, |
| 4009 NEW_WITH_ABSTRACT_CLASS, |
| 4010 NEW_WITH_INVALID_TYPE_PARAMETERS, |
| 4011 NEW_WITH_NON_TYPE, |
| 4012 NEW_WITH_UNDEFINED_CONSTRUCTOR, |
| 4013 NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, |
| 4014 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, |
| 4015 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, |
| 4016 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, |
| 4017 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, |
| 4018 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, |
| 4019 NON_TYPE_IN_CATCH_CLAUSE, |
| 4020 NON_VOID_RETURN_FOR_OPERATOR, |
| 4021 NON_VOID_RETURN_FOR_SETTER, |
| 4022 NOT_A_TYPE, |
| 4023 NOT_ENOUGH_REQUIRED_ARGUMENTS, |
| 4024 PART_OF_DIFFERENT_LIBRARY, |
| 4025 REDIRECT_TO_INVALID_FUNCTION_TYPE, |
| 4026 REDIRECT_TO_INVALID_RETURN_TYPE, |
| 4027 REDIRECT_TO_MISSING_CONSTRUCTOR, |
| 4028 REDIRECT_TO_NON_CLASS, |
| 4029 RETURN_WITHOUT_VALUE, |
| 4030 STATIC_ACCESS_TO_INSTANCE_MEMBER, |
| 4031 SWITCH_EXPRESSION_NOT_ASSIGNABLE, |
| 4032 TYPE_ANNOTATION_DEFERRED_CLASS, |
| 4033 TYPE_TEST_NON_TYPE, |
| 4034 TYPE_PARAMETER_REFERENCED_BY_STATIC, |
| 4035 UNDEFINED_CLASS, |
| 4036 UNDEFINED_CLASS_BOOLEAN, |
| 4037 UNDEFINED_GETTER, |
| 4038 UNDEFINED_IDENTIFIER, |
| 4039 UNDEFINED_NAMED_PARAMETER, |
| 4040 UNDEFINED_SETTER, |
| 4041 UNDEFINED_STATIC_METHOD_OR_GETTER, |
| 4042 VOID_RETURN_FOR_GETTER]; |
| 4043 |
| 4044 /** |
| 4045 * The template used to create the message to be displayed for this error. |
| 4046 */ |
| 4047 final String message; |
| 4048 |
| 4049 /** |
| 4050 * The template used to create the correction to be displayed for this error,
or `null` if |
| 4051 * there is no correction information for this error. |
| 4052 */ |
| 4053 final String correction; |
| 4054 |
| 4055 /** |
| 4056 * Initialize a newly created error code to have the given message. |
| 4057 * |
| 4058 * @param message the message template used to create the message to be displa
yed for the error |
| 4059 */ |
| 4060 const StaticWarningCode.con1(String name, int ordinal, String message) : this.
con2(name, ordinal, message, null); |
| 4061 |
| 4062 /** |
| 4063 * Initialize a newly created error code to have the given message and correct
ion. |
| 4064 * |
| 4065 * @param message the template used to create the message to be displayed for
the error |
| 4066 * @param correction the template used to create the correction to be displaye
d for the error |
| 4067 */ |
| 4068 const StaticWarningCode.con2(String name, int ordinal, this.message, this.corr
ection) : super(name, ordinal); |
| 4069 |
| 4070 @override |
| 4071 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; |
| 4072 |
| 4073 @override |
| 4074 ErrorType get type => ErrorType.STATIC_WARNING; |
| 4075 |
| 4076 @override |
| 4077 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 4078 } |
| 4079 |
| 4080 /** |
| 4081 * The enumeration `TodoCode` defines the single TODO `ErrorCode`. |
| 4082 */ |
| 4083 class TodoCode extends Enum<TodoCode> implements ErrorCode { |
| 4084 /** |
| 4085 * The single enum of TodoCode. |
| 4086 */ |
| 4087 static const TodoCode TODO = const TodoCode('TODO', 0); |
| 4088 |
| 4089 static const List<TodoCode> values = const [TODO]; |
| 4090 |
| 4091 /** |
| 4092 * This matches the two common Dart task styles |
| 4093 * |
| 4094 * * TODO: |
| 4095 * * TODO(username): |
| 4096 * |
| 4097 * As well as |
| 4098 * * TODO |
| 4099 * |
| 4100 * But not |
| 4101 * * todo |
| 4102 * * TODOS |
| 4103 */ |
| 4104 static RegExp TODO_REGEX = new RegExp("([\\s/\\*])((TODO[^\\w\\d][^\\r\\n]*)|(
TODO:?\$))"); |
| 4105 |
| 4106 const TodoCode(String name, int ordinal) : super(name, ordinal); |
| 4107 |
| 4108 @override |
| 4109 String get correction => null; |
| 4110 |
| 4111 @override |
| 4112 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 4113 |
| 4114 @override |
| 4115 String get message => "{0}"; |
| 4116 |
| 4117 @override |
| 4118 ErrorType get type => ErrorType.TODO; |
| 4119 |
| 4120 @override |
| 4121 String get uniqueName => "${runtimeType.toString()}.${name}"; |
| 4122 } |
OLD | NEW |