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.error.codes; | 5 library analyzer.src.error.codes; |
6 | 6 |
7 import 'package:analyzer/error/error.dart'; | 7 import 'package:analyzer/error/error.dart'; |
8 | 8 |
9 export 'package:analyzer/src/analysis_options/error/option_codes.dart'; | 9 export 'package:analyzer/src/analysis_options/error/option_codes.dart'; |
10 export 'package:analyzer/src/dart/error/hint_codes.dart'; | 10 export 'package:analyzer/src/dart/error/hint_codes.dart'; |
(...skipping 4933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4944 'NO_DEFAULT_BOUNDS', | 4944 'NO_DEFAULT_BOUNDS', |
4945 "Type has no default bounds", | 4945 "Type has no default bounds", |
4946 "Try adding explicit type arguments to type"); | 4946 "Try adding explicit type arguments to type"); |
4947 | 4947 |
4948 static const StrongModeCode NOT_INSTANTIATED_BOUND = const StrongModeCode( | 4948 static const StrongModeCode NOT_INSTANTIATED_BOUND = const StrongModeCode( |
4949 ErrorType.COMPILE_TIME_ERROR, | 4949 ErrorType.COMPILE_TIME_ERROR, |
4950 'NOT_INSTANTIATED_BOUND', | 4950 'NOT_INSTANTIATED_BOUND', |
4951 "Type parameter bound types must be instantiated.", | 4951 "Type parameter bound types must be instantiated.", |
4952 "Try adding type arguments."); | 4952 "Try adding type arguments."); |
4953 | 4953 |
| 4954 static const StrongModeCode TOP_LEVEL_CYCLE = const StrongModeCode( |
| 4955 ErrorType.COMPILE_TIME_ERROR, |
| 4956 'TOP_LEVEL_CYCLE', |
| 4957 "The type of '{0}' can't be inferred because it depends on itself through
the cycle: {1}.", |
| 4958 "Try adding an explicit type to one or more of the variables in the cycle
in order to break the cycle."); |
| 4959 |
| 4960 static const StrongModeCode TOP_LEVEL_FUNCTION_LITERAL_BLOCK = |
| 4961 const StrongModeCode( |
| 4962 ErrorType.COMPILE_TIME_ERROR, |
| 4963 'TOP_LEVEL_FUNCTION_LITERAL_BLOCK', |
| 4964 "The type of the function literal can't be inferred because the litera
l has a block as its body.", |
| 4965 "Try adding an explicit type to the variable."); |
| 4966 |
| 4967 static const StrongModeCode TOP_LEVEL_FUNCTION_LITERAL_PARAMETER = |
| 4968 const StrongModeCode( |
| 4969 ErrorType.COMPILE_TIME_ERROR, |
| 4970 'TOP_LEVEL_FUNCTION_LITERAL_PARAMETER', |
| 4971 "The type of '{0}' can't be inferred because the parameter '{1}' does
not have an explicit type.", |
| 4972 "Try adding an explicit type to the parameter '{1}', or add an explici
t type for '{0}'."); |
| 4973 |
| 4974 static const StrongModeCode TOP_LEVEL_IDENTIFIER_NO_TYPE = const StrongModeCod
e( |
| 4975 ErrorType.COMPILE_TIME_ERROR, |
| 4976 'TOP_LEVEL_IDENTIFIER_NO_TYPE', |
| 4977 "The type of '{0}' can't be inferred because the type of '{1}' couldn't be
inferred.", |
| 4978 "Try adding an explicit type to either the variable '{0}' or the variable
'{1}'."); |
| 4979 |
| 4980 static const StrongModeCode TOP_LEVEL_INSTANCE_GETTER = const StrongModeCode( |
| 4981 ErrorType.COMPILE_TIME_ERROR, |
| 4982 'TOP_LEVEL_INSTANCE_GETTER', |
| 4983 "The type of '{0}' can't be inferred because of the use of the instance ge
tter '{1}'.", |
| 4984 "Try removing the use of the instance getter {1}, or add an explicit type
for '{0}'."); |
| 4985 |
| 4986 static const StrongModeCode TOP_LEVEL_TYPE_ARGUMENTS = const StrongModeCode( |
| 4987 ErrorType.COMPILE_TIME_ERROR, |
| 4988 'TOP_LEVEL_TYPE_ARGUMENTS', |
| 4989 "The type of '{0}' can't be inferred because type arguments were not given
for '{1}'.", |
| 4990 "Try adding type arguments for '{1}', or add an explicit type for '{0}'.")
; |
| 4991 |
| 4992 static const StrongModeCode TOP_LEVEL_UNSUPPORTED = const StrongModeCode( |
| 4993 ErrorType.COMPILE_TIME_ERROR, |
| 4994 'TOP_LEVEL_UNSUPPORTED', |
| 4995 "The type of '{0}' can't be inferred because {1} expressions aren't suppor
ted.", |
| 4996 "Try adding an explicit type for '{0}'."); |
| 4997 |
4954 static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = const StrongModeC
ode( | 4998 static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = const StrongModeC
ode( |
4955 ErrorType.STATIC_WARNING, | 4999 ErrorType.STATIC_WARNING, |
4956 'UNSAFE_BLOCK_CLOSURE_INFERENCE', | 5000 'UNSAFE_BLOCK_CLOSURE_INFERENCE', |
4957 "Unsafe use of a block closure in a type-inferred variable outside a funct
ion body.", | 5001 "Unsafe use of a block closure in a type-inferred variable outside a funct
ion body.", |
4958 "Try adding a type annotation for '{0}'. See dartbug.com/26947."); | 5002 "Try adding a type annotation for '{0}'. See dartbug.com/26947."); |
4959 | 5003 |
4960 @override | 5004 @override |
4961 final ErrorType type; | 5005 final ErrorType type; |
4962 | 5006 |
4963 /** | 5007 /** |
4964 * Initialize a newly created error code to have the given [type] and [name]. | 5008 * Initialize a newly created error code to have the given [type] and [name]. |
4965 * | 5009 * |
4966 * The message associated with the error will be created from the given | 5010 * The message associated with the error will be created from the given |
4967 * [message] template. The correction associated with the error will be | 5011 * [message] template. The correction associated with the error will be |
4968 * created from the optional [correction] template. | 5012 * created from the optional [correction] template. |
4969 */ | 5013 */ |
4970 const StrongModeCode(ErrorType type, String name, String message, | 5014 const StrongModeCode(ErrorType type, String name, String message, |
4971 [String correction]) | 5015 [String correction]) |
4972 : type = type, | 5016 : type = type, |
4973 super('STRONG_MODE_$name', message, correction); | 5017 super('STRONG_MODE_$name', message, correction); |
4974 | 5018 |
4975 @override | 5019 @override |
4976 ErrorSeverity get errorSeverity => type.severity; | 5020 ErrorSeverity get errorSeverity => type.severity; |
4977 } | 5021 } |
OLD | NEW |