| 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 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2849 StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER, | 2849 StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER, |
| 2850 StaticWarningCode.UNDEFINED_SUPER_GETTER, | 2850 StaticWarningCode.UNDEFINED_SUPER_GETTER, |
| 2851 StaticWarningCode.UNDEFINED_SUPER_SETTER, | 2851 StaticWarningCode.UNDEFINED_SUPER_SETTER, |
| 2852 StaticWarningCode.VOID_RETURN_FOR_GETTER, | 2852 StaticWarningCode.VOID_RETURN_FOR_GETTER, |
| 2853 StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH, | 2853 StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH, |
| 2854 StrongModeCode.ASSIGNMENT_CAST, | 2854 StrongModeCode.ASSIGNMENT_CAST, |
| 2855 StrongModeCode.DOWN_CAST_COMPOSITE, | 2855 StrongModeCode.DOWN_CAST_COMPOSITE, |
| 2856 StrongModeCode.DOWN_CAST_IMPLICIT, | 2856 StrongModeCode.DOWN_CAST_IMPLICIT, |
| 2857 StrongModeCode.DYNAMIC_CAST, | 2857 StrongModeCode.DYNAMIC_CAST, |
| 2858 StrongModeCode.DYNAMIC_INVOKE, | 2858 StrongModeCode.DYNAMIC_INVOKE, |
| 2859 StrongModeCode.IMPLICIT_DYNAMIC_FIELD, |
| 2860 StrongModeCode.IMPLICIT_DYNAMIC_FUNCTION, |
| 2861 StrongModeCode.IMPLICIT_DYNAMIC_INVOKE, |
| 2862 StrongModeCode.IMPLICIT_DYNAMIC_LIST_LITERAL, |
| 2863 StrongModeCode.IMPLICIT_DYNAMIC_MAP_LITERAL, |
| 2864 StrongModeCode.IMPLICIT_DYNAMIC_METHOD, |
| 2865 StrongModeCode.IMPLICIT_DYNAMIC_PARAMETER, |
| 2866 StrongModeCode.IMPLICIT_DYNAMIC_RETURN, |
| 2867 StrongModeCode.IMPLICIT_DYNAMIC_TYPE, |
| 2868 StrongModeCode.IMPLICIT_DYNAMIC_VARIABLE, |
| 2859 StrongModeCode.INFERRED_TYPE, | 2869 StrongModeCode.INFERRED_TYPE, |
| 2860 StrongModeCode.INFERRED_TYPE_ALLOCATION, | 2870 StrongModeCode.INFERRED_TYPE_ALLOCATION, |
| 2861 StrongModeCode.INFERRED_TYPE_CLOSURE, | 2871 StrongModeCode.INFERRED_TYPE_CLOSURE, |
| 2862 StrongModeCode.INFERRED_TYPE_LITERAL, | 2872 StrongModeCode.INFERRED_TYPE_LITERAL, |
| 2863 StrongModeCode.INVALID_FIELD_OVERRIDE, | 2873 StrongModeCode.INVALID_FIELD_OVERRIDE, |
| 2864 StrongModeCode.INVALID_METHOD_OVERRIDE, | 2874 StrongModeCode.INVALID_METHOD_OVERRIDE, |
| 2865 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_BASE, | 2875 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_BASE, |
| 2866 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN, | 2876 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN, |
| 2867 StrongModeCode.INVALID_PARAMETER_DECLARATION, | 2877 StrongModeCode.INVALID_PARAMETER_DECLARATION, |
| 2868 StrongModeCode.INVALID_SUPER_INVOCATION, | 2878 StrongModeCode.INVALID_SUPER_INVOCATION, |
| (...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5836 static const String _implicitCastMessage = | 5846 static const String _implicitCastMessage = |
| 5837 'Unsound implicit cast from {0} to {1}'; | 5847 'Unsound implicit cast from {0} to {1}'; |
| 5838 | 5848 |
| 5839 static const String _typeCheckMessage = | 5849 static const String _typeCheckMessage = |
| 5840 'Type check failed: {0} is not of type {1}'; | 5850 'Type check failed: {0} is not of type {1}'; |
| 5841 | 5851 |
| 5842 static const String _invalidOverrideMessage = | 5852 static const String _invalidOverrideMessage = |
| 5843 'The type of {0}.{1} ({2}) is not a ' | 5853 'The type of {0}.{1} ({2}) is not a ' |
| 5844 'subtype of {3}.{1} ({4}).'; | 5854 'subtype of {3}.{1} ({4}).'; |
| 5845 | 5855 |
| 5856 /** |
| 5857 * This is appended to the end of an error message about implicit dynamic. |
| 5858 * |
| 5859 * The idea is to make sure the user is aware that this error message is the |
| 5860 * result of turning on a particular option, and they are free to turn it |
| 5861 * back off. |
| 5862 */ |
| 5863 static const String _implicitDynamicTip = |
| 5864 ". Either add an explicit type like 'dynamic'" |
| 5865 ", or enable implicit-dynamic in your Analyzer options."; |
| 5866 |
| 5846 static const String _inferredTypeMessage = '{0} has inferred type {1}'; | 5867 static const String _inferredTypeMessage = '{0} has inferred type {1}'; |
| 5847 | 5868 |
| 5848 static const StrongModeCode DOWN_CAST_COMPOSITE = const StrongModeCode( | 5869 static const StrongModeCode DOWN_CAST_COMPOSITE = const StrongModeCode( |
| 5849 ErrorType.STATIC_WARNING, 'DOWN_CAST_COMPOSITE', _implicitCastMessage); | 5870 ErrorType.STATIC_WARNING, 'DOWN_CAST_COMPOSITE', _implicitCastMessage); |
| 5850 | 5871 |
| 5851 static const StrongModeCode DOWN_CAST_IMPLICIT = const StrongModeCode( | 5872 static const StrongModeCode DOWN_CAST_IMPLICIT = const StrongModeCode( |
| 5852 ErrorType.HINT, 'DOWN_CAST_IMPLICIT', _implicitCastMessage); | 5873 ErrorType.HINT, 'DOWN_CAST_IMPLICIT', _implicitCastMessage); |
| 5853 | 5874 |
| 5854 static const StrongModeCode DYNAMIC_CAST = const StrongModeCode( | 5875 static const StrongModeCode DYNAMIC_CAST = const StrongModeCode( |
| 5855 ErrorType.HINT, 'DYNAMIC_CAST', _implicitCastMessage); | 5876 ErrorType.HINT, 'DYNAMIC_CAST', _implicitCastMessage); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5909 ErrorType.COMPILE_TIME_ERROR, | 5930 ErrorType.COMPILE_TIME_ERROR, |
| 5910 'INVALID_METHOD_OVERRIDE_FROM_MIXIN', | 5931 'INVALID_METHOD_OVERRIDE_FROM_MIXIN', |
| 5911 'Mixin introduces an invalid override. $_invalidOverrideMessage'); | 5932 'Mixin introduces an invalid override. $_invalidOverrideMessage'); |
| 5912 | 5933 |
| 5913 static const StrongModeCode INVALID_FIELD_OVERRIDE = const StrongModeCode( | 5934 static const StrongModeCode INVALID_FIELD_OVERRIDE = const StrongModeCode( |
| 5914 ErrorType.COMPILE_TIME_ERROR, | 5935 ErrorType.COMPILE_TIME_ERROR, |
| 5915 'INVALID_FIELD_OVERRIDE', | 5936 'INVALID_FIELD_OVERRIDE', |
| 5916 'Field declaration {3}.{1} cannot be ' | 5937 'Field declaration {3}.{1} cannot be ' |
| 5917 'overridden in {0}.'); | 5938 'overridden in {0}.'); |
| 5918 | 5939 |
| 5940 static const StrongModeCode IMPLICIT_DYNAMIC_PARAMETER = const StrongModeCode( |
| 5941 ErrorType.COMPILE_TIME_ERROR, |
| 5942 'IMPLICIT_DYNAMIC_PARAMETER', |
| 5943 "Missing parameter type for '{0}'$_implicitDynamicTip"); |
| 5944 |
| 5945 static const StrongModeCode IMPLICIT_DYNAMIC_RETURN = const StrongModeCode( |
| 5946 ErrorType.COMPILE_TIME_ERROR, |
| 5947 'IMPLICIT_DYNAMIC_RETURN', |
| 5948 "Missing return type for '{0}'$_implicitDynamicTip"); |
| 5949 |
| 5950 static const StrongModeCode IMPLICIT_DYNAMIC_VARIABLE = const StrongModeCode( |
| 5951 ErrorType.COMPILE_TIME_ERROR, |
| 5952 'IMPLICIT_DYNAMIC_VARIABLE', |
| 5953 "Missing variable type for '{0}'$_implicitDynamicTip"); |
| 5954 |
| 5955 static const StrongModeCode IMPLICIT_DYNAMIC_FIELD = const StrongModeCode( |
| 5956 ErrorType.COMPILE_TIME_ERROR, |
| 5957 'IMPLICIT_DYNAMIC_FIELD', |
| 5958 "Missing field type for '{0}'$_implicitDynamicTip"); |
| 5959 |
| 5960 static const StrongModeCode IMPLICIT_DYNAMIC_TYPE = |
| 5961 const StrongModeCode( |
| 5962 ErrorType.COMPILE_TIME_ERROR, |
| 5963 'IMPLICIT_DYNAMIC_TYPE', |
| 5964 "Missing type arguments for generic type '{0}'" |
| 5965 "$_implicitDynamicTip"); |
| 5966 |
| 5967 static const StrongModeCode IMPLICIT_DYNAMIC_LIST_LITERAL = |
| 5968 const StrongModeCode( |
| 5969 ErrorType.COMPILE_TIME_ERROR, |
| 5970 'IMPLICIT_DYNAMIC_LIST_LITERAL', |
| 5971 "Missing type argument for list literal$_implicitDynamicTip"); |
| 5972 |
| 5973 static const StrongModeCode IMPLICIT_DYNAMIC_MAP_LITERAL = |
| 5974 const StrongModeCode( |
| 5975 ErrorType.COMPILE_TIME_ERROR, |
| 5976 'IMPLICIT_DYNAMIC_MAP_LITERAL', |
| 5977 'Missing type arguments for map literal$_implicitDynamicTip'); |
| 5978 |
| 5979 static const StrongModeCode IMPLICIT_DYNAMIC_FUNCTION = const StrongModeCode( |
| 5980 ErrorType.COMPILE_TIME_ERROR, |
| 5981 'IMPLICIT_DYNAMIC_FUNCTION', |
| 5982 "Missing type arguments for generic function '{0}<{1}>'" |
| 5983 "$_implicitDynamicTip"); |
| 5984 |
| 5985 static const StrongModeCode IMPLICIT_DYNAMIC_METHOD = const StrongModeCode( |
| 5986 ErrorType.COMPILE_TIME_ERROR, |
| 5987 'IMPLICIT_DYNAMIC_METHOD', |
| 5988 "Missing type arguments for generic method '{0}<{1}>'" |
| 5989 "$_implicitDynamicTip"); |
| 5990 |
| 5991 static const StrongModeCode IMPLICIT_DYNAMIC_INVOKE = const StrongModeCode( |
| 5992 ErrorType.COMPILE_TIME_ERROR, |
| 5993 'IMPLICIT_DYNAMIC_INVOKE', |
| 5994 "Missing type arguments for calling generic function type '{0}'" |
| 5995 "$_implicitDynamicTip"); |
| 5996 |
| 5919 @override | 5997 @override |
| 5920 final ErrorType type; | 5998 final ErrorType type; |
| 5921 | 5999 |
| 5922 /** | 6000 /** |
| 5923 * Initialize a newly created error code to have the given [type] and [name]. | 6001 * Initialize a newly created error code to have the given [type] and [name]. |
| 5924 * | 6002 * |
| 5925 * The message associated with the error will be created from the given | 6003 * The message associated with the error will be created from the given |
| 5926 * [message] template. The correction associated with the error will be | 6004 * [message] template. The correction associated with the error will be |
| 5927 * created from the optional [correction] template. | 6005 * created from the optional [correction] template. |
| 5928 */ | 6006 */ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5965 * Initialize a newly created error code to have the given [name]. | 6043 * Initialize a newly created error code to have the given [name]. |
| 5966 */ | 6044 */ |
| 5967 const TodoCode(String name) : super(name, "{0}"); | 6045 const TodoCode(String name) : super(name, "{0}"); |
| 5968 | 6046 |
| 5969 @override | 6047 @override |
| 5970 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 6048 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 5971 | 6049 |
| 5972 @override | 6050 @override |
| 5973 ErrorType get type => ErrorType.TODO; | 6051 ErrorType get type => ErrorType.TODO; |
| 5974 } | 6052 } |
| OLD | NEW |