| 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 /* |
| 4955 * TODO(brianwilkerson) Make the TOP_LEVEL_ error codes be errors rather than |
| 4956 * hints and then clean up the function _errorSeverity in |
| 4957 * test/src/task/strong/strong_test_helper.dart. |
| 4958 */ |
| 4954 static const StrongModeCode TOP_LEVEL_CYCLE = const StrongModeCode( | 4959 static const StrongModeCode TOP_LEVEL_CYCLE = const StrongModeCode( |
| 4955 ErrorType.COMPILE_TIME_ERROR, | 4960 ErrorType.HINT, |
| 4956 'TOP_LEVEL_CYCLE', | 4961 'TOP_LEVEL_CYCLE', |
| 4957 "The type of '{0}' can't be inferred because it depends on itself through
the cycle: {1}.", | 4962 "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."); | 4963 "Try adding an explicit type to one or more of the variables in the cycle
in order to break the cycle."); |
| 4959 | 4964 |
| 4960 static const StrongModeCode TOP_LEVEL_FUNCTION_LITERAL_BLOCK = | 4965 static const StrongModeCode TOP_LEVEL_FUNCTION_LITERAL_BLOCK = |
| 4961 const StrongModeCode( | 4966 const StrongModeCode( |
| 4962 ErrorType.COMPILE_TIME_ERROR, | 4967 ErrorType.HINT, |
| 4963 'TOP_LEVEL_FUNCTION_LITERAL_BLOCK', | 4968 '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.", | 4969 "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."); | 4970 "Try adding an explicit type to the variable."); |
| 4966 | 4971 |
| 4967 static const StrongModeCode TOP_LEVEL_FUNCTION_LITERAL_PARAMETER = | 4972 static const StrongModeCode TOP_LEVEL_FUNCTION_LITERAL_PARAMETER = |
| 4968 const StrongModeCode( | 4973 const StrongModeCode( |
| 4969 ErrorType.COMPILE_TIME_ERROR, | 4974 ErrorType.HINT, |
| 4970 'TOP_LEVEL_FUNCTION_LITERAL_PARAMETER', | 4975 'TOP_LEVEL_FUNCTION_LITERAL_PARAMETER', |
| 4971 "The type of '{0}' can't be inferred because the parameter '{1}' does
not have an explicit type.", | 4976 "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}'."); | 4977 "Try adding an explicit type to the parameter '{1}', or add an explici
t type for '{0}'."); |
| 4973 | 4978 |
| 4974 static const StrongModeCode TOP_LEVEL_IDENTIFIER_NO_TYPE = const StrongModeCod
e( | 4979 static const StrongModeCode TOP_LEVEL_IDENTIFIER_NO_TYPE = const StrongModeCod
e( |
| 4975 ErrorType.COMPILE_TIME_ERROR, | 4980 ErrorType.HINT, |
| 4976 'TOP_LEVEL_IDENTIFIER_NO_TYPE', | 4981 'TOP_LEVEL_IDENTIFIER_NO_TYPE', |
| 4977 "The type of '{0}' can't be inferred because the type of '{1}' couldn't be
inferred.", | 4982 "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}'."); | 4983 "Try adding an explicit type to either the variable '{0}' or the variable
'{1}'."); |
| 4979 | 4984 |
| 4980 static const StrongModeCode TOP_LEVEL_INSTANCE_GETTER = const StrongModeCode( | 4985 static const StrongModeCode TOP_LEVEL_INSTANCE_GETTER = const StrongModeCode( |
| 4981 ErrorType.COMPILE_TIME_ERROR, | 4986 ErrorType.HINT, |
| 4982 'TOP_LEVEL_INSTANCE_GETTER', | 4987 'TOP_LEVEL_INSTANCE_GETTER', |
| 4983 "The type of '{0}' can't be inferred because of the use of the instance ge
tter '{1}'.", | 4988 "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}'."); | 4989 "Try removing the use of the instance getter {1}, or add an explicit type
for '{0}'."); |
| 4985 | 4990 |
| 4986 static const StrongModeCode TOP_LEVEL_TYPE_ARGUMENTS = const StrongModeCode( | 4991 static const StrongModeCode TOP_LEVEL_TYPE_ARGUMENTS = const StrongModeCode( |
| 4987 ErrorType.COMPILE_TIME_ERROR, | 4992 ErrorType.HINT, |
| 4988 'TOP_LEVEL_TYPE_ARGUMENTS', | 4993 'TOP_LEVEL_TYPE_ARGUMENTS', |
| 4989 "The type of '{0}' can't be inferred because type arguments were not given
for '{1}'.", | 4994 "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}'.")
; | 4995 "Try adding type arguments for '{1}', or add an explicit type for '{0}'.")
; |
| 4991 | 4996 |
| 4992 static const StrongModeCode TOP_LEVEL_UNSUPPORTED = const StrongModeCode( | 4997 static const StrongModeCode TOP_LEVEL_UNSUPPORTED = const StrongModeCode( |
| 4993 ErrorType.COMPILE_TIME_ERROR, | 4998 ErrorType.HINT, |
| 4994 'TOP_LEVEL_UNSUPPORTED', | 4999 'TOP_LEVEL_UNSUPPORTED', |
| 4995 "The type of '{0}' can't be inferred because {1} expressions aren't suppor
ted.", | 5000 "The type of '{0}' can't be inferred because {1} expressions aren't suppor
ted.", |
| 4996 "Try adding an explicit type for '{0}'."); | 5001 "Try adding an explicit type for '{0}'."); |
| 4997 | 5002 |
| 4998 static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = const StrongModeC
ode( | 5003 static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = const StrongModeC
ode( |
| 4999 ErrorType.STATIC_WARNING, | 5004 ErrorType.STATIC_WARNING, |
| 5000 'UNSAFE_BLOCK_CLOSURE_INFERENCE', | 5005 'UNSAFE_BLOCK_CLOSURE_INFERENCE', |
| 5001 "Unsafe use of a block closure in a type-inferred variable outside a funct
ion body.", | 5006 "Unsafe use of a block closure in a type-inferred variable outside a funct
ion body.", |
| 5002 "Try adding a type annotation for '{0}'. See dartbug.com/26947."); | 5007 "Try adding a type annotation for '{0}'. See dartbug.com/26947."); |
| 5003 | 5008 |
| 5004 @override | 5009 @override |
| 5005 final ErrorType type; | 5010 final ErrorType type; |
| 5006 | 5011 |
| 5007 /** | 5012 /** |
| 5008 * Initialize a newly created error code to have the given [type] and [name]. | 5013 * Initialize a newly created error code to have the given [type] and [name]. |
| 5009 * | 5014 * |
| 5010 * The message associated with the error will be created from the given | 5015 * The message associated with the error will be created from the given |
| 5011 * [message] template. The correction associated with the error will be | 5016 * [message] template. The correction associated with the error will be |
| 5012 * created from the optional [correction] template. | 5017 * created from the optional [correction] template. |
| 5013 */ | 5018 */ |
| 5014 const StrongModeCode(ErrorType type, String name, String message, | 5019 const StrongModeCode(ErrorType type, String name, String message, |
| 5015 [String correction]) | 5020 [String correction]) |
| 5016 : type = type, | 5021 : type = type, |
| 5017 super('STRONG_MODE_$name', message, correction); | 5022 super('STRONG_MODE_$name', message, correction); |
| 5018 | 5023 |
| 5019 @override | 5024 @override |
| 5020 ErrorSeverity get errorSeverity => type.severity; | 5025 ErrorSeverity get errorSeverity => type.severity; |
| 5021 } | 5026 } |
| OLD | NEW |