| OLD | NEW |
| 1 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 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 # Each entry in this map corresponds to a diagnostic message. Ideally, each | 5 # Each entry in this map corresponds to a diagnostic message. Ideally, each |
| 6 # entry contains three parts: | 6 # entry contains three parts: |
| 7 # | 7 # |
| 8 # 1. A message template (template). | 8 # 1. A message template (template). |
| 9 # | 9 # |
| 10 # 2. A suggestion for how to correct the problem (tip). | 10 # 2. A suggestion for how to correct the problem (tip). |
| 11 # | 11 # |
| 12 # 3. Examples that produce the message (one of expression, statement, | 12 # 3. Examples that produce the message (one of expression, statement, |
| 13 # declaration, member, script, or bytes). | 13 # declaration, member, script, or bytes). |
| 14 # | 14 # |
| 15 # In addition, an entry can contain an analyzer error code (analyzerCode) and a | 15 # In addition, an entry can contain an analyzer error code (analyzerCode) and a |
| 16 # dart2js error code (dart2jsCode). | 16 # dart2js error code (dart2jsCode). |
| 17 # | 17 # |
| 18 # For dart2js, there's a few special error codes: |
| 19 # |
| 20 # - `*ignored*` this error is ignored by dart2js (normally a recoverable parser |
| 21 # error that dart2js reports in later phase for historical reasons). |
| 22 # |
| 23 # - `*fatal*` this is an error that is considered fatal by dart2js (normally a |
| 24 # recoverable parser error that dart2js can't reliably recover from). |
| 25 # |
| 18 # ## Parameter Substitution in Template and Tip | 26 # ## Parameter Substitution in Template and Tip |
| 19 # | 27 # |
| 20 # The fields `template` and `tip` are subject to parameter substitution. When | 28 # The fields `template` and `tip` are subject to parameter substitution. When |
| 21 # the compiler reports a problem, it may also specify a map with the following | 29 # the compiler reports a problem, it may also specify a map with the following |
| 22 # keys to be substituted into the message: | 30 # keys to be substituted into the message: |
| 23 # | 31 # |
| 24 # `#character` a Unicode character. | 32 # `#character` a Unicode character. |
| 25 # | 33 # |
| 26 # `#unicode` a Unicode short identifier (U+xxxx). We use this to represent code | 34 # `#unicode` a Unicode short identifier (U+xxxx). We use this to represent code |
| 27 # units or code points. | 35 # units or code points. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 45 expression: "å" | 53 expression: "å" |
| 46 | 54 |
| 47 NonAsciiWhitespace: | 55 NonAsciiWhitespace: |
| 48 template: "The non-ASCII space character #unicode can only be used in strings
and comments." | 56 template: "The non-ASCII space character #unicode can only be used in strings
and comments." |
| 49 analyzerCode: ILLEGAL_CHARACTER | 57 analyzerCode: ILLEGAL_CHARACTER |
| 50 dart2jsCode: BAD_INPUT_CHARACTER | 58 dart2jsCode: BAD_INPUT_CHARACTER |
| 51 expression: "\u2028 1" | 59 expression: "\u2028 1" |
| 52 | 60 |
| 53 Encoding: | 61 Encoding: |
| 54 template: "Unable to decode bytes as UTF-8." | 62 template: "Unable to decode bytes as UTF-8." |
| 55 dart2jsCode: FASTA_FATAL | 63 dart2jsCode: "*fatal*" |
| 56 bytes: [255] | 64 bytes: [255] |
| 57 | 65 |
| 58 EmptyNamedParameterList: | 66 EmptyNamedParameterList: |
| 59 template: "Named parameter lists cannot be empty." | 67 template: "Named parameter lists cannot be empty." |
| 60 tip: "Try adding a named parameter to the list." | 68 tip: "Try adding a named parameter to the list." |
| 61 dart2jsCode: EMPTY_NAMED_PARAMETER_LIST | 69 dart2jsCode: EMPTY_NAMED_PARAMETER_LIST |
| 62 script: > | 70 script: > |
| 63 foo({}) {} | 71 foo({}) {} |
| 64 | 72 |
| 65 main() { | 73 main() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 # a ',' would also have worked. We don't have enough information to give a | 105 # a ',' would also have worked. We don't have enough information to give a |
| 98 # good suggestion. | 106 # good suggestion. |
| 99 tip: DONT_KNOW_HOW_TO_FIX, | 107 tip: DONT_KNOW_HOW_TO_FIX, |
| 100 dart2jsCode: MISSING_TOKEN_BEFORE_THIS | 108 dart2jsCode: MISSING_TOKEN_BEFORE_THIS |
| 101 script: | 109 script: |
| 102 - "main() => true ? 1;" | 110 - "main() => true ? 1;" |
| 103 - "main() => foo(x: 1 y: 2);" | 111 - "main() => foo(x: 1 y: 2);" |
| 104 | 112 |
| 105 ExpectedClassBody: | 113 ExpectedClassBody: |
| 106 template: "Expected a class body, but got '#lexeme'." | 114 template: "Expected a class body, but got '#lexeme'." |
| 107 dart2jsCode: FASTA_FATAL | 115 dart2jsCode: "*fatal*" |
| 108 | 116 |
| 109 ExpectedClassBodyToSkip: ExpectedClassBody | 117 ExpectedClassBodyToSkip: ExpectedClassBody |
| 110 | 118 |
| 111 ExpectedDeclaration: | 119 ExpectedDeclaration: |
| 112 template: "Expected a declaration, but got '#lexeme'." | 120 template: "Expected a declaration, but got '#lexeme'." |
| 113 dart2jsCode: FASTA_FATAL | 121 dart2jsCode: "*fatal*" |
| 114 | 122 |
| 115 ExpectedExpression: | 123 ExpectedExpression: |
| 116 template: "Expected an expression, but got '#lexeme'." | 124 template: "Expected an expression, but got '#lexeme'." |
| 117 dart2jsCode: FASTA_FATAL | 125 dart2jsCode: "*fatal*" |
| 118 | 126 |
| 119 ExpectedFunctionBody: | 127 ExpectedFunctionBody: |
| 120 template: "Expected a function body, but got '#lexeme'." | 128 template: "Expected a function body, but got '#lexeme'." |
| 121 dart2jsCode: NATIVE_OR_FATAL | 129 dart2jsCode: NATIVE_OR_FATAL |
| 122 | 130 |
| 123 ExpectedHexDigit: | 131 ExpectedHexDigit: |
| 124 template: "A hex digit (0-9 or A-F) must follow '0x'." | 132 template: "A hex digit (0-9 or A-F) must follow '0x'." |
| 125 # No tip, seems obvious from the error message. | 133 # No tip, seems obvious from the error message. |
| 126 analyzerCode: MISSING_HEX_DIGIT | 134 analyzerCode: MISSING_HEX_DIGIT |
| 127 dart2jsCode: HEX_DIGIT_EXPECTED | 135 dart2jsCode: HEX_DIGIT_EXPECTED |
| 128 script: > | 136 script: > |
| 129 main() { | 137 main() { |
| 130 var i = 0x; | 138 var i = 0x; |
| 131 } | 139 } |
| 132 | 140 |
| 133 ExpectedIdentifier: | 141 ExpectedIdentifier: |
| 134 template: "'#lexeme' is a reserved word and can't be used here." | 142 template: "'#lexeme' is a reserved word and can't be used here." |
| 135 tip: "Try using a different name." | 143 tip: "Try using a different name." |
| 136 dart2jsCode: EXPECTED_IDENTIFIER | 144 dart2jsCode: EXPECTED_IDENTIFIER |
| 137 script: "do() {} main() {}" | 145 script: "do() {} main() {}" |
| 138 | 146 |
| 139 ExpectedOpenParens: | 147 ExpectedOpenParens: |
| 140 template: "Expected '('." | 148 template: "Expected '('." |
| 141 dart2jsCode: GENERIC | 149 dart2jsCode: GENERIC |
| 142 | 150 |
| 143 ExpectedString: | 151 ExpectedString: |
| 144 template: "Expected a String, but got '#lexeme'." | 152 template: "Expected a String, but got '#lexeme'." |
| 145 dart2jsCode: FASTA_FATAL | 153 dart2jsCode: "*fatal*" |
| 146 | 154 |
| 147 ExpectedType: | 155 ExpectedType: |
| 148 template: "Expected a type, but got '#lexeme'." | 156 template: "Expected a type, but got '#lexeme'." |
| 149 dart2jsCode: FASTA_FATAL | 157 dart2jsCode: "*fatal*" |
| 150 | 158 |
| 151 ExtraneousModifier: | 159 ExtraneousModifier: |
| 152 template: "Can't have modifier '#lexeme' here." | 160 template: "Can't have modifier '#lexeme' here." |
| 153 tip: "Try removing '#lexeme'." | 161 tip: "Try removing '#lexeme'." |
| 154 dart2jsCode: EXTRANEOUS_MODIFIER | 162 dart2jsCode: EXTRANEOUS_MODIFIER |
| 155 script: | 163 script: |
| 156 - "var String foo; main(){}" | 164 - "var String foo; main(){}" |
| 157 - "var set foo; main(){}" | 165 - "var set foo; main(){}" |
| 158 - "var final foo; main(){}" | 166 - "var final foo; main(){}" |
| 159 - "var var foo; main(){}" | 167 - "var var foo; main(){}" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 main() { | 262 main() { |
| 255 return '''$'''; | 263 return '''$'''; |
| 256 } | 264 } |
| 257 - > | 265 - > |
| 258 main() { | 266 main() { |
| 259 return """$"""; | 267 return """$"""; |
| 260 } | 268 } |
| 261 | 269 |
| 262 UnexpectedToken: | 270 UnexpectedToken: |
| 263 template: "Unexpected token '#lexeme'." | 271 template: "Unexpected token '#lexeme'." |
| 264 dart2jsCode: FASTA_FATAL | 272 dart2jsCode: "*fatal*" |
| 265 | 273 |
| 266 UnmatchedToken: | 274 UnmatchedToken: |
| 267 template: "Can't find '#string' to match '#lexeme'." | 275 template: "Can't find '#string' to match '#lexeme'." |
| 268 dart2jsCode: UNMATCHED_TOKEN | 276 dart2jsCode: UNMATCHED_TOKEN |
| 269 script: | 277 script: |
| 270 - "main(" | 278 - "main(" |
| 271 - "main(){" | 279 - "main(){" |
| 272 - "main(){[}" | 280 - "main(){[}" |
| 273 | 281 |
| 274 UnsupportedPrefixPlus: | 282 UnsupportedPrefixPlus: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 # This is a fall-back message that shouldn't happen. | 332 # This is a fall-back message that shouldn't happen. |
| 325 template: "Incomplete token." | 333 template: "Incomplete token." |
| 326 dart2jsCode: UNTERMINATED_TOKEN | 334 dart2jsCode: UNTERMINATED_TOKEN |
| 327 | 335 |
| 328 Unspecified: | 336 Unspecified: |
| 329 template: "#string" | 337 template: "#string" |
| 330 dart2jsCode: GENERIC | 338 dart2jsCode: GENERIC |
| 331 | 339 |
| 332 AbstractNotSync: | 340 AbstractNotSync: |
| 333 template: "Abstract methods can't use 'async', 'async*', or 'sync*'." | 341 template: "Abstract methods can't use 'async', 'async*', or 'sync*'." |
| 334 dart2jsCode: FASTA_IGNORED | 342 dart2jsCode: "*ignored*" |
| 335 | 343 |
| 336 AsyncAsIdentifier: | 344 AsyncAsIdentifier: |
| 337 analyzerCode: ASYNC_KEYWORD_USED_AS_IDENTIFIER | 345 analyzerCode: ASYNC_KEYWORD_USED_AS_IDENTIFIER |
| 338 template: "'async' can't be used as an identifier in 'async', 'async*', or 'sy
nc*' methods." | 346 template: "'async' can't be used as an identifier in 'async', 'async*', or 'sy
nc*' methods." |
| 339 dart2jsCode: GENERIC | 347 dart2jsCode: GENERIC |
| 340 | 348 |
| 341 AwaitAsIdentifier: | 349 AwaitAsIdentifier: |
| 342 template: "'await' can't be used as an identifier in 'async', 'async*', or 'sy
nc*' methods." | 350 template: "'await' can't be used as an identifier in 'async', 'async*', or 'sy
nc*' methods." |
| 343 dart2jsCode: FASTA_IGNORED | 351 dart2jsCode: "*ignored*" |
| 344 | 352 |
| 345 AwaitNotAsync: | 353 AwaitNotAsync: |
| 346 template: "'await' can only be used in 'async' or 'async*' methods." | 354 template: "'await' can only be used in 'async' or 'async*' methods." |
| 347 dart2jsCode: FASTA_IGNORED | 355 dart2jsCode: "*ignored*" |
| 348 | 356 |
| 349 BuiltInIdentifierAsType: | 357 BuiltInIdentifierAsType: |
| 350 template: "Can't use '#lexeme' as a type." | 358 template: "Can't use '#lexeme' as a type." |
| 351 analyzerCode: EXPECTED_TYPE_NAME | 359 analyzerCode: EXPECTED_TYPE_NAME |
| 352 dart2jsCode: EXTRANEOUS_MODIFIER | 360 dart2jsCode: EXTRANEOUS_MODIFIER |
| 353 | 361 |
| 354 BuiltInIdentifierInDeclaration: | 362 BuiltInIdentifierInDeclaration: |
| 355 template: "Can't use '#lexeme' as a name here." | 363 template: "Can't use '#lexeme' as a name here." |
| 356 dart2jsCode: GENERIC | 364 dart2jsCode: GENERIC |
| 357 | 365 |
| 358 AwaitForNotAsync: | 366 AwaitForNotAsync: |
| 359 template: "Asynchronous for-loop can only be used in 'async' or 'async*' metho
ds." | 367 template: "Asynchronous for-loop can only be used in 'async' or 'async*' metho
ds." |
| 360 dart2jsCode: FASTA_IGNORED | 368 dart2jsCode: "*ignored*" |
| 361 | 369 |
| 362 FactoryNotSync: | 370 FactoryNotSync: |
| 363 template: "Factories can't use 'async', 'async*', or 'sync*'." | 371 template: "Factories can't use 'async', 'async*', or 'sync*'." |
| 364 dart2jsCode: FASTA_IGNORED | 372 dart2jsCode: "*ignored*" |
| 365 | 373 |
| 366 GeneratorReturnsValue: | 374 GeneratorReturnsValue: |
| 367 template: "'sync*' and 'async*' can't return a value." | 375 template: "'sync*' and 'async*' can't return a value." |
| 368 dart2jsCode: FASTA_IGNORED | 376 dart2jsCode: "*ignored*" |
| 369 | 377 |
| 370 InvalidInlineFunctionType: | 378 InvalidInlineFunctionType: |
| 371 template: "Invalid inline function type." | 379 template: "Invalid inline function type." |
| 372 tip: "Try changing the inline function type (as in 'int f()') to a prefixed fu
nction type using the `Function` keyword (as in 'int Function() f')." | 380 tip: "Try changing the inline function type (as in 'int f()') to a prefixed fu
nction type using the `Function` keyword (as in 'int Function() f')." |
| 373 dart2jsCode: INVALID_INLINE_FUNCTION_TYPE | 381 dart2jsCode: INVALID_INLINE_FUNCTION_TYPE |
| 374 declaration: "typedef F = Function(int f(String x)); main() { F f; }" | 382 declaration: "typedef F = Function(int f(String x)); main() { F f; }" |
| 375 | 383 |
| 376 SetterNotSync: | 384 SetterNotSync: |
| 377 template: "Setters can't use 'async', 'async*', or 'sync*'." | 385 template: "Setters can't use 'async', 'async*', or 'sync*'." |
| 378 dart2jsCode: FASTA_IGNORED | 386 dart2jsCode: "*ignored*" |
| 379 | 387 |
| 380 YieldAsIdentifier: | 388 YieldAsIdentifier: |
| 381 template: "'yield' can't be used as an identifier in 'async', 'async*', or 'sy
nc*' methods." | 389 template: "'yield' can't be used as an identifier in 'async', 'async*', or 'sy
nc*' methods." |
| 382 dart2jsCode: FASTA_IGNORED | 390 dart2jsCode: "*ignored*" |
| 383 | 391 |
| 384 YieldNotGenerator: | 392 YieldNotGenerator: |
| 385 template: "'yield' can only be used in 'sync*' or 'async*' methods." | 393 template: "'yield' can only be used in 'sync*' or 'async*' methods." |
| 386 dart2jsCode: FASTA_IGNORED | 394 dart2jsCode: "*ignored*" |
| 387 | 395 |
| 388 OnlyTry: | 396 OnlyTry: |
| 389 template: "Try block should be followed by 'on', 'catch', or 'finally' block." | 397 template: "Try block should be followed by 'on', 'catch', or 'finally' block." |
| 390 tip: "Did you forget to add a 'finally' block?" | 398 tip: "Did you forget to add a 'finally' block?" |
| 391 statement: "try {}" | 399 statement: "try {}" |
| 392 dart2jsCode: FASTA_IGNORED | 400 dart2jsCode: "*ignored*" |
| 393 | 401 |
| 394 TypeAfterVar: | 402 TypeAfterVar: |
| 395 template: "Can't have both a type and 'var'." | 403 template: "Can't have both a type and 'var'." |
| 396 tip: "Try removing 'var.'" | 404 tip: "Try removing 'var.'" |
| 397 dart2jsCode: EXTRANEOUS_MODIFIER | 405 dart2jsCode: EXTRANEOUS_MODIFIER |
| 398 | 406 |
| 399 TypeRequired: | 407 TypeRequired: |
| 400 template: "A type or modifier is required here." | 408 template: "A type or modifier is required here." |
| 401 tip: "Try adding a type, 'var', 'const', or 'final'." | 409 tip: "Try adding a type, 'var', 'const', or 'final'." |
| 402 | 410 |
| 403 AssertExtraneousArgument: | 411 AssertExtraneousArgument: |
| 404 template: "`assert` can't have more than two arguments." | 412 template: "`assert` can't have more than two arguments." |
| 405 dart2jsCode: FASTA_FATAL | 413 dart2jsCode: "*fatal*" |
| 406 | 414 |
| 407 AssertAsExpression: | 415 AssertAsExpression: |
| 408 template: "`assert` can't be used as an expression." | 416 template: "`assert` can't be used as an expression." |
| 409 dart2jsCode: FASTA_FATAL | 417 dart2jsCode: "*fatal*" |
| 410 | 418 |
| 411 FunctionTypeDefaultValue: | 419 FunctionTypeDefaultValue: |
| 412 template: "Can't have a default value in a function type." | 420 template: "Can't have a default value in a function type." |
| 413 dart2jsCode: FASTA_IGNORED | 421 dart2jsCode: "*ignored*" |
| 414 | 422 |
| 415 PrivateNamedParameter: | 423 PrivateNamedParameter: |
| 416 template: "An optional named parameter can't start with '_'." | 424 template: "An optional named parameter can't start with '_'." |
| 417 dart2jsCode: FASTA_IGNORED | 425 dart2jsCode: "*ignored*" |
| 418 | 426 |
| 419 NoFormals: | 427 NoFormals: |
| 420 template: "A function should have formal parameters." | 428 template: "A function should have formal parameters." |
| 421 tip: "Try adding '()' after '#lexeme', or add 'get' before '#lexeme' to declar
e a getter." | 429 tip: "Try adding '()' after '#lexeme', or add 'get' before '#lexeme' to declar
e a getter." |
| 422 dart2jsCode: FASTA_IGNORED | 430 dart2jsCode: "*ignored*" |
| 423 | 431 |
| 424 GetterWithFormals: | 432 GetterWithFormals: |
| 425 template: "A getter can't have formal parameters." | 433 template: "A getter can't have formal parameters." |
| 426 tip: "Try removing '(...)'." | 434 tip: "Try removing '(...)'." |
| 427 dart2jsCode: FASTA_IGNORED | 435 dart2jsCode: "*ignored*" |
| 428 | 436 |
| 429 CatchSyntax: | 437 CatchSyntax: |
| 430 template: "'catch' must be followed by '(identifier)' or '(identifier, identif
ier)'." | 438 template: "'catch' must be followed by '(identifier)' or '(identifier, identif
ier)'." |
| 431 tip: "No types are needed, the first is given by 'on', the second is always 'S
tackTrace'." | 439 tip: "No types are needed, the first is given by 'on', the second is always 'S
tackTrace'." |
| 432 dart2jsCode: FASTA_IGNORED | 440 dart2jsCode: "*ignored*" |
| 433 | 441 |
| 434 SuperNullAware: | 442 SuperNullAware: |
| 435 template: "'super' can't be null." | 443 template: "'super' can't be null." |
| 436 tip: "Try replacing '?.' with '.'" | 444 tip: "Try replacing '?.' with '.'" |
| 437 dart2jsCode: FASTA_IGNORED | 445 dart2jsCode: "*ignored*" |
| 438 | 446 |
| 439 ConstFieldWithoutInitializer: | 447 ConstFieldWithoutInitializer: |
| 440 template: "A 'const' field must be initialized." | 448 template: "A 'const' field must be initialized." |
| 441 tip: "Try adding '= <initializer>'." | 449 tip: "Try adding '= <initializer>'." |
| 442 dart2jsCode: FASTA_IGNORED | 450 dart2jsCode: "*ignored*" |
| 443 | 451 |
| 444 FinalFieldWithoutInitializer: | 452 FinalFieldWithoutInitializer: |
| 445 template: "A 'final' field must be initialized." | 453 template: "A 'final' field must be initialized." |
| 446 tip: "Try adding '= <initializer>'." | 454 tip: "Try adding '= <initializer>'." |
| 447 dart2jsCode: FASTA_IGNORED | 455 dart2jsCode: "*ignored*" |
| 448 | 456 |
| 449 MetadataTypeArguments: | 457 MetadataTypeArguments: |
| 450 template: "An annotation (metadata) can't use type arguments." | 458 template: "An annotation (metadata) can't use type arguments." |
| 451 dart2jsCode: FASTA_IGNORED | 459 dart2jsCode: "*ignored*" |
| OLD | NEW |