| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library engine.error; | 5 library analyzer.src.error.codes; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'package:analyzer/error/error.dart'; |
| 8 | 8 import 'package:analyzer/src/dart/element/element.dart'; |
| 9 import 'ast.dart' show AstNode; | |
| 10 import 'element.dart'; | |
| 11 import 'java_core.dart'; | |
| 12 import 'scanner.dart' show Token; | |
| 13 import 'source.dart'; | |
| 14 | 9 |
| 15 /** | 10 /** |
| 16 * An error discovered during the analysis of some Dart code. | 11 * The error codes used for errors in analysis options files. The convention for |
| 17 * | 12 * this class is for the name of the error code to indicate the problem that |
| 18 * See [AnalysisErrorListener]. | 13 * caused the error to be generated and for the error message to explain what is |
| 14 * wrong and, when appropriate, how the problem can be corrected. |
| 19 */ | 15 */ |
| 20 class AnalysisError { | 16 class AnalysisOptionsErrorCode extends ErrorCode { |
| 21 /** | 17 /** |
| 22 * An empty array of errors used when no errors are expected. | 18 * An error code indicating that there is a syntactic error in the file. |
| 19 * |
| 20 * Parameters: |
| 21 * 0: the error message from the parse error |
| 23 */ | 22 */ |
| 24 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[]; | 23 static const AnalysisOptionsErrorCode PARSE_ERROR = |
| 24 const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}'); |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * A [Comparator] that sorts by the name of the file that the [AnalysisError] | 27 * Initialize a newly created error code to have the given [name]. |
| 28 * was found. | |
| 29 */ | 28 */ |
| 30 static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1, | 29 const AnalysisOptionsErrorCode(String name, String message, |
| 31 AnalysisError o2) => | 30 [String correction]) |
| 32 o1.source.shortName.compareTo(o2.source.shortName); | 31 : super(name, message, correction); |
| 33 | |
| 34 /** | |
| 35 * A [Comparator] that sorts error codes first by their severity (errors | |
| 36 * first, warnings second), and then by the the error code type. | |
| 37 */ | |
| 38 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = | |
| 39 (AnalysisError o1, AnalysisError o2) { | |
| 40 ErrorCode errorCode1 = o1.errorCode; | |
| 41 ErrorCode errorCode2 = o2.errorCode; | |
| 42 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity; | |
| 43 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity; | |
| 44 if (errorSeverity1 == errorSeverity2) { | |
| 45 ErrorType errorType1 = errorCode1.type; | |
| 46 ErrorType errorType2 = errorCode2.type; | |
| 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 | |
| 65 * correction 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 | |
| 76 * the error occurred. | |
| 77 */ | |
| 78 int offset = 0; | |
| 79 | |
| 80 /** | |
| 81 * The number of characters from the offset to the end of the source which | |
| 82 * encompasses the compilation error. | |
| 83 */ | |
| 84 int length = 0; | |
| 85 | |
| 86 /** | |
| 87 * A flag indicating whether this error can be shown to be a non-issue because | |
| 88 * of the result of type propagation. | |
| 89 */ | |
| 90 bool isStaticOnly = false; | |
| 91 | |
| 92 /** | |
| 93 * Initialize a newly created analysis error. The error is associated with the | |
| 94 * given [source] and is located at the given [offset] with the given | |
| 95 * [length]. The error will have the given [errorCode] and the list of | |
| 96 * [arguments] will be used to complete the message. | |
| 97 */ | |
| 98 AnalysisError(this.source, this.offset, this.length, this.errorCode, | |
| 99 [List<Object> arguments]) { | |
| 100 this._message = formatList(errorCode.message, arguments); | |
| 101 String correctionTemplate = errorCode.correction; | |
| 102 if (correctionTemplate != null) { | |
| 103 this._correction = formatList(correctionTemplate, arguments); | |
| 104 } | |
| 105 } | |
| 106 | |
| 107 /** | |
| 108 * Initialize a newly created analysis error for the specified [source]. The | |
| 109 * error will have the given [errorCode] and the list of [arguments] will be | |
| 110 * used to complete the message. The error has no location information. | |
| 111 */ | |
| 112 @deprecated // Use new AnalysisError(source, 0, 0, errorCode, arguments) | |
| 113 AnalysisError.con1(Source source, ErrorCode errorCode, | |
| 114 [List<Object> arguments]) | |
| 115 : this(source, 0, 0, errorCode, arguments); | |
| 116 | |
| 117 /** | |
| 118 * Initialize a newly created analysis error for the specified [source] at the | |
| 119 * given [offset] with the given [length]. The error will have the given | |
| 120 * [errorCode] and the list of [arguments] will be used to complete the | |
| 121 * message. | |
| 122 */ | |
| 123 @deprecated // Use new AnalysisError(source, offset, length, errorCode, argume
nts) | |
| 124 AnalysisError.con2(Source source, int offset, int length, ErrorCode errorCode, | |
| 125 [List<Object> arguments]) | |
| 126 : this(source, offset, length, errorCode, arguments); | |
| 127 | |
| 128 /** | |
| 129 * Return the template used to create the correction to be displayed for this | |
| 130 * error, or `null` if there is no correction information for this error. The | |
| 131 * correction should indicate how the user can fix the error. | |
| 132 */ | |
| 133 String get correction => _correction; | |
| 134 | 32 |
| 135 @override | 33 @override |
| 136 int get hashCode { | 34 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 137 int hashCode = offset; | |
| 138 hashCode ^= (_message != null) ? _message.hashCode : 0; | |
| 139 hashCode ^= (source != null) ? source.hashCode : 0; | |
| 140 return hashCode; | |
| 141 } | |
| 142 | |
| 143 /** | |
| 144 * Return the message to be displayed for this error. The message should | |
| 145 * indicate what is wrong and why it is wrong. | |
| 146 */ | |
| 147 String get message => _message; | |
| 148 | 35 |
| 149 @override | 36 @override |
| 150 bool operator ==(Object obj) { | 37 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 151 if (identical(obj, this)) { | |
| 152 return true; | |
| 153 } | |
| 154 // prepare other AnalysisError | |
| 155 if (obj is! AnalysisError) { | |
| 156 return false; | |
| 157 } | |
| 158 AnalysisError other = obj as AnalysisError; | |
| 159 // Quick checks. | |
| 160 if (!identical(errorCode, other.errorCode)) { | |
| 161 return false; | |
| 162 } | |
| 163 if (offset != other.offset || length != other.length) { | |
| 164 return false; | |
| 165 } | |
| 166 if (isStaticOnly != other.isStaticOnly) { | |
| 167 return false; | |
| 168 } | |
| 169 // Deep checks. | |
| 170 if (_message != other._message) { | |
| 171 return false; | |
| 172 } | |
| 173 if (source != other.source) { | |
| 174 return false; | |
| 175 } | |
| 176 // OK | |
| 177 return true; | |
| 178 } | |
| 179 | |
| 180 /** | |
| 181 * Return the value of the given [property], or `null` if the given property | |
| 182 * is not defined for this error. | |
| 183 */ | |
| 184 Object getProperty(ErrorProperty property) => null; | |
| 185 | |
| 186 @override | |
| 187 String toString() { | |
| 188 StringBuffer buffer = new StringBuffer(); | |
| 189 buffer.write((source != null) ? source.fullName : "<unknown source>"); | |
| 190 buffer.write("("); | |
| 191 buffer.write(offset); | |
| 192 buffer.write(".."); | |
| 193 buffer.write(offset + length - 1); | |
| 194 buffer.write("): "); | |
| 195 //buffer.write("(" + lineNumber + ":" + columnNumber + "): "); | |
| 196 buffer.write(_message); | |
| 197 return buffer.toString(); | |
| 198 } | |
| 199 | |
| 200 /** | |
| 201 * Merge all of the errors in the lists in the given list of [errorLists] into | |
| 202 * a single list of errors. | |
| 203 */ | |
| 204 static List<AnalysisError> mergeLists(List<List<AnalysisError>> errorLists) { | |
| 205 Set<AnalysisError> errors = new HashSet<AnalysisError>(); | |
| 206 for (List<AnalysisError> errorList in errorLists) { | |
| 207 errors.addAll(errorList); | |
| 208 } | |
| 209 return errors.toList(); | |
| 210 } | |
| 211 } | 38 } |
| 212 | 39 |
| 213 /** | 40 /** |
| 214 * An object that listen for [AnalysisError]s being produced by the analysis | 41 * The error codes used for warnings in analysis options files. The convention |
| 215 * engine. | 42 * for this class is for the name of the error code to indicate the problem that |
| 43 * caused the error to be generated and for the error message to explain what is |
| 44 * wrong and, when appropriate, how the problem can be corrected. |
| 216 */ | 45 */ |
| 217 abstract class AnalysisErrorListener { | 46 class AnalysisOptionsWarningCode extends ErrorCode { |
| 218 /** | 47 /** |
| 219 * An error listener that ignores errors that are reported to it. | 48 * An error code indicating that a plugin is being configured with an |
| 49 * unsupported option and legal options are provided. |
| 50 * |
| 51 * Parameters: |
| 52 * 0: the plugin name |
| 53 * 1: the unsupported option key |
| 54 * 2: legal values |
| 220 */ | 55 */ |
| 221 static final AnalysisErrorListener NULL_LISTENER = | 56 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES = |
| 222 new AnalysisErrorListener_NULL_LISTENER(); | 57 const AnalysisOptionsWarningCode('UNSUPPORTED_OPTION_WITH_LEGAL_VALUES', |
| 58 "The option '{1}' is not supported by {0}, supported values are {2}"); |
| 223 | 59 |
| 224 /** | 60 /** |
| 225 * This method is invoked when an [error] has been found by the analysis | 61 * An error code indicating that a plugin is being configured with an |
| 226 * engine. | 62 * unsupported option where there is just one legal value. |
| 63 * |
| 64 * Parameters: |
| 65 * 0: the plugin name |
| 66 * 1: the unsupported option key |
| 67 * 2: the legal value |
| 227 */ | 68 */ |
| 228 void onError(AnalysisError error); | 69 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE = |
| 70 const AnalysisOptionsWarningCode('UNSUPPORTED_OPTION_WITH_LEGAL_VALUE', |
| 71 "The option '{1}' is not supported by {0}, did you mean {2}?"); |
| 72 |
| 73 /** |
| 74 * An error code indicating that an option entry is being configured with an |
| 75 * unsupported value. |
| 76 * |
| 77 * Parameters: |
| 78 * 0: the option name |
| 79 * 1: the unsupported value |
| 80 * 2: legal values |
| 81 */ |
| 82 static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE = |
| 83 const AnalysisOptionsWarningCode('UNSUPPORTED_VALUE', |
| 84 "The value '{1}' is not supported by {0}, legal values are {2}"); |
| 85 |
| 86 /** |
| 87 * An error code indicating that an unrecognized error code is being used to |
| 88 * specify an error filter. |
| 89 * |
| 90 * Parameters: |
| 91 * 0: the unrecognized error code |
| 92 */ |
| 93 static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE = |
| 94 const AnalysisOptionsWarningCode( |
| 95 'UNRECOGNIZED_ERROR_CODE', "'{0}' is not a recognized error code"); |
| 96 |
| 97 /** |
| 98 * Initialize a newly created warning code to have the given [name]. |
| 99 */ |
| 100 const AnalysisOptionsWarningCode(String name, String message, |
| 101 [String correction]) |
| 102 : super(name, message, correction); |
| 103 |
| 104 @override |
| 105 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; |
| 106 |
| 107 @override |
| 108 ErrorType get type => ErrorType.STATIC_WARNING; |
| 229 } | 109 } |
| 230 | 110 |
| 231 /** | 111 /** |
| 232 * An [AnalysisErrorListener] that ignores error. | |
| 233 */ | |
| 234 class AnalysisErrorListener_NULL_LISTENER implements AnalysisErrorListener { | |
| 235 @override | |
| 236 void onError(AnalysisError event) { | |
| 237 // Ignore errors | |
| 238 } | |
| 239 } | |
| 240 | |
| 241 /** | |
| 242 * An [AnalysisError] that can have arbitrary properties associated with it. | |
| 243 */ | |
| 244 class AnalysisErrorWithProperties extends AnalysisError { | |
| 245 /** | |
| 246 * The properties associated with this error. | |
| 247 */ | |
| 248 HashMap<ErrorProperty, Object> _propertyMap = | |
| 249 new HashMap<ErrorProperty, Object>(); | |
| 250 | |
| 251 /** | |
| 252 * Initialize a newly created analysis error. The error is associated with the | |
| 253 * given [source] and is located at the given [offset] with the given | |
| 254 * [length]. The error will have the given [errorCode] and the list of | |
| 255 * [arguments] will be used to complete the message. | |
| 256 */ | |
| 257 AnalysisErrorWithProperties( | |
| 258 Source source, int offset, int length, ErrorCode errorCode, | |
| 259 [List<Object> arguments]) | |
| 260 : super(source, offset, length, errorCode, arguments); | |
| 261 | |
| 262 /** | |
| 263 * Initialize a newly created analysis error for the specified [source]. The | |
| 264 * error will have the given [errorCode] and the list of [arguments] will be | |
| 265 * used to complete the message. The error has no location information. | |
| 266 */ | |
| 267 @deprecated // Use new AnalysisErrorWithProperties(source, 0, 0, errorCode, ar
guments) | |
| 268 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, | |
| 269 [List<Object> arguments]) | |
| 270 : this(source, 0, 0, errorCode, arguments); | |
| 271 | |
| 272 /** | |
| 273 * Initialize a newly created analysis error for the specified [source] at the | |
| 274 * given [offset] with the given [length]. The error will have the given | |
| 275 * [errorCode] and the list of [arguments] will be used to complete the | |
| 276 * message. | |
| 277 */ | |
| 278 @deprecated // Use new AnalysisErrorWithProperties(source, offset, length, err
orCode, arguments) | |
| 279 AnalysisErrorWithProperties.con2( | |
| 280 Source source, int offset, int length, ErrorCode errorCode, | |
| 281 [List<Object> arguments]) | |
| 282 : this(source, offset, length, errorCode, arguments); | |
| 283 | |
| 284 @override | |
| 285 Object getProperty(ErrorProperty property) => _propertyMap[property]; | |
| 286 | |
| 287 /** | |
| 288 * Set the value of the given [property] to the given [value]. Using a value | |
| 289 * of `null` will effectively remove the property from this error. | |
| 290 */ | |
| 291 void setProperty(ErrorProperty property, Object value) { | |
| 292 _propertyMap[property] = value; | |
| 293 } | |
| 294 } | |
| 295 | |
| 296 /** | |
| 297 * An [AnalysisErrorListener] that keeps track of whether any error has been | |
| 298 * reported to it. | |
| 299 */ | |
| 300 class BooleanErrorListener implements AnalysisErrorListener { | |
| 301 /** | |
| 302 * A flag indicating whether an error has been reported to this listener. | |
| 303 */ | |
| 304 bool _errorReported = false; | |
| 305 | |
| 306 /** | |
| 307 * Return `true` if an error has been reported to this listener. | |
| 308 */ | |
| 309 bool get errorReported => _errorReported; | |
| 310 | |
| 311 @override | |
| 312 void onError(AnalysisError error) { | |
| 313 _errorReported = true; | |
| 314 } | |
| 315 } | |
| 316 | |
| 317 /** | |
| 318 * The error codes used for compile time errors caused by constant evaluation | 112 * The error codes used for compile time errors caused by constant evaluation |
| 319 * that would throw an exception when run in checked mode. The client of the | 113 * that would throw an exception when run in checked mode. The client of the |
| 320 * analysis engine is responsible for determining how these errors should be | 114 * analysis engine is responsible for determining how these errors should be |
| 321 * presented to the user (for example, a command-line compiler might elect to | 115 * presented to the user (for example, a command-line compiler might elect to |
| 322 * treat these errors differently depending whether it is compiling it "checked" | 116 * treat these errors differently depending whether it is compiling it "checked" |
| 323 * mode). | 117 * mode). |
| 324 */ | 118 */ |
| 325 class CheckedModeCompileTimeErrorCode extends ErrorCode { | 119 class CheckedModeCompileTimeErrorCode extends ErrorCode { |
| 326 // TODO(paulberry): improve the text of these error messages so that it's | 120 // TODO(paulberry): improve the text of these error messages so that it's |
| 327 // clear to the user that the error is coming from constant evaluation (and | 121 // clear to the user that the error is coming from constant evaluation (and |
| 328 // hence the constant needs to be a subtype of the annotated type) as opposed | 122 // hence the constant needs to be a subtype of the annotated type) as opposed |
| 329 // to static type analysis (which only requires that the two types be | 123 // to static type analysis (which only requires that the two types be |
| 330 // assignable). Also consider populating the "correction" field for these | 124 // assignable). Also consider populating the "correction" field for these |
| 331 // errors. | 125 // errors. |
| 332 | 126 |
| 333 /** | 127 /** |
| 334 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 128 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
| 335 * object results in an uncaught exception being thrown. | 129 * object results in an uncaught exception being thrown. |
| 336 */ | 130 */ |
| 337 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_FIELD_TYPE_MISM
ATCH = | 131 static const CheckedModeCompileTimeErrorCode |
| 132 CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH = |
| 338 const CheckedModeCompileTimeErrorCode( | 133 const CheckedModeCompileTimeErrorCode( |
| 339 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH', | 134 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH', |
| 340 "The object type '{0}' cannot be assigned to the field '{1}', which ha
s type '{2}'"); | 135 "The object type '{0}' cannot be assigned to the field '{1}', which ha
s type '{2}'"); |
| 341 | 136 |
| 342 /** | 137 /** |
| 343 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 138 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
| 344 * object results in an uncaught exception being thrown. | 139 * object results in an uncaught exception being thrown. |
| 345 */ | 140 */ |
| 346 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_PARAM_TYPE_MISM
ATCH = | 141 static const CheckedModeCompileTimeErrorCode |
| 142 CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH = |
| 347 const CheckedModeCompileTimeErrorCode( | 143 const CheckedModeCompileTimeErrorCode( |
| 348 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH', | 144 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH', |
| 349 "The object type '{0}' cannot be assigned to a parameter of type '{1}'
"); | 145 "The object type '{0}' cannot be assigned to a parameter of type '{1}'
"); |
| 350 | 146 |
| 351 /** | 147 /** |
| 352 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error | 148 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error |
| 353 * if o is not <b>null</b> and the interface of the class of <i>o</i> is not a | 149 * if o is not <b>null</b> and the interface of the class of <i>o</i> is not a |
| 354 * subtype of the static type of the field <i>v</i>. | 150 * subtype of the static type of the field <i>v</i>. |
| 355 * | 151 * |
| 356 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 152 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
| 357 * object results in an uncaught exception being thrown. | 153 * object results in an uncaught exception being thrown. |
| 358 * | 154 * |
| 359 * Parameters: | 155 * Parameters: |
| 360 * 0: the name of the type of the initializer expression | 156 * 0: the name of the type of the initializer expression |
| 361 * 1: the name of the type of the field | 157 * 1: the name of the type of the field |
| 362 */ | 158 */ |
| 363 static const CheckedModeCompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIG
NABLE = | 159 static const CheckedModeCompileTimeErrorCode |
| 160 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = |
| 364 const CheckedModeCompileTimeErrorCode( | 161 const CheckedModeCompileTimeErrorCode( |
| 365 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', | 162 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', |
| 366 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); | 163 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); |
| 367 | 164 |
| 368 /** | 165 /** |
| 369 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> | 166 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> |
| 370 * ... <i>e<sub>n</sub></i>] is evaluated as follows: | 167 * ... <i>e<sub>n</sub></i>] is evaluated as follows: |
| 371 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and | 168 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and |
| 372 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> | 169 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> |
| 373 * | 170 * |
| 374 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 171 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
| 375 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 172 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
| 376 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 173 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
| 377 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 174 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
| 378 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, | 175 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, |
| 379 * 1 <= j <= m</i>. | 176 * 1 <= j <= m</i>. |
| 380 */ | 177 */ |
| 381 static const CheckedModeCompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
= | 178 static const CheckedModeCompileTimeErrorCode |
| 382 const CheckedModeCompileTimeErrorCode('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', | 179 LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode( |
| 180 'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', |
| 383 "The element type '{0}' cannot be assigned to the list type '{1}'"); | 181 "The element type '{0}' cannot be assigned to the list type '{1}'"); |
| 384 | 182 |
| 385 /** | 183 /** |
| 386 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 184 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
| 387 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : | 185 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : |
| 388 * <i>e<sub>n</sub></i>] is evaluated as follows: | 186 * <i>e<sub>n</sub></i>] is evaluated as follows: |
| 389 * * The operator []= is invoked on <i>m</i> with first argument | 187 * * The operator []= is invoked on <i>m</i> with first argument |
| 390 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 188 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
| 391 * i <= n</i> | 189 * i <= n</i> |
| 392 * | 190 * |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 * Parameters: | 268 * Parameters: |
| 471 * 0: the name of the ambiguous element | 269 * 0: the name of the ambiguous element |
| 472 * 1: the name of the first library that the type is found | 270 * 1: the name of the first library that the type is found |
| 473 * 2: the name of the second library that the type is found | 271 * 2: the name of the second library that the type is found |
| 474 */ | 272 */ |
| 475 static const CompileTimeErrorCode AMBIGUOUS_EXPORT = | 273 static const CompileTimeErrorCode AMBIGUOUS_EXPORT = |
| 476 const CompileTimeErrorCode('AMBIGUOUS_EXPORT', | 274 const CompileTimeErrorCode('AMBIGUOUS_EXPORT', |
| 477 "The name '{0}' is defined in the libraries '{1}' and '{2}'"); | 275 "The name '{0}' is defined in the libraries '{1}' and '{2}'"); |
| 478 | 276 |
| 479 /** | 277 /** |
| 278 * 15 Metadata: The constant expression given in an annotation is type checked |
| 279 * and evaluated in the scope surrounding the declaration being annotated. |
| 280 * |
| 281 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class |
| 282 * accessible in the current scope, optionally followed by type arguments. |
| 283 * |
| 284 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, |
| 285 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, … |
| 286 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if |
| 287 * <i>T</i> is not a class accessible in the current scope, optionally |
| 288 * followed by type arguments. |
| 289 * |
| 290 * Parameters: |
| 291 * 0: the name of the non-type element |
| 292 */ |
| 293 static const CompileTimeErrorCode ANNOTATION_WITH_NON_CLASS = |
| 294 const CompileTimeErrorCode( |
| 295 'ANNOTATION_WITH_NON_CLASS', "The name '{0}' is not a class"); |
| 296 |
| 297 /** |
| 480 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does | 298 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does |
| 481 * not denote a formal parameter. | 299 * not denote a formal parameter. |
| 482 * | 300 * |
| 483 * Parameters: | 301 * Parameters: |
| 484 * 0: the name of the identifier in the argument definition test that is not a | 302 * 0: the name of the identifier in the argument definition test that is not a |
| 485 * parameter | 303 * parameter |
| 486 */ | 304 */ |
| 487 static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = | 305 static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = |
| 488 const CompileTimeErrorCode( | 306 const CompileTimeErrorCode( |
| 489 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', "'{0}' is not a parameter"); | 307 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', "'{0}' is not a parameter"); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 */ | 437 */ |
| 620 static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = | 438 static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = |
| 621 const CompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION', | 439 const CompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION', |
| 622 "'const' constructors cannot throw exceptions"); | 440 "'const' constructors cannot throw exceptions"); |
| 623 | 441 |
| 624 /** | 442 /** |
| 625 * 10.6.3 Constant Constructors: It is a compile-time error if a constant | 443 * 10.6.3 Constant Constructors: It is a compile-time error if a constant |
| 626 * constructor is declared by a class C if any instance variable declared in C | 444 * constructor is declared by a class C if any instance variable declared in C |
| 627 * is initialized with an expression that is not a constant expression. | 445 * is initialized with an expression that is not a constant expression. |
| 628 */ | 446 */ |
| 629 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_
NON_CONST = | 447 static const CompileTimeErrorCode |
| 448 CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST = |
| 630 const CompileTimeErrorCode( | 449 const CompileTimeErrorCode( |
| 631 'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST', | 450 'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST', |
| 632 "Can't define the 'const' constructor because the field '{0}' is initi
alized with a non-constant value"); | 451 "Can't define the 'const' constructor because the field '{0}' is initi
alized with a non-constant value"); |
| 633 | 452 |
| 634 /** | 453 /** |
| 635 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly | 454 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly |
| 636 * or implicitly, in the initializer list of a constant constructor must | 455 * or implicitly, in the initializer list of a constant constructor must |
| 637 * specify a constant constructor of the superclass of the immediately | 456 * specify a constant constructor of the superclass of the immediately |
| 638 * enclosing class or a compile-time error occurs. | 457 * enclosing class or a compile-time error occurs. |
| 639 * | 458 * |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 const CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', | 506 const CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', |
| 688 "'const' variables must be constant value"); | 507 "'const' variables must be constant value"); |
| 689 | 508 |
| 690 /** | 509 /** |
| 691 * 5 Variables: A constant variable must be initialized to a compile-time | 510 * 5 Variables: A constant variable must be initialized to a compile-time |
| 692 * constant or a compile-time error occurs. | 511 * constant or a compile-time error occurs. |
| 693 * | 512 * |
| 694 * 12.1 Constants: A qualified reference to a static constant variable that is | 513 * 12.1 Constants: A qualified reference to a static constant variable that is |
| 695 * not qualified by a deferred prefix. | 514 * not qualified by a deferred prefix. |
| 696 */ | 515 */ |
| 697 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FR
OM_DEFERRED_LIBRARY = | 516 static const CompileTimeErrorCode |
| 517 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY = |
| 698 const CompileTimeErrorCode( | 518 const CompileTimeErrorCode( |
| 699 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', | 519 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', |
| 700 "Constant values from a deferred library cannot be used to initialized
a 'const' variable"); | 520 "Constant values from a deferred library cannot be used to initialized
a 'const' variable"); |
| 701 | 521 |
| 702 /** | 522 /** |
| 703 * 7.5 Instance Variables: It is a compile-time error if an instance variable | 523 * 7.5 Instance Variables: It is a compile-time error if an instance variable |
| 704 * is declared to be constant. | 524 * is declared to be constant. |
| 705 */ | 525 */ |
| 706 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = | 526 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = |
| 707 const CompileTimeErrorCode('CONST_INSTANCE_FIELD', | 527 const CompileTimeErrorCode('CONST_INSTANCE_FIELD', |
| 708 "Only static fields can be declared as 'const'"); | 528 "Only static fields can be declared as 'const'"); |
| 709 | 529 |
| 710 /** | 530 /** |
| 711 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant | 531 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant |
| 712 * map literal is an instance of a class that implements the operator | 532 * map literal is an instance of a class that implements the operator |
| 713 * <i>==</i> unless the key is a string or integer. | 533 * <i>==</i> unless the key is a string or integer. |
| 714 */ | 534 */ |
| 715 static const CompileTimeErrorCode CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQU
ALS = | 535 static const CompileTimeErrorCode |
| 536 CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = |
| 716 const CompileTimeErrorCode( | 537 const CompileTimeErrorCode( |
| 717 'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', | 538 'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', |
| 718 "The constant map entry key expression type '{0}' cannot override the
== operator"); | 539 "The constant map entry key expression type '{0}' cannot override the
== operator"); |
| 719 | 540 |
| 720 /** | 541 /** |
| 721 * 5 Variables: A constant variable must be initialized to a compile-time | 542 * 5 Variables: A constant variable must be initialized to a compile-time |
| 722 * constant (12.1) or a compile-time error occurs. | 543 * constant (12.1) or a compile-time error occurs. |
| 723 * | 544 * |
| 724 * Parameters: | 545 * Parameters: |
| 725 * 0: the name of the uninitialized final variable | 546 * 0: the name of the uninitialized final variable |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 /** | 605 /** |
| 785 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, | 606 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, |
| 786 * …, U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time | 607 * …, U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time |
| 787 * error if <i>S</i> is not a generic type with <i>m</i> type parameters. | 608 * error if <i>S</i> is not a generic type with <i>m</i> type parameters. |
| 788 * | 609 * |
| 789 * Parameters: | 610 * Parameters: |
| 790 * 0: the name of the type being referenced (<i>S</i>) | 611 * 0: the name of the type being referenced (<i>S</i>) |
| 791 * 1: the number of type parameters that were declared | 612 * 1: the number of type parameters that were declared |
| 792 * 2: the number of type arguments provided | 613 * 2: the number of type arguments provided |
| 793 * | 614 * |
| 794 * See [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS], and | 615 * See [StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS], and |
| 795 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. | 616 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. |
| 796 */ | 617 */ |
| 797 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = | 618 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = |
| 798 const CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', | 619 const CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', |
| 799 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); | 620 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); |
| 800 | 621 |
| 801 /** | 622 /** |
| 802 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, | 623 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, |
| 803 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, | 624 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, |
| 804 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if the | 625 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if the |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 * function type. | 702 * function type. |
| 882 */ | 703 */ |
| 883 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = | 704 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = |
| 884 const CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', | 705 const CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', |
| 885 "Default values aren't allowed in function type parameters"); | 706 "Default values aren't allowed in function type parameters"); |
| 886 | 707 |
| 887 /** | 708 /** |
| 888 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly | 709 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly |
| 889 * specifies a default value for an optional parameter. | 710 * specifies a default value for an optional parameter. |
| 890 */ | 711 */ |
| 891 static const CompileTimeErrorCode DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRU
CTOR = | 712 static const CompileTimeErrorCode |
| 713 DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR = |
| 892 const CompileTimeErrorCode( | 714 const CompileTimeErrorCode( |
| 893 'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR', | 715 'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR', |
| 894 "Default values aren't allowed in factory constructors that redirect t
o another constructor"); | 716 "Default values aren't allowed in factory constructors that redirect t
o another constructor"); |
| 895 | 717 |
| 896 /** | 718 /** |
| 897 * 3.1 Scoping: It is a compile-time error if there is more than one entity | 719 * 3.1 Scoping: It is a compile-time error if there is more than one entity |
| 898 * with the same name declared in the same scope. | 720 * with the same name declared in the same scope. |
| 899 */ | 721 */ |
| 900 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = | 722 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = |
| 901 const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT', | 723 const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT', |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 * Parameters: | 853 * Parameters: |
| 1032 * 0: the name of the type that cannot be extended | 854 * 0: the name of the type that cannot be extended |
| 1033 * | 855 * |
| 1034 * See [IMPLEMENTS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. | 856 * See [IMPLEMENTS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. |
| 1035 */ | 857 */ |
| 1036 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = | 858 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = |
| 1037 const CompileTimeErrorCode('EXTENDS_DEFERRED_CLASS', | 859 const CompileTimeErrorCode('EXTENDS_DEFERRED_CLASS', |
| 1038 "This class cannot extend the deferred class '{0}'"); | 860 "This class cannot extend the deferred class '{0}'"); |
| 1039 | 861 |
| 1040 /** | 862 /** |
| 863 * DEP 37 extends the syntax for assert() to allow a second "message" |
| 864 * argument. We issue this error if the user tries to supply a "message" |
| 865 * argument but the DEP is not enabled. |
| 866 */ |
| 867 static const CompileTimeErrorCode EXTRA_ARGUMENT_TO_ASSERT = |
| 868 const CompileTimeErrorCode('EXTRA_ARGUMENT_TO_ASSERT', |
| 869 "Assertions only accept a single argument"); |
| 870 |
| 871 /** |
| 1041 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < | 872 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < |
| 1042 * h</i> or if <i>m > n</i>. | 873 * h</i> or if <i>m > n</i>. |
| 1043 * | 874 * |
| 1044 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 875 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
| 1045 * object results in an uncaught exception being thrown. | 876 * object results in an uncaught exception being thrown. |
| 1046 * | 877 * |
| 1047 * Parameters: | 878 * Parameters: |
| 1048 * 0: the maximum number of positional arguments | 879 * 0: the maximum number of positional arguments |
| 1049 * 1: the actual number of positional arguments given | 880 * 1: the actual number of positional arguments given |
| 1050 */ | 881 */ |
| 1051 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = | 882 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = |
| 1052 const CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS', | 883 const CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS', |
| 1053 "{0} positional arguments expected, but {1} found"); | 884 "{0} positional arguments expected, but {1} found"); |
| 1054 | 885 |
| 1055 /** | 886 /** |
| 1056 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 887 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
| 1057 * is a compile time error if more than one initializer corresponding to a | 888 * is a compile time error if more than one initializer corresponding to a |
| 1058 * given instance variable appears in <i>k</i>'s list. | 889 * given instance variable appears in <i>k</i>'s list. |
| 1059 */ | 890 */ |
| 1060 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = | 891 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = |
| 1061 const CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', | 892 const CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', |
| 1062 "The field '{0}' cannot be initialized twice in the same constructor")
; | 893 "The field '{0}' cannot be initialized twice in the same constructor")
; |
| 1063 | 894 |
| 1064 /** | 895 /** |
| 1065 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 896 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
| 1066 * is a compile time error if <i>k</i>'s initializer list contains an | 897 * is a compile time error if <i>k</i>'s initializer list contains an |
| 1067 * initializer for a variable that is initialized by means of an initializing | 898 * initializer for a variable that is initialized by means of an initializing |
| 1068 * formal of <i>k</i>. | 899 * formal of <i>k</i>. |
| 1069 */ | 900 */ |
| 1070 static const CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZ
ER = | 901 static const CompileTimeErrorCode |
| 902 FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = |
| 1071 const CompileTimeErrorCode( | 903 const CompileTimeErrorCode( |
| 1072 'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', | 904 'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', |
| 1073 "Fields cannot be initialized in both the parameter list and the initi
alizers"); | 905 "Fields cannot be initialized in both the parameter list and the initi
alizers"); |
| 1074 | 906 |
| 1075 /** | 907 /** |
| 1076 * 5 Variables: It is a compile-time error if a final instance variable that | 908 * 5 Variables: It is a compile-time error if a final instance variable that |
| 1077 * has is initialized by means of an initializing formal of a constructor is | 909 * has is initialized by means of an initializing formal of a constructor is |
| 1078 * also initialized elsewhere in the same constructor. | 910 * also initialized elsewhere in the same constructor. |
| 1079 * | 911 * |
| 1080 * Parameters: | 912 * Parameters: |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 "List literals must be prefixed with 'const' when used as a constant e
xpression"); | 1373 "List literals must be prefixed with 'const' when used as a constant e
xpression"); |
| 1542 | 1374 |
| 1543 /** | 1375 /** |
| 1544 * 12.1 Constants: A constant expression is ... a constant map literal. | 1376 * 12.1 Constants: A constant expression is ... a constant map literal. |
| 1545 */ | 1377 */ |
| 1546 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = | 1378 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = |
| 1547 const CompileTimeErrorCode('MISSING_CONST_IN_MAP_LITERAL', | 1379 const CompileTimeErrorCode('MISSING_CONST_IN_MAP_LITERAL', |
| 1548 "Map literals must be prefixed with 'const' when used as a constant ex
pression"); | 1380 "Map literals must be prefixed with 'const' when used as a constant ex
pression"); |
| 1549 | 1381 |
| 1550 /** | 1382 /** |
| 1551 * Enum proposal: It is a static warning if all of the following conditions | |
| 1552 * hold: | |
| 1553 * * The switch statement does not have a 'default' clause. | |
| 1554 * * The static type of <i>e</i> is an enumerated typed with elements | |
| 1555 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. | |
| 1556 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and | |
| 1557 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the | |
| 1558 * same. | |
| 1559 * | |
| 1560 * Parameters: | |
| 1561 * 0: the name of the constant that is missing | |
| 1562 */ | |
| 1563 static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH = | |
| 1564 const CompileTimeErrorCode( | |
| 1565 'MISSING_ENUM_CONSTANT_IN_SWITCH', | |
| 1566 "Missing case clause for '{0}'", | |
| 1567 "Add a case clause for the missing constant or add a default clause.")
; | |
| 1568 | |
| 1569 /** | |
| 1570 * 9 Mixins: It is a compile-time error if a declared or derived mixin | 1383 * 9 Mixins: It is a compile-time error if a declared or derived mixin |
| 1571 * explicitly declares a constructor. | 1384 * explicitly declares a constructor. |
| 1572 * | 1385 * |
| 1573 * Parameters: | 1386 * Parameters: |
| 1574 * 0: the name of the mixin that is invalid | 1387 * 0: the name of the mixin that is invalid |
| 1575 */ | 1388 */ |
| 1576 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = | 1389 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = |
| 1577 const CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', | 1390 const CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', |
| 1578 "The class '{0}' cannot be used as a mixin because it declares a const
ructor"); | 1391 "The class '{0}' cannot be used as a mixin because it declares a const
ructor"); |
| 1579 | 1392 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 * denote a class available in the immediately enclosing scope. | 1483 * denote a class available in the immediately enclosing scope. |
| 1671 */ | 1484 */ |
| 1672 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = | 1485 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = |
| 1673 const CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', | 1486 const CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', |
| 1674 "Mixin can only be applied to class"); | 1487 "Mixin can only be applied to class"); |
| 1675 | 1488 |
| 1676 /** | 1489 /** |
| 1677 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 1490 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
| 1678 * in which case its only action is to invoke another generative constructor. | 1491 * in which case its only action is to invoke another generative constructor. |
| 1679 */ | 1492 */ |
| 1680 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS
= | 1493 static const CompileTimeErrorCode |
| 1681 const CompileTimeErrorCode('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', | 1494 MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = const CompileTimeErrorCode( |
| 1495 'MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', |
| 1682 "Constructor may have at most one 'this' redirection"); | 1496 "Constructor may have at most one 'this' redirection"); |
| 1683 | 1497 |
| 1684 /** | 1498 /** |
| 1685 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. | 1499 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. |
| 1686 * Then <i>k</i> may include at most one superinitializer in its initializer | 1500 * Then <i>k</i> may include at most one superinitializer in its initializer |
| 1687 * list or a compile time error occurs. | 1501 * list or a compile time error occurs. |
| 1688 */ | 1502 */ |
| 1689 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = | 1503 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = |
| 1690 const CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', | 1504 const CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', |
| 1691 "Constructor may have at most one 'super' initializer"); | 1505 "Constructor may have at most one 'super' initializer"); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form | 1572 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form |
| 1759 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case | 1573 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case |
| 1760 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … | 1574 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … |
| 1761 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a | 1575 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a |
| 1762 * compile-time error if the expressions <i>e<sub>k</sub></i> are not | 1576 * compile-time error if the expressions <i>e<sub>k</sub></i> are not |
| 1763 * compile-time constants, for all <i>1 <= k <= n</i>. | 1577 * compile-time constants, for all <i>1 <= k <= n</i>. |
| 1764 * | 1578 * |
| 1765 * 12.1 Constants: A qualified reference to a static constant variable that is | 1579 * 12.1 Constants: A qualified reference to a static constant variable that is |
| 1766 * not qualified by a deferred prefix. | 1580 * not qualified by a deferred prefix. |
| 1767 */ | 1581 */ |
| 1768 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_L
IBRARY = | 1582 static const CompileTimeErrorCode |
| 1583 NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY = |
| 1769 const CompileTimeErrorCode( | 1584 const CompileTimeErrorCode( |
| 1770 'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY', | 1585 'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY', |
| 1771 "Constant values from a deferred library cannot be used as a case expr
ession"); | 1586 "Constant values from a deferred library cannot be used as a case expr
ession"); |
| 1772 | 1587 |
| 1773 /** | 1588 /** |
| 1774 * 6.2.2 Optional Formals: It is a compile-time error if the default value of | 1589 * 6.2.2 Optional Formals: It is a compile-time error if the default value of |
| 1775 * an optional parameter is not a compile-time constant. | 1590 * an optional parameter is not a compile-time constant. |
| 1776 */ | 1591 */ |
| 1777 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = | 1592 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = |
| 1778 const CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', | 1593 const CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', |
| 1779 "Default values of an optional parameter must be constant"); | 1594 "Default values of an optional parameter must be constant"); |
| 1780 | 1595 |
| 1781 /** | 1596 /** |
| 1782 * 6.2.2 Optional Formals: It is a compile-time error if the default value of | 1597 * 6.2.2 Optional Formals: It is a compile-time error if the default value of |
| 1783 * an optional parameter is not a compile-time constant. | 1598 * an optional parameter is not a compile-time constant. |
| 1784 * | 1599 * |
| 1785 * 12.1 Constants: A qualified reference to a static constant variable that is | 1600 * 12.1 Constants: A qualified reference to a static constant variable that is |
| 1786 * not qualified by a deferred prefix. | 1601 * not qualified by a deferred prefix. |
| 1787 */ | 1602 */ |
| 1788 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIB
RARY = | 1603 static const CompileTimeErrorCode |
| 1604 NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY = |
| 1789 const CompileTimeErrorCode( | 1605 const CompileTimeErrorCode( |
| 1790 'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY', | 1606 'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY', |
| 1791 "Constant values from a deferred library cannot be used as a default p
arameter value"); | 1607 "Constant values from a deferred library cannot be used as a default p
arameter value"); |
| 1792 | 1608 |
| 1793 /** | 1609 /** |
| 1794 * 12.6 Lists: It is a compile time error if an element of a constant list | 1610 * 12.6 Lists: It is a compile time error if an element of a constant list |
| 1795 * literal is not a compile-time constant. | 1611 * literal is not a compile-time constant. |
| 1796 */ | 1612 */ |
| 1797 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = | 1613 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = |
| 1798 const CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', | 1614 const CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', |
| 1799 "'const' lists must have all constant values"); | 1615 "'const' lists must have all constant values"); |
| 1800 | 1616 |
| 1801 /** | 1617 /** |
| 1802 * 12.6 Lists: It is a compile time error if an element of a constant list | 1618 * 12.6 Lists: It is a compile time error if an element of a constant list |
| 1803 * literal is not a compile-time constant. | 1619 * literal is not a compile-time constant. |
| 1804 * | 1620 * |
| 1805 * 12.1 Constants: A qualified reference to a static constant variable that is | 1621 * 12.1 Constants: A qualified reference to a static constant variable that is |
| 1806 * not qualified by a deferred prefix. | 1622 * not qualified by a deferred prefix. |
| 1807 */ | 1623 */ |
| 1808 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBR
ARY = | 1624 static const CompileTimeErrorCode |
| 1625 NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY = |
| 1809 const CompileTimeErrorCode( | 1626 const CompileTimeErrorCode( |
| 1810 'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY', | 1627 'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY', |
| 1811 "Constant values from a deferred library cannot be used as values in a
'const' list"); | 1628 "Constant values from a deferred library cannot be used as values in a
'const' list"); |
| 1812 | 1629 |
| 1813 /** | 1630 /** |
| 1814 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1631 * 12.7 Maps: It is a compile time error if either a key or a value of an |
| 1815 * entry in a constant map literal is not a compile-time constant. | 1632 * entry in a constant map literal is not a compile-time constant. |
| 1816 */ | 1633 */ |
| 1817 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = | 1634 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = |
| 1818 const CompileTimeErrorCode( | 1635 const CompileTimeErrorCode( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1837 const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', | 1654 const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', |
| 1838 "The values in a 'const' map must be constant"); | 1655 "The values in a 'const' map must be constant"); |
| 1839 | 1656 |
| 1840 /** | 1657 /** |
| 1841 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1658 * 12.7 Maps: It is a compile time error if either a key or a value of an |
| 1842 * entry in a constant map literal is not a compile-time constant. | 1659 * entry in a constant map literal is not a compile-time constant. |
| 1843 * | 1660 * |
| 1844 * 12.1 Constants: A qualified reference to a static constant variable that is | 1661 * 12.1 Constants: A qualified reference to a static constant variable that is |
| 1845 * not qualified by a deferred prefix. | 1662 * not qualified by a deferred prefix. |
| 1846 */ | 1663 */ |
| 1847 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY
= | 1664 static const CompileTimeErrorCode |
| 1848 const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY', | 1665 NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY = const CompileTimeErrorCode( |
| 1666 'NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY', |
| 1849 "Constant values from a deferred library cannot be used as values in a
'const' map"); | 1667 "Constant values from a deferred library cannot be used as values in a
'const' map"); |
| 1850 | 1668 |
| 1851 /** | 1669 /** |
| 1852 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1670 * 11 Metadata: Metadata consists of a series of annotations, each of which |
| 1853 * begin with the character @, followed by a constant expression that must be | 1671 * begin with the character @, followed by a constant expression that must be |
| 1854 * either a reference to a compile-time constant variable, or a call to a | 1672 * either a reference to a compile-time constant variable, or a call to a |
| 1855 * constant constructor. | 1673 * constant constructor. |
| 1856 * | 1674 * |
| 1857 * "From deferred library" case is covered by | 1675 * "From deferred library" case is covered by |
| 1858 * [CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY]. | 1676 * [CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY]. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1871 "Initializer expressions in constant constructors must be constants"); | 1689 "Initializer expressions in constant constructors must be constants"); |
| 1872 | 1690 |
| 1873 /** | 1691 /** |
| 1874 * 7.6.3 Constant Constructors: Any expression that appears within the | 1692 * 7.6.3 Constant Constructors: Any expression that appears within the |
| 1875 * initializer list of a constant constructor must be a potentially constant | 1693 * initializer list of a constant constructor must be a potentially constant |
| 1876 * expression, or a compile-time error occurs. | 1694 * expression, or a compile-time error occurs. |
| 1877 * | 1695 * |
| 1878 * 12.1 Constants: A qualified reference to a static constant variable that is | 1696 * 12.1 Constants: A qualified reference to a static constant variable that is |
| 1879 * not qualified by a deferred prefix. | 1697 * not qualified by a deferred prefix. |
| 1880 */ | 1698 */ |
| 1881 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFER
RED_LIBRARY = | 1699 static const CompileTimeErrorCode |
| 1700 NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY = |
| 1882 const CompileTimeErrorCode( | 1701 const CompileTimeErrorCode( |
| 1883 'NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY', | 1702 'NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY', |
| 1884 "Constant values from a deferred library cannot be used as constant in
itializers"); | 1703 "Constant values from a deferred library cannot be used as constant in
itializers"); |
| 1885 | 1704 |
| 1886 /** | 1705 /** |
| 1887 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> | 1706 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> |
| 1888 * or if <i>m > n</i>. | 1707 * or if <i>m > n</i>. |
| 1889 * | 1708 * |
| 1890 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 1709 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
| 1891 * object results in an uncaught exception being thrown. | 1710 * object results in an uncaught exception being thrown. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 * | 1833 * |
| 2015 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 1834 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
| 2016 * superinterface of itself. | 1835 * superinterface of itself. |
| 2017 * | 1836 * |
| 2018 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 1837 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
| 2019 * superclass of itself. | 1838 * superclass of itself. |
| 2020 * | 1839 * |
| 2021 * Parameters: | 1840 * Parameters: |
| 2022 * 0: the name of the class that implements itself recursively | 1841 * 0: the name of the class that implements itself recursively |
| 2023 */ | 1842 */ |
| 2024 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EX
TENDS = | 1843 static const CompileTimeErrorCode |
| 1844 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS = |
| 2025 const CompileTimeErrorCode( | 1845 const CompileTimeErrorCode( |
| 2026 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', | 1846 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', |
| 2027 "'{0}' cannot extend itself"); | 1847 "'{0}' cannot extend itself"); |
| 2028 | 1848 |
| 2029 /** | 1849 /** |
| 2030 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 1850 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
| 2031 * class <i>C</i> is a superinterface of itself. | 1851 * class <i>C</i> is a superinterface of itself. |
| 2032 * | 1852 * |
| 2033 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 1853 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
| 2034 * superinterface of itself. | 1854 * superinterface of itself. |
| 2035 * | 1855 * |
| 2036 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 1856 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
| 2037 * superclass of itself. | 1857 * superclass of itself. |
| 2038 * | 1858 * |
| 2039 * Parameters: | 1859 * Parameters: |
| 2040 * 0: the name of the class that implements itself recursively | 1860 * 0: the name of the class that implements itself recursively |
| 2041 */ | 1861 */ |
| 2042 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IM
PLEMENTS = | 1862 static const CompileTimeErrorCode |
| 1863 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS = |
| 2043 const CompileTimeErrorCode( | 1864 const CompileTimeErrorCode( |
| 2044 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', | 1865 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', |
| 2045 "'{0}' cannot implement itself"); | 1866 "'{0}' cannot implement itself"); |
| 2046 | 1867 |
| 2047 /** | 1868 /** |
| 2048 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 1869 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
| 2049 * class <i>C</i> is a superinterface of itself. | 1870 * class <i>C</i> is a superinterface of itself. |
| 2050 * | 1871 * |
| 2051 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 1872 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
| 2052 * superinterface of itself. | 1873 * superinterface of itself. |
| 2053 * | 1874 * |
| 2054 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 1875 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
| 2055 * superclass of itself. | 1876 * superclass of itself. |
| 2056 * | 1877 * |
| 2057 * Parameters: | 1878 * Parameters: |
| 2058 * 0: the name of the class that implements itself recursively | 1879 * 0: the name of the class that implements itself recursively |
| 2059 */ | 1880 */ |
| 2060 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WI
TH = | 1881 static const CompileTimeErrorCode |
| 1882 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH = |
| 2061 const CompileTimeErrorCode( | 1883 const CompileTimeErrorCode( |
| 2062 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH', | 1884 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH', |
| 2063 "'{0}' cannot use itself as a mixin"); | 1885 "'{0}' cannot use itself as a mixin"); |
| 2064 | 1886 |
| 2065 /** | 1887 /** |
| 2066 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with | 1888 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with |
| 2067 * the const modifier but <i>k'</i> is not a constant constructor. | 1889 * the const modifier but <i>k'</i> is not a constant constructor. |
| 2068 */ | 1890 */ |
| 2069 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = | 1891 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = |
| 2070 const CompileTimeErrorCode('REDIRECT_TO_MISSING_CONSTRUCTOR', | 1892 const CompileTimeErrorCode('REDIRECT_TO_MISSING_CONSTRUCTOR', |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2093 */ | 1915 */ |
| 2094 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR = | 1916 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR = |
| 2095 const CompileTimeErrorCode('REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR', | 1917 const CompileTimeErrorCode('REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR', |
| 2096 "The constructor '{0}' could not be found in '{1}'"); | 1918 "The constructor '{0}' could not be found in '{1}'"); |
| 2097 | 1919 |
| 2098 /** | 1920 /** |
| 2099 * 7.6.1 Generative constructors: A generative constructor may be | 1921 * 7.6.1 Generative constructors: A generative constructor may be |
| 2100 * <i>redirecting</i>, in which case its only action is to invoke another | 1922 * <i>redirecting</i>, in which case its only action is to invoke another |
| 2101 * generative constructor. | 1923 * generative constructor. |
| 2102 */ | 1924 */ |
| 2103 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTR
UCTOR = | 1925 static const CompileTimeErrorCode |
| 1926 REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR = |
| 2104 const CompileTimeErrorCode( | 1927 const CompileTimeErrorCode( |
| 2105 'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR', | 1928 'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR', |
| 2106 "Generative constructor cannot redirect to a factory constructor"); | 1929 "Generative constructor cannot redirect to a factory constructor"); |
| 2107 | 1930 |
| 2108 /** | 1931 /** |
| 2109 * 5 Variables: A local variable may only be referenced at a source code | 1932 * 5 Variables: A local variable may only be referenced at a source code |
| 2110 * location that is after its initializer, if any, is complete, or a | 1933 * location that is after its initializer, if any, is complete, or a |
| 2111 * compile-time error occurs. | 1934 * compile-time error occurs. |
| 2112 */ | 1935 */ |
| 2113 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = | 1936 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = |
| 2114 const CompileTimeErrorCode('REFERENCED_BEFORE_DECLARATION', | 1937 const CompileTimeErrorCode('REFERENCED_BEFORE_DECLARATION', |
| 2115 "Local variables cannot be referenced before they are declared"); | 1938 "Local variable '{0}' cannot be referenced before it is declared"); |
| 2116 | 1939 |
| 2117 /** | 1940 /** |
| 2118 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form | 1941 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form |
| 2119 * <i>rethrow;</i> is not enclosed within a on-catch clause. | 1942 * <i>rethrow;</i> is not enclosed within a on-catch clause. |
| 2120 */ | 1943 */ |
| 2121 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = | 1944 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = |
| 2122 const CompileTimeErrorCode( | 1945 const CompileTimeErrorCode( |
| 2123 'RETHROW_OUTSIDE_CATCH', "rethrow must be inside of a catch clause"); | 1946 'RETHROW_OUTSIDE_CATCH', |
| 1947 "Rethrow must be inside of catch clause.", |
| 1948 "Try moving the expression into a catch clause, or using a 'throw' exp
ression."); |
| 2124 | 1949 |
| 2125 /** | 1950 /** |
| 2126 * 13.12 Return: It is a compile-time error if a return statement of the form | 1951 * 13.12 Return: It is a compile-time error if a return statement of the form |
| 2127 * <i>return e;</i> appears in a generative constructor. | 1952 * <i>return e;</i> appears in a generative constructor. |
| 2128 */ | 1953 */ |
| 2129 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = | 1954 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = |
| 2130 const CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', | 1955 const CompileTimeErrorCode( |
| 2131 "Constructors cannot return a value"); | 1956 'RETURN_IN_GENERATIVE_CONSTRUCTOR', |
| 1957 "Constructors can't return values.", |
| 1958 "Try removing the return statement or using a factory constructor."); |
| 2132 | 1959 |
| 2133 /** | 1960 /** |
| 2134 * 13.12 Return: It is a compile-time error if a return statement of the form | 1961 * 13.12 Return: It is a compile-time error if a return statement of the form |
| 2135 * <i>return e;</i> appears in a generator function. | 1962 * <i>return e;</i> appears in a generator function. |
| 2136 */ | 1963 */ |
| 2137 static const CompileTimeErrorCode RETURN_IN_GENERATOR = | 1964 static const CompileTimeErrorCode RETURN_IN_GENERATOR = const CompileTimeError
Code( |
| 2138 const CompileTimeErrorCode('RETURN_IN_GENERATOR', | 1965 'RETURN_IN_GENERATOR', |
| 2139 "Cannot return a value from a generator function (one marked with eith
er 'async*' or 'sync*')"); | 1966 "Can't return a value from a generator function (using the '{0}' modifier)
.", |
| 1967 "Try removing the value, replacing 'return' with 'yield' or changing the m
ethod body modifier."); |
| 2140 | 1968 |
| 2141 /** | 1969 /** |
| 2142 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred | 1970 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred |
| 2143 * import is used in another import clause. | 1971 * import is used in another import clause. |
| 2144 */ | 1972 */ |
| 2145 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = | 1973 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = |
| 2146 const CompileTimeErrorCode('SHARED_DEFERRED_PREFIX', | 1974 const CompileTimeErrorCode('SHARED_DEFERRED_PREFIX', |
| 2147 "The prefix of a deferred import cannot be used in other import direct
ives"); | 1975 "The prefix of a deferred import cannot be used in other import direct
ives"); |
| 2148 | 1976 |
| 2149 /** | 1977 /** |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2224 const CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', | 2052 const CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', |
| 2225 "The class '{0}' does not have a generative constructor '{1}'"); | 2053 "The class '{0}' does not have a generative constructor '{1}'"); |
| 2226 | 2054 |
| 2227 /** | 2055 /** |
| 2228 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the | 2056 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the |
| 2229 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. | 2057 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. |
| 2230 * Let <i>k</i> be a generative constructor. It is a compile-time error if | 2058 * Let <i>k</i> be a generative constructor. It is a compile-time error if |
| 2231 * class <i>S</i> does not declare a generative constructor named <i>S</i> | 2059 * class <i>S</i> does not declare a generative constructor named <i>S</i> |
| 2232 * (respectively <i>S.id</i>) | 2060 * (respectively <i>S.id</i>) |
| 2233 */ | 2061 */ |
| 2234 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT
= | 2062 static const CompileTimeErrorCode |
| 2235 const CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', | 2063 UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = const CompileTimeErrorCode( |
| 2064 'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', |
| 2236 "The class '{0}' does not have a default generative constructor"); | 2065 "The class '{0}' does not have a default generative constructor"); |
| 2237 | 2066 |
| 2238 /** | 2067 /** |
| 2239 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, | 2068 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, |
| 2240 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set | 2069 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set |
| 2241 * {<i>p<sub>n+1</sub></i> ... <i>p<sub>n+k</sub></i>} or a static warning | 2070 * {<i>p<sub>n+1</sub></i> ... <i>p<sub>n+k</sub></i>} or a static warning |
| 2242 * occurs. | 2071 * occurs. |
| 2243 * | 2072 * |
| 2244 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 2073 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
| 2245 * object results in an uncaught exception being thrown. | 2074 * object results in an uncaught exception being thrown. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2257 * | 2086 * |
| 2258 * 14.1 Imports: It is a compile-time error if the compilation unit found at | 2087 * 14.1 Imports: It is a compile-time error if the compilation unit found at |
| 2259 * the specified URI is not a library declaration. | 2088 * the specified URI is not a library declaration. |
| 2260 * | 2089 * |
| 2261 * 14.3 Parts: It is a compile time error if the contents of the URI are not a | 2090 * 14.3 Parts: It is a compile time error if the contents of the URI are not a |
| 2262 * valid part declaration. | 2091 * valid part declaration. |
| 2263 * | 2092 * |
| 2264 * Parameters: | 2093 * Parameters: |
| 2265 * 0: the URI pointing to a non-existent file | 2094 * 0: the URI pointing to a non-existent file |
| 2266 * | 2095 * |
| 2267 * See [INVALID_URI]. | 2096 * See [INVALID_URI], [URI_HAS_NOT_BEEN_GENERATED]. |
| 2268 */ | 2097 */ |
| 2269 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = | 2098 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = |
| 2270 const CompileTimeErrorCode( | 2099 const CompileTimeErrorCode( |
| 2271 'URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0}'"); | 2100 'URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0}'"); |
| 2272 | 2101 |
| 2273 /** | 2102 /** |
| 2103 * Just like [URI_DOES_NOT_EXIST], but used when the URI refers to a file that |
| 2104 * is expected to be generated. |
| 2105 * |
| 2106 * Parameters: |
| 2107 * 0: the URI pointing to a non-existent file |
| 2108 * |
| 2109 * See [INVALID_URI], [URI_DOES_NOT_EXIST]. |
| 2110 */ |
| 2111 static const CompileTimeErrorCode URI_HAS_NOT_BEEN_GENERATED = |
| 2112 const CompileTimeErrorCode('URI_HAS_NOT_BEEN_GENERATED', |
| 2113 "Target of URI has not been generated: '{0}'"); |
| 2114 |
| 2115 /** |
| 2274 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time | 2116 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time |
| 2275 * constant, or if <i>x</i> involves string interpolation. | 2117 * constant, or if <i>x</i> involves string interpolation. |
| 2276 * | 2118 * |
| 2277 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time | 2119 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time |
| 2278 * constant, or if <i>s</i> involves string interpolation. | 2120 * constant, or if <i>s</i> involves string interpolation. |
| 2279 * | 2121 * |
| 2280 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that | 2122 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that |
| 2281 * describes a URI is not a compile-time constant, or if <i>x</i> involves | 2123 * describes a URI is not a compile-time constant, or if <i>x</i> involves |
| 2282 * string interpolation. | 2124 * string interpolation. |
| 2283 */ | 2125 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2303 const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', | 2145 const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', |
| 2304 "Operator '{0}' should declare exactly {1} parameter(s), but {2} found
"); | 2146 "Operator '{0}' should declare exactly {1} parameter(s), but {2} found
"); |
| 2305 | 2147 |
| 2306 /** | 2148 /** |
| 2307 * 7.1.1 Operators: It is a compile time error if the arity of the | 2149 * 7.1.1 Operators: It is a compile time error if the arity of the |
| 2308 * user-declared operator - is not 0 or 1. | 2150 * user-declared operator - is not 0 or 1. |
| 2309 * | 2151 * |
| 2310 * Parameters: | 2152 * Parameters: |
| 2311 * 0: the number of parameters found in the operator declaration | 2153 * 0: the number of parameters found in the operator declaration |
| 2312 */ | 2154 */ |
| 2313 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINU
S = | 2155 static const CompileTimeErrorCode |
| 2156 WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS = |
| 2314 const CompileTimeErrorCode( | 2157 const CompileTimeErrorCode( |
| 2315 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS', | 2158 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS', |
| 2316 "Operator '-' should declare 0 or 1 parameter, but {0} found"); | 2159 "Operator '-' should declare 0 or 1 parameter, but {0} found"); |
| 2317 | 2160 |
| 2318 /** | 2161 /** |
| 2319 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list | 2162 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list |
| 2320 * does not include exactly one required formal parameter <i>p</i>. | 2163 * does not include exactly one required formal parameter <i>p</i>. |
| 2321 */ | 2164 */ |
| 2322 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = | 2165 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = |
| 2323 const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', | 2166 const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2349 : super(name, message, correction); | 2192 : super(name, message, correction); |
| 2350 | 2193 |
| 2351 @override | 2194 @override |
| 2352 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity; | 2195 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity; |
| 2353 | 2196 |
| 2354 @override | 2197 @override |
| 2355 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; | 2198 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 2356 } | 2199 } |
| 2357 | 2200 |
| 2358 /** | 2201 /** |
| 2359 * An error listener that can be enabled or disabled while executing a function. | |
| 2360 */ | |
| 2361 class DisablableErrorListener implements AnalysisErrorListener { | |
| 2362 /** | |
| 2363 * The listener to which errors will be reported if this listener is enabled. | |
| 2364 */ | |
| 2365 final AnalysisErrorListener baseListener; | |
| 2366 | |
| 2367 /** | |
| 2368 * A flag indicating whether this listener is currently enabled. | |
| 2369 */ | |
| 2370 bool enabled = true; | |
| 2371 | |
| 2372 /** | |
| 2373 * Initialize a newly created listener to report errors to the given | |
| 2374 * [baseListener]. | |
| 2375 */ | |
| 2376 DisablableErrorListener(this.baseListener); | |
| 2377 | |
| 2378 /** | |
| 2379 * Disable the processing of errors while evaluating the given [function]. | |
| 2380 * Return the value returned by the function. | |
| 2381 */ | |
| 2382 dynamic disableWhile(dynamic function()) { | |
| 2383 bool wasEnabled = enabled; | |
| 2384 try { | |
| 2385 enabled = false; | |
| 2386 return function(); | |
| 2387 } finally { | |
| 2388 enabled = wasEnabled; | |
| 2389 } | |
| 2390 } | |
| 2391 | |
| 2392 /** | |
| 2393 * Disable the processing of errors while evaluating the given [function]. | |
| 2394 * Return the value returned by the function. | |
| 2395 */ | |
| 2396 dynamic enableWhile(dynamic function()) { | |
| 2397 bool wasEnabled = enabled; | |
| 2398 try { | |
| 2399 enabled = true; | |
| 2400 return function(); | |
| 2401 } finally { | |
| 2402 enabled = wasEnabled; | |
| 2403 } | |
| 2404 } | |
| 2405 | |
| 2406 @override | |
| 2407 void onError(AnalysisError error) { | |
| 2408 if (enabled) { | |
| 2409 baseListener.onError(error); | |
| 2410 } | |
| 2411 } | |
| 2412 } | |
| 2413 | |
| 2414 /** | |
| 2415 * An error code associated with an [AnalysisError]. | |
| 2416 * | |
| 2417 * Generally, we want to provide messages that consist of three sentences. From | |
| 2418 * the user's perspective these sentences should explain: | |
| 2419 * 1. what is wrong, | |
| 2420 * 2. why is it wrong, and | |
| 2421 * 3. how do I fix it. | |
| 2422 * However, we combine the first two in the [message] and the last in the | |
| 2423 * [correction]. | |
| 2424 */ | |
| 2425 abstract class ErrorCode { | |
| 2426 /** | |
| 2427 * An empty list of error codes. | |
| 2428 */ | |
| 2429 static const List<ErrorCode> EMPTY_LIST = const <ErrorCode>[]; | |
| 2430 | |
| 2431 /** | |
| 2432 * The name of the error code. | |
| 2433 */ | |
| 2434 final String name; | |
| 2435 | |
| 2436 /** | |
| 2437 * The template used to create the message to be displayed for this error. The | |
| 2438 * message should indicate what is wrong and why it is wrong. | |
| 2439 */ | |
| 2440 final String message; | |
| 2441 | |
| 2442 /** | |
| 2443 * The template used to create the correction to be displayed for this error, | |
| 2444 * or `null` if there is no correction information for this error. The | |
| 2445 * correction should indicate how the user can fix the error. | |
| 2446 */ | |
| 2447 final String correction; | |
| 2448 | |
| 2449 /** | |
| 2450 * Initialize a newly created error code to have the given [name]. The message | |
| 2451 * associated with the error will be created from the given [message] | |
| 2452 * template. The correction associated with the error will be created from the | |
| 2453 * given [correction] template. | |
| 2454 */ | |
| 2455 const ErrorCode(this.name, this.message, [this.correction]); | |
| 2456 | |
| 2457 /** | |
| 2458 * The severity of the error. | |
| 2459 */ | |
| 2460 ErrorSeverity get errorSeverity; | |
| 2461 | |
| 2462 /** | |
| 2463 * The type of the error. | |
| 2464 */ | |
| 2465 ErrorType get type; | |
| 2466 | |
| 2467 /** | |
| 2468 * The unique name of this error code. | |
| 2469 */ | |
| 2470 String get uniqueName => "$runtimeType.$name"; | |
| 2471 } | |
| 2472 | |
| 2473 /** | |
| 2474 * The properties that can be associated with an [AnalysisError]. | |
| 2475 */ | |
| 2476 class ErrorProperty extends Enum<ErrorProperty> { | |
| 2477 /** | |
| 2478 * A property whose value is a list of [FieldElement]s that are final, but | |
| 2479 * not initialized by a constructor. | |
| 2480 */ | |
| 2481 static const ErrorProperty NOT_INITIALIZED_FIELDS = | |
| 2482 const ErrorProperty('NOT_INITIALIZED_FIELDS', 0); | |
| 2483 | |
| 2484 /** | |
| 2485 * A property whose value is the name of the library that is used by all | |
| 2486 * of the "part of" directives, so should be used in the "library" directive. | |
| 2487 * Is `null` if there is no a single name used by all of the parts. | |
| 2488 */ | |
| 2489 static const ErrorProperty PARTS_LIBRARY_NAME = | |
| 2490 const ErrorProperty('PARTS_LIBRARY_NAME', 1); | |
| 2491 | |
| 2492 /** | |
| 2493 * A property whose value is a list of [ExecutableElement] that should | |
| 2494 * be but are not implemented by a concrete class. | |
| 2495 */ | |
| 2496 static const ErrorProperty UNIMPLEMENTED_METHODS = | |
| 2497 const ErrorProperty('UNIMPLEMENTED_METHODS', 2); | |
| 2498 | |
| 2499 static const List<ErrorProperty> values = const [ | |
| 2500 NOT_INITIALIZED_FIELDS, | |
| 2501 PARTS_LIBRARY_NAME, | |
| 2502 UNIMPLEMENTED_METHODS | |
| 2503 ]; | |
| 2504 | |
| 2505 const ErrorProperty(String name, int ordinal) : super(name, ordinal); | |
| 2506 } | |
| 2507 | |
| 2508 /** | |
| 2509 * An object used to create analysis errors and report then to an error | |
| 2510 * listener. | |
| 2511 */ | |
| 2512 class ErrorReporter { | |
| 2513 /** | |
| 2514 * The error listener to which errors will be reported. | |
| 2515 */ | |
| 2516 final AnalysisErrorListener _errorListener; | |
| 2517 | |
| 2518 /** | |
| 2519 * The default source to be used when reporting errors. | |
| 2520 */ | |
| 2521 final Source _defaultSource; | |
| 2522 | |
| 2523 /** | |
| 2524 * The source to be used when reporting errors. | |
| 2525 */ | |
| 2526 Source _source; | |
| 2527 | |
| 2528 /** | |
| 2529 * Initialize a newly created error reporter that will report errors to the | |
| 2530 * given [_errorListener]. Errors will be reported against the | |
| 2531 * [_defaultSource] unless another source is provided later. | |
| 2532 */ | |
| 2533 ErrorReporter(this._errorListener, this._defaultSource) { | |
| 2534 if (_errorListener == null) { | |
| 2535 throw new IllegalArgumentException("An error listener must be provided"); | |
| 2536 } else if (_defaultSource == null) { | |
| 2537 throw new IllegalArgumentException("A default source must be provided"); | |
| 2538 } | |
| 2539 this._source = _defaultSource; | |
| 2540 } | |
| 2541 | |
| 2542 Source get source => _source; | |
| 2543 | |
| 2544 /** | |
| 2545 * Set the source to be used when reporting errors to the given [source]. | |
| 2546 * Setting the source to `null` will cause the default source to be used. | |
| 2547 */ | |
| 2548 void set source(Source source) { | |
| 2549 this._source = source == null ? _defaultSource : source; | |
| 2550 } | |
| 2551 | |
| 2552 /** | |
| 2553 * Creates an error with properties with the given [errorCode] and | |
| 2554 * [arguments]. The [node] is used to compute the location of the error. | |
| 2555 */ | |
| 2556 AnalysisErrorWithProperties newErrorWithProperties( | |
| 2557 ErrorCode errorCode, AstNode node, List<Object> arguments) => | |
| 2558 new AnalysisErrorWithProperties( | |
| 2559 _source, node.offset, node.length, errorCode, arguments); | |
| 2560 | |
| 2561 /** | |
| 2562 * Report the given [error]. | |
| 2563 */ | |
| 2564 void reportError(AnalysisError error) { | |
| 2565 _errorListener.onError(error); | |
| 2566 } | |
| 2567 | |
| 2568 /** | |
| 2569 * Report an error with the given [errorCode] and [arguments]. The [element] | |
| 2570 * is used to compute the location of the error. | |
| 2571 */ | |
| 2572 void reportErrorForElement(ErrorCode errorCode, Element element, | |
| 2573 [List<Object> arguments]) { | |
| 2574 int length = 0; | |
| 2575 if (element is ImportElement) { | |
| 2576 length = 6; // 'import'.length | |
| 2577 } else if (element is ExportElement) { | |
| 2578 length = 6; // 'export'.length | |
| 2579 } else { | |
| 2580 length = element.nameLength; | |
| 2581 } | |
| 2582 reportErrorForOffset(errorCode, element.nameOffset, length, arguments); | |
| 2583 } | |
| 2584 | |
| 2585 /** | |
| 2586 * Report an error with the given [errorCode] and [arguments]. | |
| 2587 * The [node] is used to compute the location of the error. | |
| 2588 * | |
| 2589 * If the arguments contain the names of two or more types, the method | |
| 2590 * [reportTypeErrorForNode] should be used and the types | |
| 2591 * themselves (rather than their names) should be passed as arguments. | |
| 2592 */ | |
| 2593 void reportErrorForNode(ErrorCode errorCode, AstNode node, | |
| 2594 [List<Object> arguments]) { | |
| 2595 reportErrorForOffset(errorCode, node.offset, node.length, arguments); | |
| 2596 } | |
| 2597 | |
| 2598 /** | |
| 2599 * Report an error with the given [errorCode] and [arguments]. The location of | |
| 2600 * the error is specified by the given [offset] and [length]. | |
| 2601 */ | |
| 2602 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, | |
| 2603 [List<Object> arguments]) { | |
| 2604 _errorListener.onError( | |
| 2605 new AnalysisError(_source, offset, length, errorCode, arguments)); | |
| 2606 } | |
| 2607 | |
| 2608 /** | |
| 2609 * Report an error with the given [errorCode] and [arguments]. The [token] is | |
| 2610 * used to compute the location of the error. | |
| 2611 */ | |
| 2612 void reportErrorForToken(ErrorCode errorCode, Token token, | |
| 2613 [List<Object> arguments]) { | |
| 2614 reportErrorForOffset(errorCode, token.offset, token.length, arguments); | |
| 2615 } | |
| 2616 | |
| 2617 /** | |
| 2618 * Report an error with the given [errorCode] and [arguments]. The [node] is | |
| 2619 * used to compute the location of the error. The arguments are expected to | |
| 2620 * contain two or more types. Convert the types into strings by using the | |
| 2621 * display names of the types, unless there are two or more types with the | |
| 2622 * same names, in which case the extended display names of the types will be | |
| 2623 * used in order to clarify the message. | |
| 2624 * | |
| 2625 * If there are not two or more types in the argument list, the method | |
| 2626 * [reportErrorForNode] should be used instead. | |
| 2627 */ | |
| 2628 void reportTypeErrorForNode( | |
| 2629 ErrorCode errorCode, AstNode node, List<Object> arguments) { | |
| 2630 _convertTypeNames(arguments); | |
| 2631 reportErrorForOffset(errorCode, node.offset, node.length, arguments); | |
| 2632 } | |
| 2633 | |
| 2634 /** | |
| 2635 * Given an array of [arguments] that is expected to contain two or more | |
| 2636 * types, convert the types into strings by using the display names of the | |
| 2637 * types, unless there are two or more types with the same names, in which | |
| 2638 * case the extended display names of the types will be used in order to | |
| 2639 * clarify the message. | |
| 2640 */ | |
| 2641 void _convertTypeNames(List<Object> arguments) { | |
| 2642 if (_hasEqualTypeNames(arguments)) { | |
| 2643 int count = arguments.length; | |
| 2644 for (int i = 0; i < count; i++) { | |
| 2645 Object argument = arguments[i]; | |
| 2646 if (argument is DartType) { | |
| 2647 DartType type = argument; | |
| 2648 Element element = type.element; | |
| 2649 if (element == null) { | |
| 2650 arguments[i] = type.displayName; | |
| 2651 } else { | |
| 2652 arguments[i] = element.getExtendedDisplayName(type.displayName); | |
| 2653 } | |
| 2654 } | |
| 2655 } | |
| 2656 } else { | |
| 2657 int count = arguments.length; | |
| 2658 for (int i = 0; i < count; i++) { | |
| 2659 Object argument = arguments[i]; | |
| 2660 if (argument is DartType) { | |
| 2661 arguments[i] = argument.displayName; | |
| 2662 } | |
| 2663 } | |
| 2664 } | |
| 2665 } | |
| 2666 | |
| 2667 /** | |
| 2668 * Return `true` if the given array of [arguments] contains two or more types | |
| 2669 * with the same display name. | |
| 2670 */ | |
| 2671 bool _hasEqualTypeNames(List<Object> arguments) { | |
| 2672 int count = arguments.length; | |
| 2673 HashSet<String> typeNames = new HashSet<String>(); | |
| 2674 for (int i = 0; i < count; i++) { | |
| 2675 if (arguments[i] is DartType && | |
| 2676 !typeNames.add((arguments[i] as DartType).displayName)) { | |
| 2677 return true; | |
| 2678 } | |
| 2679 } | |
| 2680 return false; | |
| 2681 } | |
| 2682 } | |
| 2683 | |
| 2684 /** | |
| 2685 * The severity of an [ErrorCode]. | |
| 2686 */ | |
| 2687 class ErrorSeverity extends Enum<ErrorSeverity> { | |
| 2688 /** | |
| 2689 * The severity representing a non-error. This is never used for any error | |
| 2690 * code, but is useful for clients. | |
| 2691 */ | |
| 2692 static const ErrorSeverity NONE = const ErrorSeverity('NONE', 0, " ", "none"); | |
| 2693 | |
| 2694 /** | |
| 2695 * The severity representing an informational level analysis issue. | |
| 2696 */ | |
| 2697 static const ErrorSeverity INFO = const ErrorSeverity('INFO', 1, "I", "info"); | |
| 2698 | |
| 2699 /** | |
| 2700 * The severity representing a warning. Warnings can become errors if the `-We
rror` command | |
| 2701 * line flag is specified. | |
| 2702 */ | |
| 2703 static const ErrorSeverity WARNING = | |
| 2704 const ErrorSeverity('WARNING', 2, "W", "warning"); | |
| 2705 | |
| 2706 /** | |
| 2707 * The severity representing an error. | |
| 2708 */ | |
| 2709 static const ErrorSeverity ERROR = | |
| 2710 const ErrorSeverity('ERROR', 3, "E", "error"); | |
| 2711 | |
| 2712 static const List<ErrorSeverity> values = const [NONE, INFO, WARNING, ERROR]; | |
| 2713 | |
| 2714 /** | |
| 2715 * The name of the severity used when producing machine output. | |
| 2716 */ | |
| 2717 final String machineCode; | |
| 2718 | |
| 2719 /** | |
| 2720 * The name of the severity used when producing readable output. | |
| 2721 */ | |
| 2722 final String displayName; | |
| 2723 | |
| 2724 /** | |
| 2725 * Initialize a newly created severity with the given names. | |
| 2726 * | |
| 2727 * Parameters: | |
| 2728 * 0: the name of the severity used when producing machine output | |
| 2729 * 1: the name of the severity used when producing readable output | |
| 2730 */ | |
| 2731 const ErrorSeverity( | |
| 2732 String name, int ordinal, this.machineCode, this.displayName) | |
| 2733 : super(name, ordinal); | |
| 2734 | |
| 2735 /** | |
| 2736 * Return the severity constant that represents the greatest severity. | |
| 2737 */ | |
| 2738 ErrorSeverity max(ErrorSeverity severity) => | |
| 2739 this.ordinal >= severity.ordinal ? this : severity; | |
| 2740 } | |
| 2741 | |
| 2742 /** | |
| 2743 * The type of an [ErrorCode]. | |
| 2744 */ | |
| 2745 class ErrorType extends Enum<ErrorType> { | |
| 2746 /** | |
| 2747 * Task (todo) comments in user code. | |
| 2748 */ | |
| 2749 static const ErrorType TODO = const ErrorType('TODO', 0, ErrorSeverity.INFO); | |
| 2750 | |
| 2751 /** | |
| 2752 * Extra analysis run over the code to follow best practices, which are not in | |
| 2753 * the Dart Language Specification. | |
| 2754 */ | |
| 2755 static const ErrorType HINT = const ErrorType('HINT', 1, ErrorSeverity.INFO); | |
| 2756 | |
| 2757 /** | |
| 2758 * Compile-time errors are errors that preclude execution. A compile time | |
| 2759 * error must be reported by a Dart compiler before the erroneous code is | |
| 2760 * executed. | |
| 2761 */ | |
| 2762 static const ErrorType COMPILE_TIME_ERROR = | |
| 2763 const ErrorType('COMPILE_TIME_ERROR', 2, ErrorSeverity.ERROR); | |
| 2764 | |
| 2765 /** | |
| 2766 * Checked mode compile-time errors are errors that preclude execution in | |
| 2767 * checked mode. | |
| 2768 */ | |
| 2769 static const ErrorType CHECKED_MODE_COMPILE_TIME_ERROR = const ErrorType( | |
| 2770 'CHECKED_MODE_COMPILE_TIME_ERROR', 3, ErrorSeverity.ERROR); | |
| 2771 | |
| 2772 /** | |
| 2773 * Static warnings are those warnings reported by the static checker. They | |
| 2774 * have no effect on execution. Static warnings must be provided by Dart | |
| 2775 * compilers used during development. | |
| 2776 */ | |
| 2777 static const ErrorType STATIC_WARNING = | |
| 2778 const ErrorType('STATIC_WARNING', 4, ErrorSeverity.WARNING); | |
| 2779 | |
| 2780 /** | |
| 2781 * Many, but not all, static warnings relate to types, in which case they are | |
| 2782 * known as static type warnings. | |
| 2783 */ | |
| 2784 static const ErrorType STATIC_TYPE_WARNING = | |
| 2785 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); | |
| 2786 | |
| 2787 /** | |
| 2788 * Syntactic errors are errors produced as a result of input that does not | |
| 2789 * conform to the grammar. | |
| 2790 */ | |
| 2791 static const ErrorType SYNTACTIC_ERROR = | |
| 2792 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); | |
| 2793 | |
| 2794 /** | |
| 2795 * Lint warnings describe style and best practice recommendations that can be | |
| 2796 * used to formalize a project's style guidelines. | |
| 2797 */ | |
| 2798 static const ErrorType LINT = const ErrorType('LINT', 7, ErrorSeverity.INFO); | |
| 2799 | |
| 2800 static const List<ErrorType> values = const [ | |
| 2801 TODO, | |
| 2802 HINT, | |
| 2803 COMPILE_TIME_ERROR, | |
| 2804 CHECKED_MODE_COMPILE_TIME_ERROR, | |
| 2805 STATIC_WARNING, | |
| 2806 STATIC_TYPE_WARNING, | |
| 2807 SYNTACTIC_ERROR, | |
| 2808 LINT | |
| 2809 ]; | |
| 2810 | |
| 2811 /** | |
| 2812 * The severity of this type of error. | |
| 2813 */ | |
| 2814 final ErrorSeverity severity; | |
| 2815 | |
| 2816 /** | |
| 2817 * Initialize a newly created error type to have the given [name] and | |
| 2818 * [severity]. | |
| 2819 */ | |
| 2820 const ErrorType(String name, int ordinal, this.severity) | |
| 2821 : super(name, ordinal); | |
| 2822 | |
| 2823 String get displayName => name.toLowerCase().replaceAll('_', ' '); | |
| 2824 } | |
| 2825 | |
| 2826 /** | |
| 2827 * The hints and coding recommendations for best practices which are not | 2202 * The hints and coding recommendations for best practices which are not |
| 2828 * mentioned in the Dart Language Specification. | 2203 * mentioned in the Dart Language Specification. |
| 2829 */ | 2204 */ |
| 2830 class HintCode extends ErrorCode { | 2205 class HintCode extends ErrorCode { |
| 2831 /** | 2206 /** |
| 2207 * When an abstract supertype member is references with `super` as its target, |
| 2208 * it cannot be overridden, so it is always a runtime error. |
| 2209 * |
| 2210 * Parameters: |
| 2211 * 0: the display name for the kind of the referenced element |
| 2212 * 1: the name of the referenced element |
| 2213 */ |
| 2214 static const HintCode ABSTRACT_SUPER_MEMBER_REFERENCE = const HintCode( |
| 2215 'ABSTRACT_SUPER_MEMBER_REFERENCE', |
| 2216 "The {0} '{1}' is always abstract in the supertype.", |
| 2217 null); |
| 2218 |
| 2219 /** |
| 2832 * This hint is generated anywhere where the | 2220 * This hint is generated anywhere where the |
| 2833 * [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, | 2221 * [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, |
| 2834 * if we used propagated information for the warnings. | 2222 * if we used propagated information for the warnings. |
| 2835 * | 2223 * |
| 2836 * Parameters: | 2224 * Parameters: |
| 2837 * 0: the name of the actual argument type | 2225 * 0: the name of the actual argument type |
| 2838 * 1: the name of the expected type | 2226 * 1: the name of the expected type |
| 2839 */ | 2227 */ |
| 2840 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode( | 2228 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode( |
| 2841 'ARGUMENT_TYPE_NOT_ASSIGNABLE', | 2229 'ARGUMENT_TYPE_NOT_ASSIGNABLE', |
| 2842 "The argument type '{0}' cannot be assigned to the parameter type '{1}'"); | 2230 "The argument type '{0}' cannot be assigned to the parameter type '{1}'.", |
| 2231 null); |
| 2232 |
| 2233 /** |
| 2234 * When the target expression uses '?.' operator, it can be `null`, so all the |
| 2235 * subsequent invocations should also use '?.' operator. |
| 2236 */ |
| 2237 static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = const HintCode( |
| 2238 'CAN_BE_NULL_AFTER_NULL_AWARE', |
| 2239 "The expression uses '?.', so can be 'null'", |
| 2240 "Replace the '.' with a '?.' in the invocation"); |
| 2843 | 2241 |
| 2844 /** | 2242 /** |
| 2845 * Dead code is code that is never reached, this can happen for instance if a | 2243 * Dead code is code that is never reached, this can happen for instance if a |
| 2846 * statement follows a return statement. | 2244 * statement follows a return statement. |
| 2847 */ | 2245 */ |
| 2848 static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code"); | 2246 static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code"); |
| 2849 | 2247 |
| 2850 /** | 2248 /** |
| 2851 * Dead code is code that is never reached. This case covers cases where the | 2249 * Dead code is code that is never reached. This case covers cases where the |
| 2852 * user has catch clauses after `catch (e)` or `on Object catch (e)`. | 2250 * user has catch clauses after `catch (e)` or `on Object catch (e)`. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2928 * | 2326 * |
| 2929 * Parameters: | 2327 * Parameters: |
| 2930 * 0: the name of the right hand side type | 2328 * 0: the name of the right hand side type |
| 2931 * 1: the name of the left hand side type | 2329 * 1: the name of the left hand side type |
| 2932 */ | 2330 */ |
| 2933 static const HintCode INVALID_ASSIGNMENT = const HintCode( | 2331 static const HintCode INVALID_ASSIGNMENT = const HintCode( |
| 2934 'INVALID_ASSIGNMENT', | 2332 'INVALID_ASSIGNMENT', |
| 2935 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"); | 2333 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"); |
| 2936 | 2334 |
| 2937 /** | 2335 /** |
| 2336 * This hint is generated anywhere a @factory annotation is associated with |
| 2337 * anything other than a method. |
| 2338 */ |
| 2339 static const HintCode INVALID_FACTORY_ANNOTATION = const HintCode( |
| 2340 'INVALID_FACTORY_ANNOTATION', |
| 2341 "Only methods can be annotated as factories."); |
| 2342 |
| 2343 /** |
| 2344 * This hint is generated anywhere a @factory annotation is associated with |
| 2345 * a method that does not declare a return type. |
| 2346 */ |
| 2347 static const HintCode INVALID_FACTORY_METHOD_DECL = const HintCode( |
| 2348 'INVALID_FACTORY_METHOD_DECL', |
| 2349 "Factory method '{0}' must have a return type."); |
| 2350 |
| 2351 /** |
| 2352 * This hint is generated anywhere a @factory annotation is associated with |
| 2353 * a non-abstract method that can return anything other than a newly allocated |
| 2354 * object. |
| 2355 * |
| 2356 * Parameters: |
| 2357 * 0: the name of the method |
| 2358 */ |
| 2359 static const HintCode INVALID_FACTORY_METHOD_IMPL = const HintCode( |
| 2360 'INVALID_FACTORY_METHOD_IMPL', |
| 2361 "Factory method '{0}' does not return a newly allocated object."); |
| 2362 |
| 2363 /** |
| 2364 * This hint is generated anywhere where a member annotated with `@protected` |
| 2365 * is used outside an instance member of a subclass. |
| 2366 * |
| 2367 * Parameters: |
| 2368 * 0: the name of the member |
| 2369 * 1: the name of the defining class |
| 2370 */ |
| 2371 static const HintCode INVALID_USE_OF_PROTECTED_MEMBER = const HintCode( |
| 2372 'INVALID_USE_OF_PROTECTED_MEMBER', |
| 2373 "The member '{0}' can only be used within instance members of subclasses o
f '{1}'"); |
| 2374 |
| 2375 /** |
| 2376 * Generate a hint for a constructor, function or method invocation where a |
| 2377 * required parameter is missing. |
| 2378 * |
| 2379 * Parameters: |
| 2380 * 0: the name of the parameter |
| 2381 */ |
| 2382 static const HintCode MISSING_REQUIRED_PARAM = const HintCode( |
| 2383 'MISSING_REQUIRED_PARAM', "The parameter '{0}' is required."); |
| 2384 |
| 2385 /** |
| 2386 * Generate a hint for a constructor, function or method invocation where a |
| 2387 * required parameter is missing. |
| 2388 * |
| 2389 * Parameters: |
| 2390 * 0: the name of the parameter |
| 2391 * 1: message details |
| 2392 */ |
| 2393 static const HintCode MISSING_REQUIRED_PARAM_WITH_DETAILS = const HintCode( |
| 2394 'MISSING_REQUIRED_PARAM_WITH_DETAILS', |
| 2395 "The parameter '{0}' is required. {1}"); |
| 2396 |
| 2397 /** |
| 2398 * Generate a hint for an element that is annotated with `@JS(...)` whose |
| 2399 * library declaration is not similarly annotated. |
| 2400 */ |
| 2401 static const HintCode MISSING_JS_LIB_ANNOTATION = const HintCode( |
| 2402 'MISSING_JS_LIB_ANNOTATION', |
| 2403 "The @JS() annotation can only be used if it is also declared on the libra
ry directive."); |
| 2404 |
| 2405 /** |
| 2938 * Generate a hint for methods or functions that have a return type, but do | 2406 * Generate a hint for methods or functions that have a return type, but do |
| 2939 * not have a non-void return statement on all branches. At the end of methods | 2407 * not have a non-void return statement on all branches. At the end of methods |
| 2940 * or functions with no return, Dart implicitly returns `null`, avoiding these | 2408 * or functions with no return, Dart implicitly returns `null`, avoiding these |
| 2941 * implicit returns is considered a best practice. | 2409 * implicit returns is considered a best practice. |
| 2942 * | 2410 * |
| 2943 * Parameters: | 2411 * Parameters: |
| 2944 * 0: the name of the declared return type | 2412 * 0: the name of the declared return type |
| 2945 */ | 2413 */ |
| 2946 static const HintCode MISSING_RETURN = const HintCode( | 2414 static const HintCode MISSING_RETURN = const HintCode( |
| 2947 'MISSING_RETURN', | 2415 'MISSING_RETURN', |
| 2948 "This function declares a return type of '{0}', but does not end with a re
turn statement", | 2416 "This function declares a return type of '{0}', but does not end with a re
turn statement", |
| 2949 "Either add a return statement or change the return type to 'void'"); | 2417 "Either add a return statement or change the return type to 'void'"); |
| 2950 | 2418 |
| 2951 /** | 2419 /** |
| 2420 * Generate a hint for methods that override methods annotated `@mustCallSuper
` |
| 2421 * that do not invoke the overridden super method. |
| 2422 * |
| 2423 * Parameters: |
| 2424 * 0: the name of the class declaring the overriden method |
| 2425 */ |
| 2426 static const HintCode MUST_CALL_SUPER = const HintCode( |
| 2427 'MUST_CALL_SUPER', |
| 2428 "This method overrides a method annotated as @mustCall super in '{0}', " |
| 2429 "but does invoke the overriden method"); |
| 2430 |
| 2431 /** |
| 2432 * A condition in a control flow statement could evaluate to `null` because it |
| 2433 * uses the null-aware '?.' operator. |
| 2434 */ |
| 2435 static const HintCode NULL_AWARE_IN_CONDITION = const HintCode( |
| 2436 'NULL_AWARE_IN_CONDITION', |
| 2437 "The value of the '?.' operator can be 'null', which is not appropriate in
a condition", |
| 2438 "Replace the '?.' with a '.', testing the left-hand side for null if neces
sary"); |
| 2439 |
| 2440 /** |
| 2952 * A getter with the override annotation does not override an existing getter. | 2441 * A getter with the override annotation does not override an existing getter. |
| 2953 */ | 2442 */ |
| 2954 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode( | 2443 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode( |
| 2955 'OVERRIDE_ON_NON_OVERRIDING_GETTER', | 2444 'OVERRIDE_ON_NON_OVERRIDING_GETTER', |
| 2956 "Getter does not override an inherited getter"); | 2445 "Getter does not override an inherited getter"); |
| 2957 | 2446 |
| 2958 /** | 2447 /** |
| 2448 * A field with the override annotation does not override a getter or setter. |
| 2449 */ |
| 2450 static const HintCode OVERRIDE_ON_NON_OVERRIDING_FIELD = const HintCode( |
| 2451 'OVERRIDE_ON_NON_OVERRIDING_FIELD', |
| 2452 "Field does not override an inherited getter or setter"); |
| 2453 |
| 2454 /** |
| 2959 * A method with the override annotation does not override an existing method. | 2455 * A method with the override annotation does not override an existing method. |
| 2960 */ | 2456 */ |
| 2961 static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode( | 2457 static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode( |
| 2962 'OVERRIDE_ON_NON_OVERRIDING_METHOD', | 2458 'OVERRIDE_ON_NON_OVERRIDING_METHOD', |
| 2963 "Method does not override an inherited method"); | 2459 "Method does not override an inherited method"); |
| 2964 | 2460 |
| 2965 /** | 2461 /** |
| 2966 * A setter with the override annotation does not override an existing setter. | 2462 * A setter with the override annotation does not override an existing setter. |
| 2967 */ | 2463 */ |
| 2968 static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode( | 2464 static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2996 * This hint is generated anywhere where the | 2492 * This hint is generated anywhere where the |
| 2997 * [StaticTypeWarningCode.UNDEFINED_GETTER] or | 2493 * [StaticTypeWarningCode.UNDEFINED_GETTER] or |
| 2998 * [StaticWarningCode.UNDEFINED_GETTER] would have been generated, if we used | 2494 * [StaticWarningCode.UNDEFINED_GETTER] would have been generated, if we used |
| 2999 * propagated information for the warnings. | 2495 * propagated information for the warnings. |
| 3000 * | 2496 * |
| 3001 * Parameters: | 2497 * Parameters: |
| 3002 * 0: the name of the getter | 2498 * 0: the name of the getter |
| 3003 * 1: the name of the enclosing type where the getter is being looked for | 2499 * 1: the name of the enclosing type where the getter is being looked for |
| 3004 */ | 2500 */ |
| 3005 static const HintCode UNDEFINED_GETTER = const HintCode('UNDEFINED_GETTER', | 2501 static const HintCode UNDEFINED_GETTER = const HintCode('UNDEFINED_GETTER', |
| 3006 "The getter '{0}' is not defined for the class '{1}'"); | 2502 "The getter '{0}' is not defined for the class '{1}'.", null); |
| 2503 |
| 2504 /** |
| 2505 * An undefined name hidden in an import or export directive. |
| 2506 */ |
| 2507 static const HintCode UNDEFINED_HIDDEN_NAME = const HintCode( |
| 2508 'UNDEFINED_HIDDEN_NAME', |
| 2509 "The library '{0}' doesn't export a member with the hidden name '{1}'"); |
| 3007 | 2510 |
| 3008 /** | 2511 /** |
| 3009 * This hint is generated anywhere where the | 2512 * This hint is generated anywhere where the |
| 3010 * [StaticTypeWarningCode.UNDEFINED_METHOD] would have been generated, if we | 2513 * [StaticTypeWarningCode.UNDEFINED_METHOD] would have been generated, if we |
| 3011 * used propagated information for the warnings. | 2514 * used propagated information for the warnings. |
| 3012 * | 2515 * |
| 3013 * Parameters: | 2516 * Parameters: |
| 3014 * 0: the name of the method that is undefined | 2517 * 0: the name of the method that is undefined |
| 3015 * 1: the resolved type name that the method lookup is happening on | 2518 * 1: the resolved type name that the method lookup is happening on |
| 3016 */ | 2519 */ |
| 3017 static const HintCode UNDEFINED_METHOD = const HintCode('UNDEFINED_METHOD', | 2520 static const HintCode UNDEFINED_METHOD = const HintCode('UNDEFINED_METHOD', |
| 3018 "The method '{0}' is not defined for the class '{1}'"); | 2521 "The method '{0}' is not defined for the class '{1}'.", null); |
| 3019 | 2522 |
| 3020 /** | 2523 /** |
| 3021 * This hint is generated anywhere where the | 2524 * This hint is generated anywhere where the |
| 3022 * [StaticTypeWarningCode.UNDEFINED_OPERATOR] would have been generated, if we | 2525 * [StaticTypeWarningCode.UNDEFINED_OPERATOR] would have been generated, if we |
| 3023 * used propagated information for the warnings. | 2526 * used propagated information for the warnings. |
| 3024 * | 2527 * |
| 3025 * Parameters: | 2528 * Parameters: |
| 3026 * 0: the name of the operator | 2529 * 0: the name of the operator |
| 3027 * 1: the name of the enclosing type where the operator is being looked for | 2530 * 1: the name of the enclosing type where the operator is being looked for |
| 3028 */ | 2531 */ |
| 3029 static const HintCode UNDEFINED_OPERATOR = const HintCode( | 2532 static const HintCode UNDEFINED_OPERATOR = const HintCode( |
| 3030 'UNDEFINED_OPERATOR', | 2533 'UNDEFINED_OPERATOR', |
| 3031 "The operator '{0}' is not defined for the class '{1}'"); | 2534 "The operator '{0}' is not defined for the class '{1}'.", |
| 2535 null); |
| 3032 | 2536 |
| 3033 /** | 2537 /** |
| 3034 * This hint is generated anywhere where the | 2538 * This hint is generated anywhere where the |
| 3035 * [StaticTypeWarningCode.UNDEFINED_SETTER] or | 2539 * [StaticTypeWarningCode.UNDEFINED_SETTER] or |
| 3036 * [StaticWarningCode.UNDEFINED_SETTER] would have been generated, if we used | 2540 * [StaticWarningCode.UNDEFINED_SETTER] would have been generated, if we used |
| 3037 * propagated information for the warnings. | 2541 * propagated information for the warnings. |
| 3038 * | 2542 * |
| 3039 * Parameters: | 2543 * Parameters: |
| 3040 * 0: the name of the setter | 2544 * 0: the name of the setter |
| 3041 * 1: the name of the enclosing type where the setter is being looked for | 2545 * 1: the name of the enclosing type where the setter is being looked for |
| 3042 */ | 2546 */ |
| 3043 static const HintCode UNDEFINED_SETTER = const HintCode('UNDEFINED_SETTER', | 2547 static const HintCode UNDEFINED_SETTER = const HintCode('UNDEFINED_SETTER', |
| 3044 "The setter '{0}' is not defined for the class '{1}'"); | 2548 "The setter '{0}' is not defined for the class '{1}'.", null); |
| 2549 |
| 2550 /** |
| 2551 * An undefined name shown in an import or export directive. |
| 2552 */ |
| 2553 static const HintCode UNDEFINED_SHOWN_NAME = const HintCode( |
| 2554 'UNDEFINED_SHOWN_NAME', |
| 2555 "The library '{0}' doesn't export a member with the shown name '{1}'"); |
| 3045 | 2556 |
| 3046 /** | 2557 /** |
| 3047 * Unnecessary cast. | 2558 * Unnecessary cast. |
| 3048 */ | 2559 */ |
| 3049 static const HintCode UNNECESSARY_CAST = | 2560 static const HintCode UNNECESSARY_CAST = |
| 3050 const HintCode('UNNECESSARY_CAST', "Unnecessary cast"); | 2561 const HintCode('UNNECESSARY_CAST', "Unnecessary cast"); |
| 3051 | 2562 |
| 3052 /** | 2563 /** |
| 2564 * Unnecessary `noSuchMethod` declaration. |
| 2565 */ |
| 2566 static const HintCode UNNECESSARY_NO_SUCH_METHOD = const HintCode( |
| 2567 'UNNECESSARY_NO_SUCH_METHOD', "Unnecessary 'noSuchMethod' declaration"); |
| 2568 |
| 2569 /** |
| 3053 * Unnecessary type checks, the result is always true. | 2570 * Unnecessary type checks, the result is always true. |
| 3054 */ | 2571 */ |
| 3055 static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode( | 2572 static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode( |
| 3056 'UNNECESSARY_TYPE_CHECK_FALSE', | 2573 'UNNECESSARY_TYPE_CHECK_FALSE', |
| 3057 "Unnecessary type check, the result is always false"); | 2574 "Unnecessary type check, the result is always false"); |
| 3058 | 2575 |
| 3059 /** | 2576 /** |
| 3060 * Unnecessary type checks, the result is always false. | 2577 * Unnecessary type checks, the result is always false. |
| 3061 */ | 2578 */ |
| 3062 static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode( | 2579 static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 "The stack trace variable '{0}' is not used and can be removed"); | 2613 "The stack trace variable '{0}' is not used and can be removed"); |
| 3097 | 2614 |
| 3098 /** | 2615 /** |
| 3099 * Unused local variables are local variables which are never read. | 2616 * Unused local variables are local variables which are never read. |
| 3100 */ | 2617 */ |
| 3101 static const HintCode UNUSED_LOCAL_VARIABLE = const HintCode( | 2618 static const HintCode UNUSED_LOCAL_VARIABLE = const HintCode( |
| 3102 'UNUSED_LOCAL_VARIABLE', | 2619 'UNUSED_LOCAL_VARIABLE', |
| 3103 "The value of the local variable '{0}' is not used"); | 2620 "The value of the local variable '{0}' is not used"); |
| 3104 | 2621 |
| 3105 /** | 2622 /** |
| 2623 * Unused shown names are names shown on imports which are never used. |
| 2624 */ |
| 2625 static const HintCode UNUSED_SHOWN_NAME = const HintCode( |
| 2626 'UNUSED_SHOWN_NAME', "The name {0} is shown, but not used."); |
| 2627 |
| 2628 /** |
| 3106 * Hint for cases where the source expects a method or function to return a | 2629 * Hint for cases where the source expects a method or function to return a |
| 3107 * non-void result, but the method or function signature returns void. | 2630 * non-void result, but the method or function signature returns void. |
| 3108 * | 2631 * |
| 3109 * Parameters: | 2632 * Parameters: |
| 3110 * 0: the name of the method or function that returns void | 2633 * 0: the name of the method or function that returns void |
| 3111 */ | 2634 */ |
| 3112 static const HintCode USE_OF_VOID_RESULT = const HintCode( | 2635 static const HintCode USE_OF_VOID_RESULT = const HintCode( |
| 3113 'USE_OF_VOID_RESULT', | 2636 'USE_OF_VOID_RESULT', |
| 3114 "The result of '{0}' is being used, even though it is declared to be 'void
'"); | 2637 "The result of '{0}' is being used, even though it is declared to be 'void
'"); |
| 3115 | 2638 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3465 * static types of both of <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> may | 2988 * static types of both of <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> may |
| 3466 * not be assigned to bool. | 2989 * not be assigned to bool. |
| 3467 * | 2990 * |
| 3468 * Parameters: | 2991 * Parameters: |
| 3469 * 0: the lexeme of the logical operator | 2992 * 0: the lexeme of the logical operator |
| 3470 */ | 2993 */ |
| 3471 static const StaticTypeWarningCode NON_BOOL_OPERAND = | 2994 static const StaticTypeWarningCode NON_BOOL_OPERAND = |
| 3472 const StaticTypeWarningCode('NON_BOOL_OPERAND', | 2995 const StaticTypeWarningCode('NON_BOOL_OPERAND', |
| 3473 "The operands of the '{0}' operator must be assignable to 'bool'"); | 2996 "The operands of the '{0}' operator must be assignable to 'bool'"); |
| 3474 | 2997 |
| 2998 static const StaticTypeWarningCode NON_NULLABLE_FIELD_NOT_INITIALIZED = |
| 2999 const StaticTypeWarningCode('NON_NULLABLE_FIELD_NOT_INITIALIZED', |
| 3000 "Variable '{0}' of non-nullable type '{1}' must be initialized"); |
| 3001 |
| 3475 /** | 3002 /** |
| 3476 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, | 3003 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, |
| 3477 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. | 3004 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. |
| 3478 */ | 3005 */ |
| 3479 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = | 3006 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = |
| 3480 const StaticTypeWarningCode('NON_TYPE_AS_TYPE_ARGUMENT', | 3007 const StaticTypeWarningCode('NON_TYPE_AS_TYPE_ARGUMENT', |
| 3481 "The name '{0}' is not a type and cannot be used as a parameterized ty
pe"); | 3008 "The name '{0}' is not a type and cannot be used as a parameterized ty
pe"); |
| 3482 | 3009 |
| 3483 /** | 3010 /** |
| 3484 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not | 3011 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not |
| 3485 * be assigned to the declared return type of the immediately enclosing | 3012 * be assigned to the declared return type of the immediately enclosing |
| 3486 * function. | 3013 * function. |
| 3487 * | 3014 * |
| 3488 * Parameters: | 3015 * Parameters: |
| 3489 * 0: the return type as declared in the return statement | 3016 * 0: the return type as declared in the return statement |
| 3490 * 1: the expected return type as defined by the method | 3017 * 1: the expected return type as defined by the method |
| 3491 * 2: the name of the method | 3018 * 2: the name of the method |
| 3492 */ | 3019 */ |
| 3493 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = | 3020 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = |
| 3494 const StaticTypeWarningCode('RETURN_OF_INVALID_TYPE', | 3021 const StaticTypeWarningCode( |
| 3495 "The return type '{0}' is not a '{1}', as defined by the method '{2}'"
); | 3022 'RETURN_OF_INVALID_TYPE', |
| 3023 "The return type '{0}' is not a '{1}', as defined by the method '{2}'.
", |
| 3024 null); |
| 3496 | 3025 |
| 3497 /** | 3026 /** |
| 3498 * 12.11 Instance Creation: It is a static type warning if any of the type | 3027 * 12.11 Instance Creation: It is a static type warning if any of the type |
| 3499 * arguments to a constructor of a generic type <i>G</i> invoked by a new | 3028 * arguments to a constructor of a generic type <i>G</i> invoked by a new |
| 3500 * expression or a constant object expression are not subtypes of the bounds | 3029 * expression or a constant object expression are not subtypes of the bounds |
| 3501 * of the corresponding formal type parameters of <i>G</i>. | 3030 * of the corresponding formal type parameters of <i>G</i>. |
| 3502 * | 3031 * |
| 3503 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member | 3032 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member |
| 3504 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of | 3033 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of |
| 3505 * <i>G<A<sub>1</sub>, …, A<sub>n</sub>></i> is <i>[A<sub>1</sub>
, | 3034 * <i>G<A<sub>1</sub>, …, A<sub>n</sub>></i> is <i>[A<sub>1</sub>
, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3543 * 12.17 Getter Invocation: It is a static warning if there is no class | 3072 * 12.17 Getter Invocation: It is a static warning if there is no class |
| 3544 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 3073 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
| 3545 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 3074 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
| 3546 * | 3075 * |
| 3547 * Parameters: | 3076 * Parameters: |
| 3548 * 0: the name of the enumeration constant that is not defined | 3077 * 0: the name of the enumeration constant that is not defined |
| 3549 * 1: the name of the enumeration used to access the constant | 3078 * 1: the name of the enumeration used to access the constant |
| 3550 */ | 3079 */ |
| 3551 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = | 3080 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = |
| 3552 const StaticTypeWarningCode('UNDEFINED_ENUM_CONSTANT', | 3081 const StaticTypeWarningCode('UNDEFINED_ENUM_CONSTANT', |
| 3553 "There is no constant named '{0}' in '{1}'"); | 3082 "There is no constant named '{0}' in '{1}'.", null); |
| 3554 | 3083 |
| 3555 /** | 3084 /** |
| 3556 * 12.15.3 Unqualified Invocation: If there exists a lexically visible | 3085 * 12.15.3 Unqualified Invocation: If there exists a lexically visible |
| 3557 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost | 3086 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost |
| 3558 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is | 3087 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is |
| 3559 * considered equivalent to the ordinary method invocation | 3088 * considered equivalent to the ordinary method invocation |
| 3560 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, | 3089 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, |
| 3561 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., | 3090 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., |
| 3562 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). | 3091 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). |
| 3563 * | 3092 * |
| 3564 * Parameters: | 3093 * Parameters: |
| 3565 * 0: the name of the method that is undefined | 3094 * 0: the name of the method that is undefined |
| 3566 */ | 3095 */ |
| 3567 static const StaticTypeWarningCode UNDEFINED_FUNCTION = | 3096 static const StaticTypeWarningCode UNDEFINED_FUNCTION = |
| 3568 const StaticTypeWarningCode( | 3097 const StaticTypeWarningCode( |
| 3569 'UNDEFINED_FUNCTION', "The function '{0}' is not defined"); | 3098 'UNDEFINED_FUNCTION', "The function '{0}' is not defined.", null); |
| 3570 | 3099 |
| 3571 /** | 3100 /** |
| 3572 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is | 3101 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
| 3573 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. | 3102 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
| 3574 * | 3103 * |
| 3575 * Parameters: | 3104 * Parameters: |
| 3576 * 0: the name of the getter | 3105 * 0: the name of the getter |
| 3577 * 1: the name of the enclosing type where the getter is being looked for | 3106 * 1: the name of the enclosing type where the getter is being looked for |
| 3578 */ | 3107 */ |
| 3579 static const StaticTypeWarningCode UNDEFINED_GETTER = | 3108 static const StaticTypeWarningCode UNDEFINED_GETTER = |
| 3580 const StaticTypeWarningCode('UNDEFINED_GETTER', | 3109 const StaticTypeWarningCode('UNDEFINED_GETTER', |
| 3581 "The getter '{0}' is not defined for the class '{1}'"); | 3110 "The getter '{0}' is not defined for the class '{1}'.", null); |
| 3582 | 3111 |
| 3583 /** | 3112 /** |
| 3584 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3113 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 3585 * It is a static type warning if <i>T</i> does not have an accessible | 3114 * It is a static type warning if <i>T</i> does not have an accessible |
| 3586 * instance member named <i>m</i>. | 3115 * instance member named <i>m</i>. |
| 3587 * | 3116 * |
| 3588 * Parameters: | 3117 * Parameters: |
| 3589 * 0: the name of the method that is undefined | 3118 * 0: the name of the method that is undefined |
| 3590 * 1: the resolved type name that the method lookup is happening on | 3119 * 1: the resolved type name that the method lookup is happening on |
| 3591 */ | 3120 */ |
| 3592 static const StaticTypeWarningCode UNDEFINED_METHOD = | 3121 static const StaticTypeWarningCode UNDEFINED_METHOD = |
| 3593 const StaticTypeWarningCode('UNDEFINED_METHOD', | 3122 const StaticTypeWarningCode('UNDEFINED_METHOD', |
| 3594 "The method '{0}' is not defined for the class '{1}'"); | 3123 "The method '{0}' is not defined for the class '{1}'.", null); |
| 3124 |
| 3125 /** |
| 3126 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 3127 * It is a static type warning if <i>T</i> does not have an accessible |
| 3128 * instance member named <i>m</i>. |
| 3129 * |
| 3130 * Parameters: |
| 3131 * 0: the name of the method that is undefined |
| 3132 * 1: the resolved type name that the method lookup is happening on |
| 3133 */ |
| 3134 static const StaticTypeWarningCode UNDEFINED_METHOD_WITH_CONSTRUCTOR = |
| 3135 const StaticTypeWarningCode( |
| 3136 'UNDEFINED_METHOD_WITH_CONSTRUCTOR', |
| 3137 "The method '{0}' is not defined for the class '{1}', but a constructo
r with that name is defined.", |
| 3138 "Try adding 'new' or 'const' to invoke the constuctor, or change the m
ethod name."); |
| 3595 | 3139 |
| 3596 /** | 3140 /** |
| 3597 * 12.18 Assignment: Evaluation of an assignment of the form | 3141 * 12.18 Assignment: Evaluation of an assignment of the form |
| 3598 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is | 3142 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
| 3599 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); | 3143 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
| 3600 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, | 3144 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
| 3601 * <i>e<sub>2</sub></i>). | 3145 * <i>e<sub>2</sub></i>). |
| 3602 * | 3146 * |
| 3603 * 12.29 Assignable Expressions: An assignable expression of the form | 3147 * 12.29 Assignable Expressions: An assignable expression of the form |
| 3604 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method | 3148 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method |
| 3605 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument | 3149 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument |
| 3606 * <i>e<sub>2</sub></i>. | 3150 * <i>e<sub>2</sub></i>. |
| 3607 * | 3151 * |
| 3608 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3152 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 3609 * It is a static type warning if <i>T</i> does not have an accessible | 3153 * It is a static type warning if <i>T</i> does not have an accessible |
| 3610 * instance member named <i>m</i>. | 3154 * instance member named <i>m</i>. |
| 3611 * | 3155 * |
| 3612 * Parameters: | 3156 * Parameters: |
| 3613 * 0: the name of the operator | 3157 * 0: the name of the operator |
| 3614 * 1: the name of the enclosing type where the operator is being looked for | 3158 * 1: the name of the enclosing type where the operator is being looked for |
| 3615 */ | 3159 */ |
| 3616 static const StaticTypeWarningCode UNDEFINED_OPERATOR = | 3160 static const StaticTypeWarningCode UNDEFINED_OPERATOR = |
| 3617 const StaticTypeWarningCode('UNDEFINED_OPERATOR', | 3161 const StaticTypeWarningCode('UNDEFINED_OPERATOR', |
| 3618 "The operator '{0}' is not defined for the class '{1}'"); | 3162 "The operator '{0}' is not defined for the class '{1}'.", null); |
| 3619 | 3163 |
| 3620 /** | 3164 /** |
| 3621 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3165 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
| 3622 * It is a static type warning if <i>T</i> does not have an accessible | 3166 * It is a static type warning if <i>T</i> does not have an accessible |
| 3623 * instance setter named <i>v=</i>. | 3167 * instance setter named <i>v=</i>. |
| 3624 * | 3168 * |
| 3625 * Parameters: | 3169 * Parameters: |
| 3626 * 0: the name of the setter | 3170 * 0: the name of the setter |
| 3627 * 1: the name of the enclosing type where the setter is being looked for | 3171 * 1: the name of the enclosing type where the setter is being looked for |
| 3628 * | 3172 * |
| 3629 * See [INACCESSIBLE_SETTER]. | 3173 * See [INACCESSIBLE_SETTER]. |
| 3630 */ | 3174 */ |
| 3631 static const StaticTypeWarningCode UNDEFINED_SETTER = | 3175 static const StaticTypeWarningCode UNDEFINED_SETTER = |
| 3632 const StaticTypeWarningCode('UNDEFINED_SETTER', | 3176 const StaticTypeWarningCode('UNDEFINED_SETTER', |
| 3633 "The setter '{0}' is not defined for the class '{1}'"); | 3177 "The setter '{0}' is not defined for the class '{1}'.", null); |
| 3634 | 3178 |
| 3635 /** | 3179 /** |
| 3636 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is | 3180 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
| 3637 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. | 3181 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
| 3638 * | 3182 * |
| 3639 * Parameters: | 3183 * Parameters: |
| 3640 * 0: the name of the getter | 3184 * 0: the name of the getter |
| 3641 * 1: the name of the enclosing type where the getter is being looked for | 3185 * 1: the name of the enclosing type where the getter is being looked for |
| 3642 */ | 3186 */ |
| 3643 static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER = | 3187 static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER = |
| 3644 const StaticTypeWarningCode('UNDEFINED_SUPER_GETTER', | 3188 const StaticTypeWarningCode('UNDEFINED_SUPER_GETTER', |
| 3645 "The getter '{0}' is not defined in a superclass of '{1}'"); | 3189 "The getter '{0}' is not defined in a superclass of '{1}'.", null); |
| 3646 | 3190 |
| 3647 /** | 3191 /** |
| 3648 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 3192 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 3649 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 3193 * <i>super.m(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+k</sub>)</i>. It is a | 3194 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
| 3651 * static type warning if <i>S</i> does not have an accessible instance member | 3195 * static type warning if <i>S</i> does not have an accessible instance member |
| 3652 * named <i>m</i>. | 3196 * named <i>m</i>. |
| 3653 * | 3197 * |
| 3654 * Parameters: | 3198 * Parameters: |
| 3655 * 0: the name of the method that is undefined | 3199 * 0: the name of the method that is undefined |
| 3656 * 1: the resolved type name that the method lookup is happening on | 3200 * 1: the resolved type name that the method lookup is happening on |
| 3657 */ | 3201 */ |
| 3658 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = | 3202 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = |
| 3659 const StaticTypeWarningCode('UNDEFINED_SUPER_METHOD', | 3203 const StaticTypeWarningCode('UNDEFINED_SUPER_METHOD', |
| 3660 "The method '{0}' is not defined in a superclass of '{1}'"); | 3204 "The method '{0}' is not defined in a superclass of '{1}'.", null); |
| 3661 | 3205 |
| 3662 /** | 3206 /** |
| 3663 * 12.18 Assignment: Evaluation of an assignment of the form | 3207 * 12.18 Assignment: Evaluation of an assignment of the form |
| 3664 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is | 3208 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
| 3665 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); | 3209 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
| 3666 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, | 3210 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
| 3667 * <i>e<sub>2</sub></i>). | 3211 * <i>e<sub>2</sub></i>). |
| 3668 * | 3212 * |
| 3669 * 12.29 Assignable Expressions: An assignable expression of the form | 3213 * 12.29 Assignable Expressions: An assignable expression of the form |
| 3670 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method | 3214 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method |
| 3671 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument | 3215 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument |
| 3672 * <i>e<sub>2</sub></i>. | 3216 * <i>e<sub>2</sub></i>. |
| 3673 * | 3217 * |
| 3674 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3218 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 3675 * It is a static type warning if <i>T</i> does not have an accessible | 3219 * It is a static type warning if <i>T</i> does not have an accessible |
| 3676 * instance member named <i>m</i>. | 3220 * instance member named <i>m</i>. |
| 3677 * | 3221 * |
| 3678 * Parameters: | 3222 * Parameters: |
| 3679 * 0: the name of the operator | 3223 * 0: the name of the operator |
| 3680 * 1: the name of the enclosing type where the operator is being looked for | 3224 * 1: the name of the enclosing type where the operator is being looked for |
| 3681 */ | 3225 */ |
| 3682 static const StaticTypeWarningCode UNDEFINED_SUPER_OPERATOR = | 3226 static const StaticTypeWarningCode UNDEFINED_SUPER_OPERATOR = |
| 3683 const StaticTypeWarningCode('UNDEFINED_SUPER_OPERATOR', | 3227 const StaticTypeWarningCode('UNDEFINED_SUPER_OPERATOR', |
| 3684 "The operator '{0}' is not defined in a superclass of '{1}'"); | 3228 "The operator '{0}' is not defined in a superclass of '{1}'.", null); |
| 3685 | 3229 |
| 3686 /** | 3230 /** |
| 3687 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3231 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
| 3688 * It is a static type warning if <i>T</i> does not have an accessible | 3232 * It is a static type warning if <i>T</i> does not have an accessible |
| 3689 * instance setter named <i>v=</i>. | 3233 * instance setter named <i>v=</i>. |
| 3690 * | 3234 * |
| 3691 * Parameters: | 3235 * Parameters: |
| 3692 * 0: the name of the setter | 3236 * 0: the name of the setter |
| 3693 * 1: the name of the enclosing type where the setter is being looked for | 3237 * 1: the name of the enclosing type where the setter is being looked for |
| 3694 * | 3238 * |
| 3695 * See [INACCESSIBLE_SETTER]. | 3239 * See [INACCESSIBLE_SETTER]. |
| 3696 */ | 3240 */ |
| 3697 static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER = | 3241 static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER = |
| 3698 const StaticTypeWarningCode('UNDEFINED_SUPER_SETTER', | 3242 const StaticTypeWarningCode('UNDEFINED_SUPER_SETTER', |
| 3699 "The setter '{0}' is not defined in a superclass of '{1}'"); | 3243 "The setter '{0}' is not defined in a superclass of '{1}'.", null); |
| 3700 | 3244 |
| 3701 /** | 3245 /** |
| 3702 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does | 3246 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does |
| 3703 * not have an accessible (3.2) instance member named <i>m</i>. | 3247 * not have an accessible (3.2) instance member named <i>m</i>. |
| 3704 * | 3248 * |
| 3705 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used | 3249 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used |
| 3706 * when we are able to find the name defined in a supertype. It exists to | 3250 * when we are able to find the name defined in a supertype. It exists to |
| 3707 * provide a more informative error message. | 3251 * provide a more informative error message. |
| 3708 */ | 3252 */ |
| 3709 static const StaticTypeWarningCode UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_M
EMBER = | 3253 static const StaticTypeWarningCode |
| 3254 UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = |
| 3710 const StaticTypeWarningCode( | 3255 const StaticTypeWarningCode( |
| 3711 'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER', | 3256 'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER', |
| 3712 "Static members from supertypes must be qualified by the name of the d
efining type"); | 3257 "Static members from supertypes must be qualified by the name of the d
efining type"); |
| 3713 | 3258 |
| 3714 /** | 3259 /** |
| 3715 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a | 3260 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a |
| 3716 * generic type with exactly <i>n</i> type parameters. | 3261 * generic type with exactly <i>n</i> type parameters. |
| 3717 * | 3262 * |
| 3718 * Parameters: | 3263 * Parameters: |
| 3719 * 0: the name of the type being referenced (<i>G</i>) | 3264 * 0: the name of the type being referenced (<i>G</i>) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3743 * a static type warning if T may not be assigned to the declared return type | 3288 * a static type warning if T may not be assigned to the declared return type |
| 3744 * of f. If f is synchronous it is a static type warning if T may not be | 3289 * of f. If f is synchronous it is a static type warning if T may not be |
| 3745 * assigned to Iterable. If f is asynchronous it is a static type warning if | 3290 * assigned to Iterable. If f is asynchronous it is a static type warning if |
| 3746 * T may not be assigned to Stream. | 3291 * T may not be assigned to Stream. |
| 3747 */ | 3292 */ |
| 3748 static const StaticTypeWarningCode YIELD_OF_INVALID_TYPE = | 3293 static const StaticTypeWarningCode YIELD_OF_INVALID_TYPE = |
| 3749 const StaticTypeWarningCode('YIELD_OF_INVALID_TYPE', | 3294 const StaticTypeWarningCode('YIELD_OF_INVALID_TYPE', |
| 3750 "The type '{0}' implied by the 'yield' expression must be assignable t
o '{1}'"); | 3295 "The type '{0}' implied by the 'yield' expression must be assignable t
o '{1}'"); |
| 3751 | 3296 |
| 3752 /** | 3297 /** |
| 3298 * 17.6.2 For-in. If the iterable expression does not implement Iterable, |
| 3299 * this warning is reported. |
| 3300 * |
| 3301 * Parameters: |
| 3302 * 0: The type of the iterable expression. |
| 3303 * 1: The sequence type -- Iterable for `for` or Stream for `await for`. |
| 3304 */ |
| 3305 static const StaticTypeWarningCode FOR_IN_OF_INVALID_TYPE = |
| 3306 const StaticTypeWarningCode('FOR_IN_OF_INVALID_TYPE', |
| 3307 "The type '{0}' used in the 'for' loop must implement {1}"); |
| 3308 |
| 3309 /** |
| 3310 * 17.6.2 For-in. It the iterable expression does not implement Iterable with |
| 3311 * a type argument that can be assigned to the for-in variable's type, this |
| 3312 * warning is reported. |
| 3313 * |
| 3314 * Parameters: |
| 3315 * 0: The type of the iterable expression. |
| 3316 * 1: The sequence type -- Iterable for `for` or Stream for `await for`. |
| 3317 * 2: The loop variable type. |
| 3318 */ |
| 3319 static const StaticTypeWarningCode FOR_IN_OF_INVALID_ELEMENT_TYPE = |
| 3320 const StaticTypeWarningCode('FOR_IN_OF_INVALID_ELEMENT_TYPE', |
| 3321 "The type '{0}' used in the 'for' loop must implement {1} with a type
argument that can be assigned to '{2}'"); |
| 3322 |
| 3323 /** |
| 3753 * Initialize a newly created error code to have the given [name]. The message | 3324 * Initialize a newly created error code to have the given [name]. The message |
| 3754 * associated with the error will be created from the given [message] | 3325 * associated with the error will be created from the given [message] |
| 3755 * template. The correction associated with the error will be created from the | 3326 * template. The correction associated with the error will be created from the |
| 3756 * given [correction] template. | 3327 * given [correction] template. |
| 3757 */ | 3328 */ |
| 3758 const StaticTypeWarningCode(String name, String message, [String correction]) | 3329 const StaticTypeWarningCode(String name, String message, [String correction]) |
| 3759 : super(name, message, correction); | 3330 : super(name, message, correction); |
| 3760 | 3331 |
| 3761 @override | 3332 @override |
| 3762 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; | 3333 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3815 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning | 3386 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning |
| 3816 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be | 3387 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be |
| 3817 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j | 3388 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j |
| 3818 * <= l</i>. | 3389 * <= l</i>. |
| 3819 * | 3390 * |
| 3820 * Parameters: | 3391 * Parameters: |
| 3821 * 0: the name of the actual argument type | 3392 * 0: the name of the actual argument type |
| 3822 * 1: the name of the expected type | 3393 * 1: the name of the expected type |
| 3823 */ | 3394 */ |
| 3824 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = | 3395 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = |
| 3825 const StaticWarningCode('ARGUMENT_TYPE_NOT_ASSIGNABLE', | 3396 const StaticWarningCode( |
| 3826 "The argument type '{0}' cannot be assigned to the parameter type '{1}
'"); | 3397 'ARGUMENT_TYPE_NOT_ASSIGNABLE', |
| 3398 "The argument type '{0}' cannot be assigned to the parameter type '{1}
'.", |
| 3399 null); |
| 3827 | 3400 |
| 3828 /** | 3401 /** |
| 3829 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 3402 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
| 3830 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 3403 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
| 3831 * assignment will also give rise to a static warning for the same reason. | 3404 * assignment will also give rise to a static warning for the same reason. |
| 3832 * | 3405 * |
| 3833 * A constant variable is always implicitly final. | 3406 * A constant variable is always implicitly final. |
| 3834 */ | 3407 */ |
| 3835 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode( | 3408 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode( |
| 3836 'ASSIGNMENT_TO_CONST', "Constant variables cannot be assigned a value"); | 3409 'ASSIGNMENT_TO_CONST', "Constant variables cannot be assigned a value"); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3910 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and | 3483 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and |
| 3911 * <i>N</i> would be introduced into the top level scope of <i>L</i> by an | 3484 * <i>N</i> would be introduced into the top level scope of <i>L</i> by an |
| 3912 * import from a library whose URI begins with <i>dart:</i> and an import from | 3485 * import from a library whose URI begins with <i>dart:</i> and an import from |
| 3913 * a library whose URI does not begin with <i>dart:</i>: | 3486 * a library whose URI does not begin with <i>dart:</i>: |
| 3914 * * The import from <i>dart:</i> is implicitly extended by a hide N clause. | 3487 * * The import from <i>dart:</i> is implicitly extended by a hide N clause. |
| 3915 * * A static warning is issued. | 3488 * * A static warning is issued. |
| 3916 * | 3489 * |
| 3917 * Parameters: | 3490 * Parameters: |
| 3918 * 0: the ambiguous name | 3491 * 0: the ambiguous name |
| 3919 * 1: the name of the dart: library in which the element is found | 3492 * 1: the name of the dart: library in which the element is found |
| 3920 * 1: the name of the non-dart: library in which the element is found | 3493 * 2: the name of the non-dart: library in which the element is found |
| 3921 */ | 3494 */ |
| 3922 static const StaticWarningCode CONFLICTING_DART_IMPORT = | 3495 static const StaticWarningCode CONFLICTING_DART_IMPORT = |
| 3923 const StaticWarningCode('CONFLICTING_DART_IMPORT', | 3496 const StaticWarningCode('CONFLICTING_DART_IMPORT', |
| 3924 "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'"); | 3497 "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'"); |
| 3925 | 3498 |
| 3926 /** | 3499 /** |
| 3927 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an | 3500 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an |
| 3928 * instance getter named <i>v</i> and an accessible static member named | 3501 * instance getter named <i>v</i> and an accessible static member named |
| 3929 * <i>v</i> or <i>v=</i> is declared in a superclass of <i>C</i>. | 3502 * <i>v</i> or <i>v=</i> is declared in a superclass of <i>C</i>. |
| 3930 * | 3503 * |
| 3931 * Parameters: | 3504 * Parameters: |
| 3932 * 0: the name of the super class declaring a static member | 3505 * 0: the name of the super class declaring a static member |
| 3933 */ | 3506 */ |
| 3934 static const StaticWarningCode CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMB
ER = | 3507 static const StaticWarningCode |
| 3508 CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER = |
| 3935 const StaticWarningCode( | 3509 const StaticWarningCode( |
| 3936 'CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER', | 3510 'CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER', |
| 3937 "Superclass '{0}' declares static member with the same name"); | 3511 "Superclass '{0}' declares static member with the same name"); |
| 3938 | 3512 |
| 3939 /** | 3513 /** |
| 3940 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3514 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
| 3941 * an instance method named <i>n</i> and has a setter named <i>n=</i>. | 3515 * an instance method named <i>n</i> and has a setter named <i>n=</i>. |
| 3942 */ | 3516 */ |
| 3943 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER = | 3517 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER = |
| 3944 const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER', | 3518 const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER', |
| 3945 "Class '{0}' declares instance method '{1}', but also has a setter wit
h the same name from '{2}'"); | 3519 "Class '{0}' declares instance method '{1}', but also has a setter wit
h the same name from '{2}'"); |
| 3946 | 3520 |
| 3947 /** | 3521 /** |
| 3948 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3522 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
| 3949 * an instance method named <i>n</i> and has a setter named <i>n=</i>. | 3523 * an instance method named <i>n</i> and has a setter named <i>n=</i>. |
| 3950 */ | 3524 */ |
| 3951 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 = | 3525 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 = |
| 3952 const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER2', | 3526 const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER2', |
| 3953 "Class '{0}' declares the setter '{1}', but also has an instance metho
d in the same class"); | 3527 "Class '{0}' declares the setter '{1}', but also has an instance metho
d in the same class"); |
| 3954 | 3528 |
| 3955 /** | 3529 /** |
| 3956 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an | 3530 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an |
| 3957 * instance setter named <i>v=</i> and an accessible static member named | 3531 * instance setter named <i>v=</i> and an accessible static member named |
| 3958 * <i>v=</i> or <i>v</i> is declared in a superclass of <i>C</i>. | 3532 * <i>v=</i> or <i>v</i> is declared in a superclass of <i>C</i>. |
| 3959 * | 3533 * |
| 3960 * Parameters: | 3534 * Parameters: |
| 3961 * 0: the name of the super class declaring a static member | 3535 * 0: the name of the super class declaring a static member |
| 3962 */ | 3536 */ |
| 3963 static const StaticWarningCode CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMB
ER = | 3537 static const StaticWarningCode |
| 3538 CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER = |
| 3964 const StaticWarningCode( | 3539 const StaticWarningCode( |
| 3965 'CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER', | 3540 'CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER', |
| 3966 "Superclass '{0}' declares static member with the same name"); | 3541 "Superclass '{0}' declares static member with the same name"); |
| 3967 | 3542 |
| 3968 /** | 3543 /** |
| 3969 * 7.2 Getters: It is a static warning if a class declares a static getter | 3544 * 7.2 Getters: It is a static warning if a class declares a static getter |
| 3970 * named <i>v</i> and also has a non-static setter named <i>v=</i>. | 3545 * named <i>v</i> and also has a non-static setter named <i>v=</i>. |
| 3971 */ | 3546 */ |
| 3972 static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER = | 3547 static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER = |
| 3973 const StaticWarningCode('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', | 3548 const StaticWarningCode('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4023 */ | 3598 */ |
| 4024 static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = | 3599 static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = |
| 4025 const StaticWarningCode('EXTRA_POSITIONAL_ARGUMENTS', | 3600 const StaticWarningCode('EXTRA_POSITIONAL_ARGUMENTS', |
| 4026 "{0} positional arguments expected, but {1} found"); | 3601 "{0} positional arguments expected, but {1} found"); |
| 4027 | 3602 |
| 4028 /** | 3603 /** |
| 4029 * 5. Variables: It is a static warning if a final instance variable that has | 3604 * 5. Variables: It is a static warning if a final instance variable that has |
| 4030 * been initialized at its point of declaration is also initialized in a | 3605 * been initialized at its point of declaration is also initialized in a |
| 4031 * constructor. | 3606 * constructor. |
| 4032 */ | 3607 */ |
| 4033 static const StaticWarningCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATIO
N = | 3608 static const StaticWarningCode |
| 3609 FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = |
| 4034 const StaticWarningCode( | 3610 const StaticWarningCode( |
| 4035 'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', | 3611 'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', |
| 4036 "Values cannot be set in the constructor if they are final, and have a
lready been set"); | 3612 "Values cannot be set in the constructor if they are final, and have a
lready been set"); |
| 4037 | 3613 |
| 4038 /** | 3614 /** |
| 4039 * 5. Variables: It is a static warning if a final instance variable that has | 3615 * 5. Variables: It is a static warning if a final instance variable that has |
| 4040 * been initialized at its point of declaration is also initialized in a | 3616 * been initialized at its point of declaration is also initialized in a |
| 4041 * constructor. | 3617 * constructor. |
| 4042 * | 3618 * |
| 4043 * Parameters: | 3619 * Parameters: |
| 4044 * 0: the name of the field in question | 3620 * 0: the name of the field in question |
| 4045 */ | 3621 */ |
| 4046 static const StaticWarningCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTO
R = | 3622 static const StaticWarningCode |
| 3623 FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = |
| 4047 const StaticWarningCode( | 3624 const StaticWarningCode( |
| 4048 'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', | 3625 'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', |
| 4049 "'{0}' is final and was given a value when it was declared, so it cann
ot be set to a new value"); | 3626 "'{0}' is final and was given a value when it was declared, so it cann
ot be set to a new value"); |
| 4050 | 3627 |
| 4051 /** | 3628 /** |
| 4052 * 7.6.1 Generative Constructors: Execution of an initializer of the form | 3629 * 7.6.1 Generative Constructors: Execution of an initializer of the form |
| 4053 * <b>this</b>.<i>v</i> = <i>e</i> proceeds as follows: First, the expression | 3630 * <b>this</b>.<i>v</i> = <i>e</i> proceeds as follows: First, the expression |
| 4054 * <i>e</i> is evaluated to an object <i>o</i>. Then, the instance variable | 3631 * <i>e</i> is evaluated to an object <i>o</i>. Then, the instance variable |
| 4055 * <i>v</i> of the object denoted by this is bound to <i>o</i>. | 3632 * <i>v</i> of the object denoted by this is bound to <i>o</i>. |
| 4056 * | 3633 * |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4085 /** | 3662 /** |
| 4086 * 5 Variables: It is a static warning if a library, static or local variable | 3663 * 5 Variables: It is a static warning if a library, static or local variable |
| 4087 * <i>v</i> is final and <i>v</i> is not initialized at its point of | 3664 * <i>v</i> is final and <i>v</i> is not initialized at its point of |
| 4088 * declaration. | 3665 * declaration. |
| 4089 * | 3666 * |
| 4090 * Parameters: | 3667 * Parameters: |
| 4091 * 0: the name of the uninitialized final variable | 3668 * 0: the name of the uninitialized final variable |
| 4092 */ | 3669 */ |
| 4093 static const StaticWarningCode FINAL_NOT_INITIALIZED = | 3670 static const StaticWarningCode FINAL_NOT_INITIALIZED = |
| 4094 const StaticWarningCode('FINAL_NOT_INITIALIZED', | 3671 const StaticWarningCode('FINAL_NOT_INITIALIZED', |
| 4095 "The final variable '{0}' must be initialized"); | 3672 "The final variable '{0}' must be initialized", null, false); |
| 4096 | 3673 |
| 4097 /** | 3674 /** |
| 4098 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> | 3675 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> |
| 4099 * declared in the immediately enclosing class must have an initializer in | 3676 * declared in the immediately enclosing class must have an initializer in |
| 4100 * <i>k</i>'s initializer list unless it has already been initialized by one | 3677 * <i>k</i>'s initializer list unless it has already been initialized by one |
| 4101 * of the following means: | 3678 * of the following means: |
| 4102 * * Initialization at the declaration of <i>f</i>. | 3679 * * Initialization at the declaration of <i>f</i>. |
| 4103 * * Initialization by means of an initializing formal of <i>k</i>. | 3680 * * Initialization by means of an initializing formal of <i>k</i>. |
| 4104 * or a static warning occurs. | 3681 * or a static warning occurs. |
| 4105 * | 3682 * |
| 4106 * Parameters: | 3683 * Parameters: |
| 4107 * 0: the name of the uninitialized final variable | 3684 * 0: the name of the uninitialized final variable |
| 4108 */ | 3685 */ |
| 4109 static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_1 = | 3686 static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_1 = |
| 4110 const StaticWarningCode('FINAL_NOT_INITIALIZED_CONSTRUCTOR_1', | 3687 const StaticWarningCode('FINAL_NOT_INITIALIZED_CONSTRUCTOR_1', |
| 4111 "The final variable '{0}' must be initialized"); | 3688 "The final variable '{0}' must be initialized", null, false); |
| 4112 | 3689 |
| 4113 /** | 3690 /** |
| 4114 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> | 3691 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> |
| 4115 * declared in the immediately enclosing class must have an initializer in | 3692 * declared in the immediately enclosing class must have an initializer in |
| 4116 * <i>k</i>'s initializer list unless it has already been initialized by one | 3693 * <i>k</i>'s initializer list unless it has already been initialized by one |
| 4117 * of the following means: | 3694 * of the following means: |
| 4118 * * Initialization at the declaration of <i>f</i>. | 3695 * * Initialization at the declaration of <i>f</i>. |
| 4119 * * Initialization by means of an initializing formal of <i>k</i>. | 3696 * * Initialization by means of an initializing formal of <i>k</i>. |
| 4120 * or a static warning occurs. | 3697 * or a static warning occurs. |
| 4121 * | 3698 * |
| 4122 * Parameters: | 3699 * Parameters: |
| 4123 * 0: the name of the uninitialized final variable | 3700 * 0: the name of the uninitialized final variable |
| 4124 * 1: the name of the uninitialized final variable | 3701 * 1: the name of the uninitialized final variable |
| 4125 */ | 3702 */ |
| 4126 static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_2 = | 3703 static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_2 = |
| 4127 const StaticWarningCode('FINAL_NOT_INITIALIZED_CONSTRUCTOR_2', | 3704 const StaticWarningCode( |
| 4128 "The final variables '{0}' and '{1}' must be initialized"); | 3705 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_2', |
| 3706 "The final variables '{0}' and '{1}' must be initialized", |
| 3707 null, |
| 3708 false); |
| 4129 | 3709 |
| 4130 /** | 3710 /** |
| 4131 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> | 3711 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> |
| 4132 * declared in the immediately enclosing class must have an initializer in | 3712 * declared in the immediately enclosing class must have an initializer in |
| 4133 * <i>k</i>'s initializer list unless it has already been initialized by one | 3713 * <i>k</i>'s initializer list unless it has already been initialized by one |
| 4134 * of the following means: | 3714 * of the following means: |
| 4135 * * Initialization at the declaration of <i>f</i>. | 3715 * * Initialization at the declaration of <i>f</i>. |
| 4136 * * Initialization by means of an initializing formal of <i>k</i>. | 3716 * * Initialization by means of an initializing formal of <i>k</i>. |
| 4137 * or a static warning occurs. | 3717 * or a static warning occurs. |
| 4138 * | 3718 * |
| 4139 * Parameters: | 3719 * Parameters: |
| 4140 * 0: the name of the uninitialized final variable | 3720 * 0: the name of the uninitialized final variable |
| 4141 * 1: the name of the uninitialized final variable | 3721 * 1: the name of the uninitialized final variable |
| 4142 * 2: the number of additional not initialized variables that aren't listed | 3722 * 2: the number of additional not initialized variables that aren't listed |
| 4143 */ | 3723 */ |
| 4144 static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS = | 3724 static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS = |
| 4145 const StaticWarningCode('FINAL_NOT_INITIALIZED_CONSTRUCTOR_3', | 3725 const StaticWarningCode( |
| 4146 "The final variables '{0}', '{1}' and '{2}' more must be initialized")
; | 3726 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_3', |
| 3727 "The final variables '{0}', '{1}' and '{2}' more must be initialized", |
| 3728 null, |
| 3729 false); |
| 4147 | 3730 |
| 4148 /** | 3731 /** |
| 4149 * 15.5 Function Types: It is a static warning if a concrete class implements | 3732 * 15.5 Function Types: It is a static warning if a concrete class implements |
| 4150 * Function and does not have a concrete method named call(). | 3733 * Function and does not have a concrete method named call(). |
| 4151 */ | 3734 */ |
| 4152 static const StaticWarningCode FUNCTION_WITHOUT_CALL = const StaticWarningCode
( | 3735 static const StaticWarningCode FUNCTION_WITHOUT_CALL = const StaticWarningCode
( |
| 4153 'FUNCTION_WITHOUT_CALL', | 3736 'FUNCTION_WITHOUT_CALL', |
| 4154 "Concrete classes that implement Function must implement the method call()
"); | 3737 "Concrete classes that implement Function must implement the method call()
"); |
| 4155 | 3738 |
| 4156 /** | 3739 /** |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4183 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause | 3766 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause |
| 4184 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the | 3767 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the |
| 4185 * same name <i>n</i> that would be inherited (because identically named | 3768 * same name <i>n</i> that would be inherited (because identically named |
| 4186 * members existed in several superinterfaces) then at most one member is | 3769 * members existed in several superinterfaces) then at most one member is |
| 4187 * inherited. | 3770 * inherited. |
| 4188 * | 3771 * |
| 4189 * If some but not all of the <i>m<sub>i</sub>, 1 <= i <= k</i> are | 3772 * If some but not all of the <i>m<sub>i</sub>, 1 <= i <= k</i> are |
| 4190 * getters none of the <i>m<sub>i</sub></i> are inherited, and a static | 3773 * getters none of the <i>m<sub>i</sub></i> are inherited, and a static |
| 4191 * warning is issued. | 3774 * warning is issued. |
| 4192 */ | 3775 */ |
| 4193 static const StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METH
OD = | 3776 static const StaticWarningCode |
| 3777 INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD = |
| 4194 const StaticWarningCode( | 3778 const StaticWarningCode( |
| 4195 'INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', | 3779 'INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', |
| 4196 "'{0}' is inherited as a getter and also a method"); | 3780 "'{0}' is inherited as a getter and also a method"); |
| 4197 | 3781 |
| 4198 /** | 3782 /** |
| 4199 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3783 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
| 4200 * an instance method named <i>n</i> and an accessible static member named | 3784 * an instance method named <i>n</i> and an accessible static member named |
| 4201 * <i>n</i> is declared in a superclass of <i>C</i>. | 3785 * <i>n</i> is declared in a superclass of <i>C</i>. |
| 4202 * | 3786 * |
| 4203 * Parameters: | 3787 * Parameters: |
| 4204 * 0: the name of the member with the name conflict | 3788 * 0: the name of the member with the name conflict |
| 4205 * 1: the name of the enclosing class that has the static member | 3789 * 1: the name of the enclosing class that has the static member |
| 4206 */ | 3790 */ |
| 4207 static const StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S
TATIC = | 3791 static const StaticWarningCode |
| 3792 INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC = |
| 4208 const StaticWarningCode( | 3793 const StaticWarningCode( |
| 4209 'INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', | 3794 'INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', |
| 4210 "'{0}' collides with a static member in the superclass '{1}'"); | 3795 "'{0}' collides with a static member in the superclass '{1}'"); |
| 4211 | 3796 |
| 4212 /** | 3797 /** |
| 4213 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a | 3798 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a |
| 4214 * getter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of | 3799 * getter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of |
| 4215 * <i>m2</i>. | 3800 * <i>m2</i>. |
| 4216 * | 3801 * |
| 4217 * Parameters: | 3802 * Parameters: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4235 * 0: the name of the actual parameter type | 3820 * 0: the name of the actual parameter type |
| 4236 * 1: the name of the expected parameter type, not assignable to the actual | 3821 * 1: the name of the expected parameter type, not assignable to the actual |
| 4237 * parameter type | 3822 * parameter type |
| 4238 * 2: the name of the class where the overridden method is declared | 3823 * 2: the name of the class where the overridden method is declared |
| 4239 */ | 3824 */ |
| 4240 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = | 3825 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = |
| 4241 const StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', | 3826 const StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', |
| 4242 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); | 3827 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); |
| 4243 | 3828 |
| 4244 /** | 3829 /** |
| 3830 * Generic Method DEP: number of type parameters must match. |
| 3831 * <https://github.com/leafpetersen/dep-generic-methods/blob/master/proposal.m
d#function-subtyping> |
| 3832 * |
| 3833 * Parameters: |
| 3834 * 0: the number of type parameters in the method |
| 3835 * 1: the number of type parameters in the overridden method |
| 3836 * 2: the name of the class where the overridden method is declared |
| 3837 */ |
| 3838 static const StaticWarningCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS = |
| 3839 const StaticWarningCode('INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS', |
| 3840 "The method has {0} type parameters, but it is overriding a method wit
h {1} type parameters from '{2}'"); |
| 3841 |
| 3842 /** |
| 3843 * Generic Method DEP: bounds of type parameters must be compatible. |
| 3844 * <https://github.com/leafpetersen/dep-generic-methods/blob/master/proposal.m
d#function-subtyping> |
| 3845 * |
| 3846 * Parameters: |
| 3847 * 0: the type parameter name |
| 3848 * 1: the type parameter bound |
| 3849 * 2: the overridden type parameter name |
| 3850 * 3: the overridden type parameter bound |
| 3851 * 4: the name of the class where the overridden method is declared |
| 3852 */ |
| 3853 static const StaticWarningCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND = |
| 3854 const StaticWarningCode('INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND', |
| 3855 "The type parameter '{0}' extends '{1}', but that is stricter than '{2
}' extends '{3}' in the overridden method from '{4}'"); |
| 3856 |
| 3857 /** |
| 4245 * 7.1 Instance Methods: It is a static warning if an instance method | 3858 * 7.1 Instance Methods: It is a static warning if an instance method |
| 4246 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 3859 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
| 4247 * is not a subtype of the type of <i>m2</i>. | 3860 * is not a subtype of the type of <i>m2</i>. |
| 4248 * | 3861 * |
| 4249 * Parameters: | 3862 * Parameters: |
| 4250 * 0: the name of the actual parameter type | 3863 * 0: the name of the actual parameter type |
| 4251 * 1: the name of the expected parameter type, not assignable to the actual | 3864 * 1: the name of the expected parameter type, not assignable to the actual |
| 4252 * parameter type | 3865 * parameter type |
| 4253 * 2: the name of the class where the overridden method is declared | 3866 * 2: the name of the class where the overridden method is declared |
| 4254 * See [INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]. | 3867 * See [INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4289 const StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', | 3902 const StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', |
| 4290 "The return type '{0}' is not assignable to '{1}' as required by the m
ethod it is overriding from '{2}'"); | 3903 "The return type '{0}' is not assignable to '{1}' as required by the m
ethod it is overriding from '{2}'"); |
| 4291 | 3904 |
| 4292 /** | 3905 /** |
| 4293 * 7.1 Instance Methods: It is a static warning if an instance method | 3906 * 7.1 Instance Methods: It is a static warning if an instance method |
| 4294 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of | 3907 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of |
| 4295 * <i>m2</i> explicitly specifies a default value for a formal parameter | 3908 * <i>m2</i> explicitly specifies a default value for a formal parameter |
| 4296 * <i>p</i> and the signature of <i>m1</i> specifies a different default value | 3909 * <i>p</i> and the signature of <i>m1</i> specifies a different default value |
| 4297 * for <i>p</i>. | 3910 * for <i>p</i>. |
| 4298 */ | 3911 */ |
| 4299 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED
= | 3912 static const StaticWarningCode |
| 4300 const StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', | 3913 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = const StaticWarningCode( |
| 3914 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', |
| 4301 "Parameters cannot override default values, this method overrides '{0}
.{1}' where '{2}' has a different value"); | 3915 "Parameters cannot override default values, this method overrides '{0}
.{1}' where '{2}' has a different value"); |
| 4302 | 3916 |
| 4303 /** | 3917 /** |
| 4304 * 7.1 Instance Methods: It is a static warning if an instance method | 3918 * 7.1 Instance Methods: It is a static warning if an instance method |
| 4305 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of | 3919 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of |
| 4306 * <i>m2</i> explicitly specifies a default value for a formal parameter | 3920 * <i>m2</i> explicitly specifies a default value for a formal parameter |
| 4307 * <i>p</i> and the signature of <i>m1</i> specifies a different default value | 3921 * <i>p</i> and the signature of <i>m1</i> specifies a different default value |
| 4308 * for <i>p</i>. | 3922 * for <i>p</i>. |
| 4309 */ | 3923 */ |
| 4310 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSIT
IONAL = | 3924 static const StaticWarningCode |
| 3925 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL = |
| 4311 const StaticWarningCode( | 3926 const StaticWarningCode( |
| 4312 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', | 3927 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', |
| 4313 "Parameters cannot override default values, this method overrides '{0}
.{1}' where this positional parameter has a different value"); | 3928 "Parameters cannot override default values, this method overrides '{0}
.{1}' where this positional parameter has a different value"); |
| 4314 | 3929 |
| 4315 /** | 3930 /** |
| 4316 * 7.1 Instance Methods: It is a static warning if an instance method | 3931 * 7.1 Instance Methods: It is a static warning if an instance method |
| 4317 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> does not | 3932 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> does not |
| 4318 * declare all the named parameters declared by <i>m2</i>. | 3933 * declare all the named parameters declared by <i>m2</i>. |
| 4319 * | 3934 * |
| 4320 * Parameters: | 3935 * Parameters: |
| 4321 * 0: the number of named parameters in the overridden member | 3936 * 0: the number of named parameters in the overridden member |
| 4322 * 1: the name of the class from the overridden method | 3937 * 1: the signature of the overridden member |
| 3938 * 2: the name of the class from the overridden method |
| 4323 */ | 3939 */ |
| 4324 static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCod
e( | 3940 static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCod
e( |
| 4325 'INVALID_OVERRIDE_NAMED', | 3941 'INVALID_OVERRIDE_NAMED', |
| 4326 "Missing the named parameter '{0}' to match the overridden method from '{1
}'"); | 3942 "Missing the named parameter '{0}' to match the overridden method from '{1
}' from '{2}'"); |
| 4327 | 3943 |
| 4328 /** | 3944 /** |
| 4329 * 7.1 Instance Methods: It is a static warning if an instance method | 3945 * 7.1 Instance Methods: It is a static warning if an instance method |
| 4330 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has fewer | 3946 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has fewer |
| 4331 * positional parameters than <i>m2</i>. | 3947 * positional parameters than <i>m2</i>. |
| 4332 * | 3948 * |
| 4333 * Parameters: | 3949 * Parameters: |
| 4334 * 0: the number of positional parameters in the overridden member | 3950 * 0: the number of positional parameters in the overridden member |
| 4335 * 1: the name of the class from the overridden method | 3951 * 1: the signature of the overridden member |
| 3952 * 2: the name of the class from the overridden method |
| 4336 */ | 3953 */ |
| 4337 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = | 3954 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = |
| 4338 const StaticWarningCode('INVALID_OVERRIDE_POSITIONAL', | 3955 const StaticWarningCode('INVALID_OVERRIDE_POSITIONAL', |
| 4339 "Must have at least {0} parameters to match the overridden method from
'{1}'"); | 3956 "Must have at least {0} parameters to match the overridden method '{1}
' from '{2}'"); |
| 4340 | 3957 |
| 4341 /** | 3958 /** |
| 4342 * 7.1 Instance Methods: It is a static warning if an instance method | 3959 * 7.1 Instance Methods: It is a static warning if an instance method |
| 4343 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has a | 3960 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has a |
| 4344 * greater number of required parameters than <i>m2</i>. | 3961 * greater number of required parameters than <i>m2</i>. |
| 4345 * | 3962 * |
| 4346 * Parameters: | 3963 * Parameters: |
| 4347 * 0: the number of required parameters in the overridden member | 3964 * 0: the number of required parameters in the overridden member |
| 4348 * 1: the name of the class from the overridden method | 3965 * 1: the signature of the overridden member |
| 3966 * 2: the name of the class from the overridden method |
| 4349 */ | 3967 */ |
| 4350 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = | 3968 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = |
| 4351 const StaticWarningCode('INVALID_OVERRIDE_REQUIRED', | 3969 const StaticWarningCode('INVALID_OVERRIDE_REQUIRED', |
| 4352 "Must have {0} required parameters or less to match the overridden met
hod from '{1}'"); | 3970 "Must have {0} required parameters or less to match the overridden met
hod '{1}' from '{2}'"); |
| 4353 | 3971 |
| 4354 /** | 3972 /** |
| 4355 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a | 3973 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a |
| 4356 * setter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of | 3974 * setter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of |
| 4357 * <i>m2</i>. | 3975 * <i>m2</i>. |
| 4358 * | 3976 * |
| 4359 * Parameters: | 3977 * Parameters: |
| 4360 * 0: the name of the actual parameter type | 3978 * 0: the name of the actual parameter type |
| 4361 * 1: the name of the expected parameter type, not assignable to the actual | 3979 * 1: the name of the expected parameter type, not assignable to the actual |
| 4362 * parameter type | 3980 * parameter type |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4422 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = | 4040 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = |
| 4423 const StaticWarningCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE', | 4041 const StaticWarningCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE', |
| 4424 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); | 4042 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); |
| 4425 | 4043 |
| 4426 /** | 4044 /** |
| 4427 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> | 4045 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> |
| 4428 * with argument type <i>T</i> and a getter named <i>v</i> with return type | 4046 * with argument type <i>T</i> and a getter named <i>v</i> with return type |
| 4429 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. | 4047 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. |
| 4430 */ | 4048 */ |
| 4431 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = | 4049 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = |
| 4432 const StaticWarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES', | 4050 const StaticWarningCode( |
| 4433 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}')"); | 4051 'MISMATCHED_GETTER_AND_SETTER_TYPES', |
| 4052 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}')", |
| 4053 null, |
| 4054 false); |
| 4434 | 4055 |
| 4435 /** | 4056 /** |
| 4436 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> | 4057 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> |
| 4437 * with argument type <i>T</i> and a getter named <i>v</i> with return type | 4058 * with argument type <i>T</i> and a getter named <i>v</i> with return type |
| 4438 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. | 4059 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. |
| 4439 */ | 4060 */ |
| 4440 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTY
PE = | 4061 static const StaticWarningCode |
| 4062 MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE = |
| 4441 const StaticWarningCode( | 4063 const StaticWarningCode( |
| 4442 'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE', | 4064 'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE', |
| 4443 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'"); | 4065 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'", |
| 4066 null, |
| 4067 false); |
| 4068 |
| 4069 /** |
| 4070 * 17.9 Switch: It is a static warning if all of the following conditions |
| 4071 * hold: |
| 4072 * * The switch statement does not have a 'default' clause. |
| 4073 * * The static type of <i>e</i> is an enumerated typed with elements |
| 4074 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. |
| 4075 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and |
| 4076 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the |
| 4077 * same. |
| 4078 * |
| 4079 * Parameters: |
| 4080 * 0: the name of the constant that is missing |
| 4081 */ |
| 4082 static const StaticWarningCode MISSING_ENUM_CONSTANT_IN_SWITCH = |
| 4083 const StaticWarningCode( |
| 4084 'MISSING_ENUM_CONSTANT_IN_SWITCH', |
| 4085 "Missing case clause for '{0}'", |
| 4086 "Add a case clause for the missing constant or add a default clause.", |
| 4087 false); |
| 4444 | 4088 |
| 4445 /** | 4089 /** |
| 4446 * 13.12 Return: It is a static warning if a function contains both one or | 4090 * 13.12 Return: It is a static warning if a function contains both one or |
| 4447 * more return statements of the form <i>return;</i> and one or more return | 4091 * more return statements of the form <i>return;</i> and one or more return |
| 4448 * statements of the form <i>return e;</i>. | 4092 * statements of the form <i>return e;</i>. |
| 4449 */ | 4093 */ |
| 4450 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode( | 4094 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode( |
| 4451 'MIXED_RETURN_TYPES', | 4095 'MIXED_RETURN_TYPES', |
| 4452 "Methods and functions cannot use return both with and without values"); | 4096 "Methods and functions cannot use return both with and without values", |
| 4097 null, |
| 4098 false); |
| 4453 | 4099 |
| 4454 /** | 4100 /** |
| 4455 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an | 4101 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an |
| 4456 * abstract class and <i>q</i> is not a factory constructor. | 4102 * abstract class and <i>q</i> is not a factory constructor. |
| 4457 */ | 4103 */ |
| 4458 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = | 4104 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = |
| 4459 const StaticWarningCode('NEW_WITH_ABSTRACT_CLASS', | 4105 const StaticWarningCode('NEW_WITH_ABSTRACT_CLASS', |
| 4460 "Abstract classes cannot be created with a 'new' expression"); | 4106 "Abstract classes cannot be created with a 'new' expression"); |
| 4461 | 4107 |
| 4462 /** | 4108 /** |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4532 * is declared or inherited in a concrete class unless that member overrides a | 4178 * is declared or inherited in a concrete class unless that member overrides a |
| 4533 * concrete one. | 4179 * concrete one. |
| 4534 * | 4180 * |
| 4535 * Parameters: | 4181 * Parameters: |
| 4536 * 0: the name of the first member | 4182 * 0: the name of the first member |
| 4537 * 1: the name of the second member | 4183 * 1: the name of the second member |
| 4538 * 2: the name of the third member | 4184 * 2: the name of the third member |
| 4539 * 3: the name of the fourth member | 4185 * 3: the name of the fourth member |
| 4540 * 4: the number of additional missing members that aren't listed | 4186 * 4: the number of additional missing members that aren't listed |
| 4541 */ | 4187 */ |
| 4542 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIV
E_PLUS = | 4188 static const StaticWarningCode |
| 4189 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = |
| 4543 const StaticWarningCode( | 4190 const StaticWarningCode( |
| 4544 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', | 4191 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', |
| 4545 "Missing concrete implementation of {0}, {1}, {2}, {3} and {4} more"); | 4192 "Missing concrete implementation of {0}, {1}, {2}, {3} and {4} more"); |
| 4546 | 4193 |
| 4547 /** | 4194 /** |
| 4548 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4195 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
| 4549 * class inherits an abstract method. | 4196 * class inherits an abstract method. |
| 4550 * | 4197 * |
| 4551 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4198 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
| 4552 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4199 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
| 4553 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4200 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
| 4554 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4201 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
| 4555 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4202 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
| 4556 * | 4203 * |
| 4557 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4204 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
| 4558 * is declared or inherited in a concrete class unless that member overrides a | 4205 * is declared or inherited in a concrete class unless that member overrides a |
| 4559 * concrete one. | 4206 * concrete one. |
| 4560 * | 4207 * |
| 4561 * Parameters: | 4208 * Parameters: |
| 4562 * 0: the name of the first member | 4209 * 0: the name of the first member |
| 4563 * 1: the name of the second member | 4210 * 1: the name of the second member |
| 4564 * 2: the name of the third member | 4211 * 2: the name of the third member |
| 4565 * 3: the name of the fourth member | 4212 * 3: the name of the fourth member |
| 4566 */ | 4213 */ |
| 4567 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOU
R = | 4214 static const StaticWarningCode |
| 4215 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = |
| 4568 const StaticWarningCode( | 4216 const StaticWarningCode( |
| 4569 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', | 4217 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', |
| 4570 "Missing concrete implementation of {0}, {1}, {2} and {3}"); | 4218 "Missing concrete implementation of {0}, {1}, {2} and {3}"); |
| 4571 | 4219 |
| 4572 /** | 4220 /** |
| 4573 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4221 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
| 4574 * class inherits an abstract method. | 4222 * class inherits an abstract method. |
| 4575 * | 4223 * |
| 4576 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4224 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
| 4577 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4225 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
| 4578 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4226 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
| 4579 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4227 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
| 4580 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4228 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
| 4581 * | 4229 * |
| 4582 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4230 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
| 4583 * is declared or inherited in a concrete class unless that member overrides a | 4231 * is declared or inherited in a concrete class unless that member overrides a |
| 4584 * concrete one. | 4232 * concrete one. |
| 4585 * | 4233 * |
| 4586 * Parameters: | 4234 * Parameters: |
| 4587 * 0: the name of the member | 4235 * 0: the name of the member |
| 4588 */ | 4236 */ |
| 4589 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE
= | 4237 static const StaticWarningCode |
| 4590 const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', | 4238 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = const StaticWarningCode( |
| 4239 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', |
| 4591 "Missing concrete implementation of {0}"); | 4240 "Missing concrete implementation of {0}"); |
| 4592 | 4241 |
| 4593 /** | 4242 /** |
| 4594 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4243 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
| 4595 * class inherits an abstract method. | 4244 * class inherits an abstract method. |
| 4596 * | 4245 * |
| 4597 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4246 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
| 4598 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4247 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
| 4599 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4248 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
| 4600 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4249 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
| 4601 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4250 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
| 4602 * | 4251 * |
| 4603 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4252 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
| 4604 * is declared or inherited in a concrete class unless that member overrides a | 4253 * is declared or inherited in a concrete class unless that member overrides a |
| 4605 * concrete one. | 4254 * concrete one. |
| 4606 * | 4255 * |
| 4607 * Parameters: | 4256 * Parameters: |
| 4608 * 0: the name of the first member | 4257 * 0: the name of the first member |
| 4609 * 1: the name of the second member | 4258 * 1: the name of the second member |
| 4610 * 2: the name of the third member | 4259 * 2: the name of the third member |
| 4611 */ | 4260 */ |
| 4612 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THR
EE = | 4261 static const StaticWarningCode |
| 4262 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = |
| 4613 const StaticWarningCode( | 4263 const StaticWarningCode( |
| 4614 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', | 4264 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', |
| 4615 "Missing concrete implementation of {0}, {1} and {2}"); | 4265 "Missing concrete implementation of {0}, {1} and {2}"); |
| 4616 | 4266 |
| 4617 /** | 4267 /** |
| 4618 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4268 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
| 4619 * class inherits an abstract method. | 4269 * class inherits an abstract method. |
| 4620 * | 4270 * |
| 4621 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4271 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
| 4622 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4272 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
| 4623 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4273 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
| 4624 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4274 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
| 4625 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4275 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
| 4626 * | 4276 * |
| 4627 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4277 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
| 4628 * is declared or inherited in a concrete class unless that member overrides a | 4278 * is declared or inherited in a concrete class unless that member overrides a |
| 4629 * concrete one. | 4279 * concrete one. |
| 4630 * | 4280 * |
| 4631 * Parameters: | 4281 * Parameters: |
| 4632 * 0: the name of the first member | 4282 * 0: the name of the first member |
| 4633 * 1: the name of the second member | 4283 * 1: the name of the second member |
| 4634 */ | 4284 */ |
| 4635 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO
= | 4285 static const StaticWarningCode |
| 4636 const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', | 4286 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = const StaticWarningCode( |
| 4287 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', |
| 4637 "Missing concrete implementation of {0} and {1}"); | 4288 "Missing concrete implementation of {0} and {1}"); |
| 4638 | 4289 |
| 4639 /** | 4290 /** |
| 4640 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, | 4291 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, |
| 4641 * p<sub>2</sub>) s</i> or <i>on T s</i> matches an object <i>o</i> if the | 4292 * p<sub>2</sub>) s</i> or <i>on T s</i> matches an object <i>o</i> if the |
| 4642 * type of <i>o</i> is a subtype of <i>T</i>. It is a static warning if | 4293 * type of <i>o</i> is a subtype of <i>T</i>. It is a static warning if |
| 4643 * <i>T</i> does not denote a type available in the lexical scope of the | 4294 * <i>T</i> does not denote a type available in the lexical scope of the |
| 4644 * catch clause. | 4295 * catch clause. |
| 4645 * | 4296 * |
| 4646 * Parameters: | 4297 * Parameters: |
| 4647 * 0: the name of the non-type element | 4298 * 0: the name of the non-type element |
| 4648 */ | 4299 */ |
| 4649 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = | 4300 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = |
| 4650 const StaticWarningCode('NON_TYPE_IN_CATCH_CLAUSE', | 4301 const StaticWarningCode('NON_TYPE_IN_CATCH_CLAUSE', |
| 4651 "The name '{0}' is not a type and cannot be used in an on-catch clause
"); | 4302 "The name '{0}' is not a type and cannot be used in an on-catch clause
"); |
| 4652 | 4303 |
| 4653 /** | 4304 /** |
| 4654 * 7.1.1 Operators: It is a static warning if the return type of the | 4305 * 7.1.1 Operators: It is a static warning if the return type of the |
| 4655 * user-declared operator []= is explicitly declared and not void. | 4306 * user-declared operator []= is explicitly declared and not void. |
| 4656 */ | 4307 */ |
| 4657 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = | 4308 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = |
| 4658 const StaticWarningCode('NON_VOID_RETURN_FOR_OPERATOR', | 4309 const StaticWarningCode('NON_VOID_RETURN_FOR_OPERATOR', |
| 4659 "The return type of the operator []= must be 'void'"); | 4310 "The return type of the operator []= must be 'void'", null, false); |
| 4660 | 4311 |
| 4661 /** | 4312 /** |
| 4662 * 7.3 Setters: It is a static warning if a setter declares a return type | 4313 * 7.3 Setters: It is a static warning if a setter declares a return type |
| 4663 * other than void. | 4314 * other than void. |
| 4664 */ | 4315 */ |
| 4665 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = | 4316 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = |
| 4666 const StaticWarningCode('NON_VOID_RETURN_FOR_SETTER', | 4317 const StaticWarningCode('NON_VOID_RETURN_FOR_SETTER', |
| 4667 "The return type of the setter must be 'void'"); | 4318 "The return type of the setter must be 'void'", null, false); |
| 4668 | 4319 |
| 4669 /** | 4320 /** |
| 4670 * 15.1 Static Types: A type <i>T</i> is malformed iff: | 4321 * 15.1 Static Types: A type <i>T</i> is malformed iff: |
| 4671 * * <i>T</i> has the form <i>id</i> or the form <i>prefix.id</i>, and in the | 4322 * * <i>T</i> has the form <i>id</i> or the form <i>prefix.id</i>, and in the |
| 4672 * enclosing lexical scope, the name <i>id</i> (respectively | 4323 * enclosing lexical scope, the name <i>id</i> (respectively |
| 4673 * <i>prefix.id</i>) does not denote a type. | 4324 * <i>prefix.id</i>) does not denote a type. |
| 4674 * * <i>T</i> denotes a type parameter in the enclosing lexical scope, but | 4325 * * <i>T</i> denotes a type parameter in the enclosing lexical scope, but |
| 4675 * occurs in the signature or body of a static member. | 4326 * occurs in the signature or body of a static member. |
| 4676 * * <i>T</i> is a parameterized type of the form <i>G<S<sub>1</sub>, .., | 4327 * * <i>T</i> is a parameterized type of the form <i>G<S<sub>1</sub>, .., |
| 4677 * S<sub>n</sub>></i>, | 4328 * S<sub>n</sub>></i>, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4756 "The name '{0}' is not a type and cannot be used in a redirected construct
or"); | 4407 "The name '{0}' is not a type and cannot be used in a redirected construct
or"); |
| 4757 | 4408 |
| 4758 /** | 4409 /** |
| 4759 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return | 4410 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return |
| 4760 * statement of the form <i>return;</i> It is a static warning if both of the | 4411 * statement of the form <i>return;</i> It is a static warning if both of the |
| 4761 * following conditions hold: | 4412 * following conditions hold: |
| 4762 * * <i>f</i> is not a generative constructor. | 4413 * * <i>f</i> is not a generative constructor. |
| 4763 * * The return type of <i>f</i> may not be assigned to void. | 4414 * * The return type of <i>f</i> may not be assigned to void. |
| 4764 */ | 4415 */ |
| 4765 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode( | 4416 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode( |
| 4766 'RETURN_WITHOUT_VALUE', "Missing return value after 'return'"); | 4417 'RETURN_WITHOUT_VALUE', |
| 4418 "Missing return value after 'return'", |
| 4419 null, |
| 4420 false); |
| 4767 | 4421 |
| 4768 /** | 4422 /** |
| 4769 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not | 4423 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not |
| 4770 * declare a static method or getter <i>m</i>. | 4424 * declare a static method or getter <i>m</i>. |
| 4771 * | 4425 * |
| 4772 * Parameters: | 4426 * Parameters: |
| 4773 * 0: the name of the instance member | 4427 * 0: the name of the instance member |
| 4774 */ | 4428 */ |
| 4775 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = | 4429 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = |
| 4776 const StaticWarningCode('STATIC_ACCESS_TO_INSTANCE_MEMBER', | 4430 const StaticWarningCode('STATIC_ACCESS_TO_INSTANCE_MEMBER', |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4815 /** | 4469 /** |
| 4816 * 10 Generics: However, a type parameter is considered to be a malformed type | 4470 * 10 Generics: However, a type parameter is considered to be a malformed type |
| 4817 * when referenced by a static member. | 4471 * when referenced by a static member. |
| 4818 * | 4472 * |
| 4819 * 15.1 Static Types: Any use of a malformed type gives rise to a static | 4473 * 15.1 Static Types: Any use of a malformed type gives rise to a static |
| 4820 * warning. A malformed type is then interpreted as dynamic by the static type | 4474 * warning. A malformed type is then interpreted as dynamic by the static type |
| 4821 * checker and the runtime. | 4475 * checker and the runtime. |
| 4822 */ | 4476 */ |
| 4823 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = | 4477 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = |
| 4824 const StaticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC', | 4478 const StaticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC', |
| 4825 "Static members cannot reference type parameters"); | 4479 "Static members cannot reference type parameters of the class"); |
| 4826 | 4480 |
| 4827 /** | 4481 /** |
| 4828 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form | 4482 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form |
| 4829 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 4483 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
| 4830 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 4484 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
| 4831 * static warning if <i>C</i> does not denote a class in the current scope. | 4485 * static warning if <i>C</i> does not denote a class in the current scope. |
| 4832 * | 4486 * |
| 4833 * Parameters: | 4487 * Parameters: |
| 4834 * 0: the name of the undefined class | 4488 * 0: the name of the undefined class |
| 4835 */ | 4489 */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4847 * 12.17 Getter Invocation: It is a static warning if there is no class | 4501 * 12.17 Getter Invocation: It is a static warning if there is no class |
| 4848 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 4502 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
| 4849 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 4503 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
| 4850 * | 4504 * |
| 4851 * Parameters: | 4505 * Parameters: |
| 4852 * 0: the name of the getter | 4506 * 0: the name of the getter |
| 4853 * 1: the name of the enclosing type where the getter is being looked for | 4507 * 1: the name of the enclosing type where the getter is being looked for |
| 4854 */ | 4508 */ |
| 4855 static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode( | 4509 static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode( |
| 4856 'UNDEFINED_GETTER', | 4510 'UNDEFINED_GETTER', |
| 4857 "The getter '{0}' is not defined for the class '{1}'"); | 4511 "The getter '{0}' is not defined for the class '{1}'.", |
| 4512 null); |
| 4858 | 4513 |
| 4859 /** | 4514 /** |
| 4860 * 12.30 Identifier Reference: It is as static warning if an identifier | 4515 * 12.30 Identifier Reference: It is as static warning if an identifier |
| 4861 * expression of the form <i>id</i> occurs inside a top level or static | 4516 * expression of the form <i>id</i> occurs inside a top level or static |
| 4862 * function (be it function, method, getter, or setter) or variable | 4517 * function (be it function, method, getter, or setter) or variable |
| 4863 * initializer and there is no declaration <i>d</i> with name <i>id</i> in the | 4518 * initializer and there is no declaration <i>d</i> with name <i>id</i> in the |
| 4864 * lexical scope enclosing the expression. | 4519 * lexical scope enclosing the expression. |
| 4865 * | 4520 * |
| 4866 * Parameters: | 4521 * Parameters: |
| 4867 * 0: the name of the identifier | 4522 * 0: the name of the identifier |
| 4868 */ | 4523 */ |
| 4869 static const StaticWarningCode UNDEFINED_IDENTIFIER = | 4524 static const StaticWarningCode UNDEFINED_IDENTIFIER = |
| 4870 const StaticWarningCode('UNDEFINED_IDENTIFIER', "Undefined name '{0}'"); | 4525 const StaticWarningCode('UNDEFINED_IDENTIFIER', "Undefined name '{0}'"); |
| 4871 | 4526 |
| 4872 /** | 4527 /** |
| 4528 * If the identifier is 'await', be helpful about it. |
| 4529 */ |
| 4530 static const StaticWarningCode UNDEFINED_IDENTIFIER_AWAIT = |
| 4531 const StaticWarningCode('UNDEFINED_IDENTIFIER_AWAIT', |
| 4532 "Undefined name 'await'; did you mean to add the 'async' marker to '{0
}'?"); |
| 4533 |
| 4534 /** |
| 4873 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, | 4535 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, |
| 4874 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set | 4536 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set |
| 4875 * {<i>p<sub>n+1</sub></i> … <i>p<sub>n+k</sub></i>} or a static | 4537 * {<i>p<sub>n+1</sub></i> … <i>p<sub>n+k</sub></i>} or a static |
| 4876 * warning occurs. | 4538 * warning occurs. |
| 4877 * | 4539 * |
| 4878 * Parameters: | 4540 * Parameters: |
| 4879 * 0: the name of the requested named parameter | 4541 * 0: the name of the requested named parameter |
| 4880 */ | 4542 */ |
| 4881 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = | 4543 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = |
| 4882 const StaticWarningCode('UNDEFINED_NAMED_PARAMETER', | 4544 const StaticWarningCode('UNDEFINED_NAMED_PARAMETER', |
| 4883 "The named parameter '{0}' is not defined"); | 4545 "The named parameter '{0}' is not defined"); |
| 4884 | 4546 |
| 4885 /** | 4547 /** |
| 4886 * 12.18 Assignment: It is as static warning if an assignment of the form | 4548 * 12.18 Assignment: It is as static warning if an assignment of the form |
| 4887 * <i>v = e</i> occurs inside a top level or static function (be it function, | 4549 * <i>v = e</i> occurs inside a top level or static function (be it function, |
| 4888 * method, getter, or setter) or variable initializer and there is no | 4550 * method, getter, or setter) or variable initializer and there is no |
| 4889 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the | 4551 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the |
| 4890 * assignment. | 4552 * assignment. |
| 4891 * | 4553 * |
| 4892 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in | 4554 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in |
| 4893 * the enclosing lexical scope of the assignment, or if <i>C</i> does not | 4555 * the enclosing lexical scope of the assignment, or if <i>C</i> does not |
| 4894 * declare, implicitly or explicitly, a setter <i>v=</i>. | 4556 * declare, implicitly or explicitly, a setter <i>v=</i>. |
| 4895 * | 4557 * |
| 4896 * Parameters: | 4558 * Parameters: |
| 4897 * 0: the name of the getter | 4559 * 0: the name of the getter |
| 4898 * 1: the name of the enclosing type where the setter is being looked for | 4560 * 1: the name of the enclosing type where the setter is being looked for |
| 4899 */ | 4561 */ |
| 4900 static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode( | 4562 static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode( |
| 4901 'UNDEFINED_SETTER', | 4563 'UNDEFINED_SETTER', |
| 4902 "The setter '{0}' is not defined for the class '{1}'"); | 4564 "The setter '{0}' is not defined for the class '{1}'.", |
| 4565 null); |
| 4903 | 4566 |
| 4904 /** | 4567 /** |
| 4905 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not | 4568 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not |
| 4906 * declare a static method or getter <i>m</i>. | 4569 * declare a static method or getter <i>m</i>. |
| 4907 * | 4570 * |
| 4908 * Parameters: | 4571 * Parameters: |
| 4909 * 0: the name of the method | 4572 * 0: the name of the method |
| 4910 * 1: the name of the enclosing type where the method is being looked for | 4573 * 1: the name of the enclosing type where the method is being looked for |
| 4911 */ | 4574 */ |
| 4912 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = | 4575 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = |
| 4913 const StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', | 4576 const StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', |
| 4914 "The static method, getter or setter '{0}' is not defined for the clas
s '{1}'"); | 4577 "The static method, getter or setter '{0}' is not defined for the clas
s '{1}'"); |
| 4915 | 4578 |
| 4916 /** | 4579 /** |
| 4917 * 12.17 Getter Invocation: It is a static warning if there is no class | 4580 * 12.17 Getter Invocation: It is a static warning if there is no class |
| 4918 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 4581 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
| 4919 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 4582 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
| 4920 * | 4583 * |
| 4921 * Parameters: | 4584 * Parameters: |
| 4922 * 0: the name of the getter | 4585 * 0: the name of the getter |
| 4923 * 1: the name of the enclosing type where the getter is being looked for | 4586 * 1: the name of the enclosing type where the getter is being looked for |
| 4924 */ | 4587 */ |
| 4925 static const StaticWarningCode UNDEFINED_SUPER_GETTER = | 4588 static const StaticWarningCode UNDEFINED_SUPER_GETTER = |
| 4926 const StaticWarningCode('UNDEFINED_SUPER_GETTER', | 4589 const StaticWarningCode('UNDEFINED_SUPER_GETTER', |
| 4927 "The getter '{0}' is not defined in a superclass of '{1}'"); | 4590 "The getter '{0}' is not defined in a superclass of '{1}'.", null); |
| 4928 | 4591 |
| 4929 /** | 4592 /** |
| 4930 * 12.18 Assignment: It is as static warning if an assignment of the form | 4593 * 12.18 Assignment: It is as static warning if an assignment of the form |
| 4931 * <i>v = e</i> occurs inside a top level or static function (be it function, | 4594 * <i>v = e</i> occurs inside a top level or static function (be it function, |
| 4932 * method, getter, or setter) or variable initializer and there is no | 4595 * method, getter, or setter) or variable initializer and there is no |
| 4933 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the | 4596 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the |
| 4934 * assignment. | 4597 * assignment. |
| 4935 * | 4598 * |
| 4936 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in | 4599 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in |
| 4937 * the enclosing lexical scope of the assignment, or if <i>C</i> does not | 4600 * the enclosing lexical scope of the assignment, or if <i>C</i> does not |
| 4938 * declare, implicitly or explicitly, a setter <i>v=</i>. | 4601 * declare, implicitly or explicitly, a setter <i>v=</i>. |
| 4939 * | 4602 * |
| 4940 * Parameters: | 4603 * Parameters: |
| 4941 * 0: the name of the getter | 4604 * 0: the name of the getter |
| 4942 * 1: the name of the enclosing type where the setter is being looked for | 4605 * 1: the name of the enclosing type where the setter is being looked for |
| 4943 */ | 4606 */ |
| 4944 static const StaticWarningCode UNDEFINED_SUPER_SETTER = | 4607 static const StaticWarningCode UNDEFINED_SUPER_SETTER = |
| 4945 const StaticWarningCode('UNDEFINED_SUPER_SETTER', | 4608 const StaticWarningCode('UNDEFINED_SUPER_SETTER', |
| 4946 "The setter '{0}' is not defined in a superclass of '{1}'"); | 4609 "The setter '{0}' is not defined in a superclass of '{1}'.", null); |
| 4947 | 4610 |
| 4948 /** | 4611 /** |
| 4949 * 7.2 Getters: It is a static warning if the return type of a getter is void. | 4612 * 7.2 Getters: It is a static warning if the return type of a getter is void. |
| 4950 */ | 4613 */ |
| 4951 static const StaticWarningCode VOID_RETURN_FOR_GETTER = | 4614 static const StaticWarningCode VOID_RETURN_FOR_GETTER = |
| 4952 const StaticWarningCode('VOID_RETURN_FOR_GETTER', | 4615 const StaticWarningCode('VOID_RETURN_FOR_GETTER', |
| 4953 "The return type of the getter must not be 'void'"); | 4616 "The return type of the getter must not be 'void'", null, false); |
| 4617 |
| 4618 /** |
| 4619 * A flag indicating whether this warning is an error when running with strong |
| 4620 * mode enabled. |
| 4621 */ |
| 4622 final bool isStrongModeError; |
| 4954 | 4623 |
| 4955 /** | 4624 /** |
| 4956 * Initialize a newly created error code to have the given [name]. The message | 4625 * Initialize a newly created error code to have the given [name]. The message |
| 4957 * associated with the error will be created from the given [message] | 4626 * associated with the error will be created from the given [message] |
| 4958 * template. The correction associated with the error will be created from the | 4627 * template. The correction associated with the error will be created from the |
| 4959 * given [correction] template. | 4628 * given [correction] template. |
| 4960 */ | 4629 */ |
| 4961 const StaticWarningCode(String name, String message, [String correction]) | 4630 const StaticWarningCode(String name, String message, |
| 4631 [String correction, this.isStrongModeError = true]) |
| 4962 : super(name, message, correction); | 4632 : super(name, message, correction); |
| 4963 | 4633 |
| 4964 @override | 4634 @override |
| 4965 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; | 4635 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; |
| 4966 | 4636 |
| 4967 @override | 4637 @override |
| 4968 ErrorType get type => ErrorType.STATIC_WARNING; | 4638 ErrorType get type => ErrorType.STATIC_WARNING; |
| 4969 } | 4639 } |
| 4970 | 4640 |
| 4971 /** | 4641 /** |
| 4642 * This class has Strong Mode specific error codes. |
| 4643 * |
| 4644 * These error codes tend to use the same message across different severity |
| 4645 * levels, so they are grouped for clarity. |
| 4646 * |
| 4647 * All of these error codes also use the "STRONG_MODE_" prefix in their name. |
| 4648 */ |
| 4649 class StrongModeCode extends ErrorCode { |
| 4650 static const String _implicitCastMessage = |
| 4651 'Unsound implicit cast from {0} to {1}'; |
| 4652 |
| 4653 static const String _unsafeBlockClosureInferenceMessage = |
| 4654 'Unsafe use of block closure in a type-inferred variable outside a ' |
| 4655 'function body. Workaround: add a type annotation for `{0}`. See ' |
| 4656 'dartbug.com/26947'; |
| 4657 |
| 4658 static const String _typeCheckMessage = |
| 4659 'Type check failed: {0} is not of type {1}'; |
| 4660 |
| 4661 static const String _invalidOverrideMessage = |
| 4662 'The type of {0}.{1} ({2}) is not a ' |
| 4663 'subtype of {3}.{1} ({4}).'; |
| 4664 |
| 4665 /** |
| 4666 * This is appended to the end of an error message about implicit dynamic. |
| 4667 * |
| 4668 * The idea is to make sure the user is aware that this error message is the |
| 4669 * result of turning on a particular option, and they are free to turn it |
| 4670 * back off. |
| 4671 */ |
| 4672 static const String _implicitDynamicTip = |
| 4673 ". Either add an explicit type like 'dynamic'" |
| 4674 ", or enable implicit-dynamic in your Analyzer options."; |
| 4675 |
| 4676 static const String _inferredTypeMessage = '{0} has inferred type {1}'; |
| 4677 |
| 4678 static const StrongModeCode DOWN_CAST_COMPOSITE = const StrongModeCode( |
| 4679 ErrorType.STATIC_WARNING, 'DOWN_CAST_COMPOSITE', _implicitCastMessage); |
| 4680 |
| 4681 static const StrongModeCode DOWN_CAST_IMPLICIT = const StrongModeCode( |
| 4682 ErrorType.HINT, 'DOWN_CAST_IMPLICIT', _implicitCastMessage); |
| 4683 |
| 4684 static const StrongModeCode DOWN_CAST_IMPLICIT_ASSIGN = const StrongModeCode( |
| 4685 ErrorType.HINT, 'DOWN_CAST_IMPLICIT_ASSIGN', _implicitCastMessage); |
| 4686 |
| 4687 static const StrongModeCode DYNAMIC_CAST = const StrongModeCode( |
| 4688 ErrorType.HINT, 'DYNAMIC_CAST', _implicitCastMessage); |
| 4689 |
| 4690 static const StrongModeCode ASSIGNMENT_CAST = const StrongModeCode( |
| 4691 ErrorType.HINT, 'ASSIGNMENT_CAST', _implicitCastMessage); |
| 4692 |
| 4693 static const StrongModeCode INVALID_PARAMETER_DECLARATION = |
| 4694 const StrongModeCode(ErrorType.COMPILE_TIME_ERROR, |
| 4695 'INVALID_PARAMETER_DECLARATION', _typeCheckMessage); |
| 4696 |
| 4697 static const StrongModeCode COULD_NOT_INFER = const StrongModeCode( |
| 4698 ErrorType.COMPILE_TIME_ERROR, |
| 4699 'COULD_NOT_INFER', |
| 4700 "Could not infer type parameter {0}, {1} must be of type {2}."); |
| 4701 |
| 4702 static const StrongModeCode INFERRED_TYPE = const StrongModeCode( |
| 4703 ErrorType.HINT, 'INFERRED_TYPE', _inferredTypeMessage); |
| 4704 |
| 4705 static const StrongModeCode INFERRED_TYPE_LITERAL = const StrongModeCode( |
| 4706 ErrorType.HINT, 'INFERRED_TYPE_LITERAL', _inferredTypeMessage); |
| 4707 |
| 4708 static const StrongModeCode INFERRED_TYPE_ALLOCATION = const StrongModeCode( |
| 4709 ErrorType.HINT, 'INFERRED_TYPE_ALLOCATION', _inferredTypeMessage); |
| 4710 |
| 4711 static const StrongModeCode INFERRED_TYPE_CLOSURE = const StrongModeCode( |
| 4712 ErrorType.HINT, 'INFERRED_TYPE_CLOSURE', _inferredTypeMessage); |
| 4713 |
| 4714 static const StrongModeCode STATIC_TYPE_ERROR = const StrongModeCode( |
| 4715 ErrorType.COMPILE_TIME_ERROR, |
| 4716 'STATIC_TYPE_ERROR', |
| 4717 'Type check failed: {0} ({1}) is not of type {2}'); |
| 4718 |
| 4719 static const StrongModeCode INVALID_SUPER_INVOCATION = const StrongModeCode( |
| 4720 ErrorType.COMPILE_TIME_ERROR, |
| 4721 'INVALID_SUPER_INVOCATION', |
| 4722 "super call must be last in an initializer " |
| 4723 "list (see https://goo.gl/EY6hDP): {0}"); |
| 4724 |
| 4725 static const StrongModeCode NON_GROUND_TYPE_CHECK_INFO = const StrongModeCode( |
| 4726 ErrorType.HINT, |
| 4727 'NON_GROUND_TYPE_CHECK_INFO', |
| 4728 "Runtime check on non-ground type {0} may throw StrongModeError"); |
| 4729 |
| 4730 static const StrongModeCode DYNAMIC_INVOKE = const StrongModeCode( |
| 4731 ErrorType.HINT, 'DYNAMIC_INVOKE', '{0} requires a dynamic invoke'); |
| 4732 |
| 4733 static const StrongModeCode INVALID_METHOD_OVERRIDE = const StrongModeCode( |
| 4734 ErrorType.COMPILE_TIME_ERROR, |
| 4735 'INVALID_METHOD_OVERRIDE', |
| 4736 'Invalid override. $_invalidOverrideMessage'); |
| 4737 |
| 4738 static const StrongModeCode INVALID_METHOD_OVERRIDE_FROM_BASE = |
| 4739 const StrongModeCode( |
| 4740 ErrorType.COMPILE_TIME_ERROR, |
| 4741 'INVALID_METHOD_OVERRIDE_FROM_BASE', |
| 4742 'Base class introduces an invalid override. ' |
| 4743 '$_invalidOverrideMessage'); |
| 4744 |
| 4745 static const StrongModeCode INVALID_METHOD_OVERRIDE_FROM_MIXIN = |
| 4746 const StrongModeCode( |
| 4747 ErrorType.COMPILE_TIME_ERROR, |
| 4748 'INVALID_METHOD_OVERRIDE_FROM_MIXIN', |
| 4749 'Mixin introduces an invalid override. $_invalidOverrideMessage'); |
| 4750 |
| 4751 static const StrongModeCode INVALID_FIELD_OVERRIDE = const StrongModeCode( |
| 4752 ErrorType.COMPILE_TIME_ERROR, |
| 4753 'INVALID_FIELD_OVERRIDE', |
| 4754 'Field declaration {3}.{1} cannot be ' |
| 4755 'overridden in {0}.'); |
| 4756 |
| 4757 static const StrongModeCode IMPLICIT_DYNAMIC_PARAMETER = const StrongModeCode( |
| 4758 ErrorType.COMPILE_TIME_ERROR, |
| 4759 'IMPLICIT_DYNAMIC_PARAMETER', |
| 4760 "Missing parameter type for '{0}'$_implicitDynamicTip"); |
| 4761 |
| 4762 static const StrongModeCode IMPLICIT_DYNAMIC_RETURN = const StrongModeCode( |
| 4763 ErrorType.COMPILE_TIME_ERROR, |
| 4764 'IMPLICIT_DYNAMIC_RETURN', |
| 4765 "Missing return type for '{0}'$_implicitDynamicTip"); |
| 4766 |
| 4767 static const StrongModeCode IMPLICIT_DYNAMIC_VARIABLE = const StrongModeCode( |
| 4768 ErrorType.COMPILE_TIME_ERROR, |
| 4769 'IMPLICIT_DYNAMIC_VARIABLE', |
| 4770 "Missing variable type for '{0}'$_implicitDynamicTip"); |
| 4771 |
| 4772 static const StrongModeCode IMPLICIT_DYNAMIC_FIELD = const StrongModeCode( |
| 4773 ErrorType.COMPILE_TIME_ERROR, |
| 4774 'IMPLICIT_DYNAMIC_FIELD', |
| 4775 "Missing field type for '{0}'$_implicitDynamicTip"); |
| 4776 |
| 4777 static const StrongModeCode IMPLICIT_DYNAMIC_TYPE = const StrongModeCode( |
| 4778 ErrorType.COMPILE_TIME_ERROR, |
| 4779 'IMPLICIT_DYNAMIC_TYPE', |
| 4780 "Missing type arguments for generic type '{0}'" |
| 4781 "$_implicitDynamicTip"); |
| 4782 |
| 4783 static const StrongModeCode IMPLICIT_DYNAMIC_LIST_LITERAL = |
| 4784 const StrongModeCode( |
| 4785 ErrorType.COMPILE_TIME_ERROR, |
| 4786 'IMPLICIT_DYNAMIC_LIST_LITERAL', |
| 4787 "Missing type argument for list literal$_implicitDynamicTip"); |
| 4788 |
| 4789 static const StrongModeCode IMPLICIT_DYNAMIC_MAP_LITERAL = |
| 4790 const StrongModeCode( |
| 4791 ErrorType.COMPILE_TIME_ERROR, |
| 4792 'IMPLICIT_DYNAMIC_MAP_LITERAL', |
| 4793 'Missing type arguments for map literal$_implicitDynamicTip'); |
| 4794 |
| 4795 static const StrongModeCode IMPLICIT_DYNAMIC_FUNCTION = const StrongModeCode( |
| 4796 ErrorType.COMPILE_TIME_ERROR, |
| 4797 'IMPLICIT_DYNAMIC_FUNCTION', |
| 4798 "Missing type arguments for generic function '{0}<{1}>'" |
| 4799 "$_implicitDynamicTip"); |
| 4800 |
| 4801 static const StrongModeCode IMPLICIT_DYNAMIC_METHOD = const StrongModeCode( |
| 4802 ErrorType.COMPILE_TIME_ERROR, |
| 4803 'IMPLICIT_DYNAMIC_METHOD', |
| 4804 "Missing type arguments for generic method '{0}<{1}>'" |
| 4805 "$_implicitDynamicTip"); |
| 4806 |
| 4807 static const StrongModeCode IMPLICIT_DYNAMIC_INVOKE = const StrongModeCode( |
| 4808 ErrorType.COMPILE_TIME_ERROR, |
| 4809 'IMPLICIT_DYNAMIC_INVOKE', |
| 4810 "Missing type arguments for calling generic function type '{0}'" |
| 4811 "$_implicitDynamicTip"); |
| 4812 |
| 4813 static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = |
| 4814 const StrongModeCode( |
| 4815 ErrorType.STATIC_WARNING, |
| 4816 'UNSAFE_BLOCK_CLOSURE_INFERENCE', |
| 4817 _unsafeBlockClosureInferenceMessage); |
| 4818 |
| 4819 @override |
| 4820 final ErrorType type; |
| 4821 |
| 4822 /** |
| 4823 * Initialize a newly created error code to have the given [type] and [name]. |
| 4824 * |
| 4825 * The message associated with the error will be created from the given |
| 4826 * [message] template. The correction associated with the error will be |
| 4827 * created from the optional [correction] template. |
| 4828 */ |
| 4829 const StrongModeCode(ErrorType type, String name, String message, |
| 4830 [String correction]) |
| 4831 : type = type, |
| 4832 super('STRONG_MODE_$name', message, correction); |
| 4833 |
| 4834 @override |
| 4835 ErrorSeverity get errorSeverity => type.severity; |
| 4836 } |
| 4837 |
| 4838 /** |
| 4972 * The error code indicating a marker in code for work that needs to be finished | 4839 * The error code indicating a marker in code for work that needs to be finished |
| 4973 * or revisited. | 4840 * or revisited. |
| 4974 */ | 4841 */ |
| 4975 class TodoCode extends ErrorCode { | 4842 class TodoCode extends ErrorCode { |
| 4976 /** | 4843 /** |
| 4977 * The single enum of TodoCode. | 4844 * The single enum of TodoCode. |
| 4978 */ | 4845 */ |
| 4979 static const TodoCode TODO = const TodoCode('TODO'); | 4846 static const TodoCode TODO = const TodoCode('TODO'); |
| 4980 | 4847 |
| 4981 /** | 4848 /** |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4998 * Initialize a newly created error code to have the given [name]. | 4865 * Initialize a newly created error code to have the given [name]. |
| 4999 */ | 4866 */ |
| 5000 const TodoCode(String name) : super(name, "{0}"); | 4867 const TodoCode(String name) : super(name, "{0}"); |
| 5001 | 4868 |
| 5002 @override | 4869 @override |
| 5003 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 4870 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 5004 | 4871 |
| 5005 @override | 4872 @override |
| 5006 ErrorType get type => ErrorType.TODO; | 4873 ErrorType get type => ErrorType.TODO; |
| 5007 } | 4874 } |
| OLD | NEW |