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 analyzer.src.generated.error; | 5 library analyzer.src.generated.error; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; | 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 class HintCode extends ErrorCode { | 3428 class HintCode extends ErrorCode { |
3429 /** | 3429 /** |
3430 * This hint is generated anywhere where the | 3430 * This hint is generated anywhere where the |
3431 * [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, | 3431 * [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, |
3432 * if we used propagated information for the warnings. | 3432 * if we used propagated information for the warnings. |
3433 * | 3433 * |
3434 * Parameters: | 3434 * Parameters: |
3435 * 0: the name of the actual argument type | 3435 * 0: the name of the actual argument type |
3436 * 1: the name of the expected type | 3436 * 1: the name of the expected type |
3437 */ | 3437 */ |
3438 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode( | 3438 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = |
3439 'ARGUMENT_TYPE_NOT_ASSIGNABLE', | 3439 shared_messages.ARGUMENT_TYPE_NOT_ASSIGNABLE_HINT; |
3440 "The argument type '{0}' cannot be assigned to the parameter type '{1}'"); | |
3441 | 3440 |
3442 /** | 3441 /** |
3443 * When the target expression uses '?.' operator, it can be `null`, so all the | 3442 * When the target expression uses '?.' operator, it can be `null`, so all the |
3444 * subsequent invocations should also use '?.' operator. | 3443 * subsequent invocations should also use '?.' operator. |
3445 */ | 3444 */ |
3446 static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = const HintCode( | 3445 static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = const HintCode( |
3447 'CAN_BE_NULL_AFTER_NULL_AWARE', | 3446 'CAN_BE_NULL_AFTER_NULL_AWARE', |
3448 "The expression uses '?.', so can be 'null'", | 3447 "The expression uses '?.', so can be 'null'", |
3449 "Replace the '.' with a '?.' in the invocation"); | 3448 "Replace the '.' with a '?.' in the invocation"); |
3450 | 3449 |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4118 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not | 4117 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not |
4119 * be assigned to the declared return type of the immediately enclosing | 4118 * be assigned to the declared return type of the immediately enclosing |
4120 * function. | 4119 * function. |
4121 * | 4120 * |
4122 * Parameters: | 4121 * Parameters: |
4123 * 0: the return type as declared in the return statement | 4122 * 0: the return type as declared in the return statement |
4124 * 1: the expected return type as defined by the method | 4123 * 1: the expected return type as defined by the method |
4125 * 2: the name of the method | 4124 * 2: the name of the method |
4126 */ | 4125 */ |
4127 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = | 4126 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = |
4128 const StaticTypeWarningCode('RETURN_OF_INVALID_TYPE', | 4127 shared_messages.RETURN_OF_INVALID_TYPE; |
4129 "The return type '{0}' is not a '{1}', as defined by the method '{2}'"
); | |
4130 | 4128 |
4131 /** | 4129 /** |
4132 * 12.11 Instance Creation: It is a static type warning if any of the type | 4130 * 12.11 Instance Creation: It is a static type warning if any of the type |
4133 * arguments to a constructor of a generic type <i>G</i> invoked by a new | 4131 * arguments to a constructor of a generic type <i>G</i> invoked by a new |
4134 * expression or a constant object expression are not subtypes of the bounds | 4132 * expression or a constant object expression are not subtypes of the bounds |
4135 * of the corresponding formal type parameters of <i>G</i>. | 4133 * of the corresponding formal type parameters of <i>G</i>. |
4136 * | 4134 * |
4137 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member | 4135 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member |
4138 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of | 4136 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of |
4139 * <i>G<A<sub>1</sub>, …, A<sub>n</sub>></i> is <i>[A<sub>1</sub>
, | 4137 * <i>G<A<sub>1</sub>, …, A<sub>n</sub>></i> is <i>[A<sub>1</sub>
, |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4465 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning | 4463 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning |
4466 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be | 4464 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be |
4467 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j | 4465 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j |
4468 * <= l</i>. | 4466 * <= l</i>. |
4469 * | 4467 * |
4470 * Parameters: | 4468 * Parameters: |
4471 * 0: the name of the actual argument type | 4469 * 0: the name of the actual argument type |
4472 * 1: the name of the expected type | 4470 * 1: the name of the expected type |
4473 */ | 4471 */ |
4474 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = | 4472 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = |
4475 const StaticWarningCode('ARGUMENT_TYPE_NOT_ASSIGNABLE', | 4473 shared_messages.ARGUMENT_TYPE_NOT_ASSIGNABLE_STATIC_WARNING; |
4476 "The argument type '{0}' cannot be assigned to the parameter type '{1}
'"); | |
4477 | 4474 |
4478 /** | 4475 /** |
4479 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 4476 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
4480 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 4477 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
4481 * assignment will also give rise to a static warning for the same reason. | 4478 * assignment will also give rise to a static warning for the same reason. |
4482 * | 4479 * |
4483 * A constant variable is always implicitly final. | 4480 * A constant variable is always implicitly final. |
4484 */ | 4481 */ |
4485 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode( | 4482 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode( |
4486 'ASSIGNMENT_TO_CONST', "Constant variables cannot be assigned a value"); | 4483 'ASSIGNMENT_TO_CONST', "Constant variables cannot be assigned a value"); |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5712 * Initialize a newly created error code to have the given [name]. | 5709 * Initialize a newly created error code to have the given [name]. |
5713 */ | 5710 */ |
5714 const TodoCode(String name) : super(name, "{0}"); | 5711 const TodoCode(String name) : super(name, "{0}"); |
5715 | 5712 |
5716 @override | 5713 @override |
5717 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5714 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
5718 | 5715 |
5719 @override | 5716 @override |
5720 ErrorType get type => ErrorType.TODO; | 5717 ErrorType get type => ErrorType.TODO; |
5721 } | 5718 } |
OLD | NEW |