| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 * 12.1 Constants: A qualified reference to a static constant variable that is | 522 * 12.1 Constants: A qualified reference to a static constant variable that is |
| 523 * not qualified by a deferred prefix. | 523 * not qualified by a deferred prefix. |
| 524 */ | 524 */ |
| 525 static const CompileTimeErrorCode | 525 static const CompileTimeErrorCode |
| 526 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY = | 526 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY = |
| 527 const CompileTimeErrorCode( | 527 const CompileTimeErrorCode( |
| 528 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', | 528 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', |
| 529 "Constant values from a deferred library can't be used to " | 529 "Constant values from a deferred library can't be used to " |
| 530 "initialized a const variable.", | 530 "initialized a const variable.", |
| 531 "Try initializing the variable without referencing members of the " | 531 "Try initializing the variable without referencing members of the " |
| 532 "deferred library, or" | 532 "deferred library, or " |
| 533 "changing the import to not be deferred."); | 533 "changing the import to not be deferred."); |
| 534 | 534 |
| 535 /** | 535 /** |
| 536 * 7.5 Instance Variables: It is a compile-time error if an instance variable | 536 * 7.5 Instance Variables: It is a compile-time error if an instance variable |
| 537 * is declared to be constant. | 537 * is declared to be constant. |
| 538 */ | 538 */ |
| 539 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = | 539 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = |
| 540 const CompileTimeErrorCode( | 540 const CompileTimeErrorCode( |
| 541 'CONST_INSTANCE_FIELD', | 541 'CONST_INSTANCE_FIELD', |
| 542 "Only static fields can be declared as const.", | 542 "Only static fields can be declared as const.", |
| (...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2772 "making the variable nullable by adding a '?' after the type name."); | 2772 "making the variable nullable by adding a '?' after the type name."); |
| 2773 | 2773 |
| 2774 /** | 2774 /** |
| 2775 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, | 2775 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, |
| 2776 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. | 2776 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. |
| 2777 */ | 2777 */ |
| 2778 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = | 2778 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = |
| 2779 const StaticTypeWarningCode( | 2779 const StaticTypeWarningCode( |
| 2780 'NON_TYPE_AS_TYPE_ARGUMENT', | 2780 'NON_TYPE_AS_TYPE_ARGUMENT', |
| 2781 "The name '{0}' isn't a type so it can't be used as a type argument.", | 2781 "The name '{0}' isn't a type so it can't be used as a type argument.", |
| 2782 "Try correcting the name to an existing type, or" | 2782 "Try correcting the name to an existing type, or " |
| 2783 "defining a type named '{0}'."); | 2783 "defining a type named '{0}'."); |
| 2784 | 2784 |
| 2785 /** | 2785 /** |
| 2786 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not | 2786 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not |
| 2787 * be assigned to the declared return type of the immediately enclosing | 2787 * be assigned to the declared return type of the immediately enclosing |
| 2788 * function. | 2788 * function. |
| 2789 * | 2789 * |
| 2790 * Parameters: | 2790 * Parameters: |
| 2791 * 0: the return type as declared in the return statement | 2791 * 0: the return type as declared in the return statement |
| 2792 * 1: the expected return type as defined by the method | 2792 * 1: the expected return type as defined by the method |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 2852 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
| 2853 * | 2853 * |
| 2854 * Parameters: | 2854 * Parameters: |
| 2855 * 0: the name of the enumeration constant that is not defined | 2855 * 0: the name of the enumeration constant that is not defined |
| 2856 * 1: the name of the enumeration used to access the constant | 2856 * 1: the name of the enumeration used to access the constant |
| 2857 */ | 2857 */ |
| 2858 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = | 2858 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = |
| 2859 const StaticTypeWarningCode( | 2859 const StaticTypeWarningCode( |
| 2860 'UNDEFINED_ENUM_CONSTANT', | 2860 'UNDEFINED_ENUM_CONSTANT', |
| 2861 "There is no constant named '{0}' in '{1}'.", | 2861 "There is no constant named '{0}' in '{1}'.", |
| 2862 "Try correcting the name to the name of an existing constant, or" | 2862 "Try correcting the name to the name of an existing constant, or " |
| 2863 "defining a constant named '{0}'."); | 2863 "defining a constant named '{0}'."); |
| 2864 | 2864 |
| 2865 /** | 2865 /** |
| 2866 * 12.15.3 Unqualified Invocation: If there exists a lexically visible | 2866 * 12.15.3 Unqualified Invocation: If there exists a lexically visible |
| 2867 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost | 2867 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost |
| 2868 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is | 2868 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is |
| 2869 * considered equivalent to the ordinary method invocation | 2869 * considered equivalent to the ordinary method invocation |
| 2870 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, | 2870 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, |
| 2871 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., | 2871 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., |
| 2872 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). | 2872 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). |
| 2873 * | 2873 * |
| 2874 * Parameters: | 2874 * Parameters: |
| 2875 * 0: the name of the method that is undefined | 2875 * 0: the name of the method that is undefined |
| 2876 */ | 2876 */ |
| 2877 static const StaticTypeWarningCode UNDEFINED_FUNCTION = | 2877 static const StaticTypeWarningCode UNDEFINED_FUNCTION = |
| 2878 const StaticTypeWarningCode( | 2878 const StaticTypeWarningCode( |
| 2879 'UNDEFINED_FUNCTION', | 2879 'UNDEFINED_FUNCTION', |
| 2880 "The function '{0}' isn't defined.", | 2880 "The function '{0}' isn't defined.", |
| 2881 "Try importing the library that defines '{0}', " | 2881 "Try importing the library that defines '{0}', " |
| 2882 "correcting the name to the name of an existing function, or" | 2882 "correcting the name to the name of an existing function, or " |
| 2883 "defining a funtion named '{0}'."); | 2883 "defining a funtion named '{0}'."); |
| 2884 | 2884 |
| 2885 /** | 2885 /** |
| 2886 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is | 2886 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
| 2887 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. | 2887 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
| 2888 * | 2888 * |
| 2889 * Parameters: | 2889 * Parameters: |
| 2890 * 0: the name of the getter | 2890 * 0: the name of the getter |
| 2891 * 1: the name of the enclosing type where the getter is being looked for | 2891 * 1: the name of the enclosing type where the getter is being looked for |
| 2892 */ | 2892 */ |
| 2893 static const StaticTypeWarningCode UNDEFINED_GETTER = | 2893 static const StaticTypeWarningCode UNDEFINED_GETTER = |
| 2894 const StaticTypeWarningCode( | 2894 const StaticTypeWarningCode( |
| 2895 'UNDEFINED_GETTER', | 2895 'UNDEFINED_GETTER', |
| 2896 "The getter '{0}' isn't defined for the class '{1}'.", | 2896 "The getter '{0}' isn't defined for the class '{1}'.", |
| 2897 "Try importing the library that defines '{0}', " | 2897 "Try importing the library that defines '{0}', " |
| 2898 "correcting the name to the name of an existing getter, or" | 2898 "correcting the name to the name of an existing getter, or " |
| 2899 "defining a getter or field named '{0}'."); | 2899 "defining a getter or field named '{0}'."); |
| 2900 | 2900 |
| 2901 /** | 2901 /** |
| 2902 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 2902 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 2903 * It is a static type warning if <i>T</i> does not have an accessible | 2903 * It is a static type warning if <i>T</i> does not have an accessible |
| 2904 * instance member named <i>m</i>. | 2904 * instance member named <i>m</i>. |
| 2905 * | 2905 * |
| 2906 * Parameters: | 2906 * Parameters: |
| 2907 * 0: the name of the method that is undefined | 2907 * 0: the name of the method that is undefined |
| 2908 * 1: the resolved type name that the method lookup is happening on | 2908 * 1: the resolved type name that the method lookup is happening on |
| 2909 */ | 2909 */ |
| 2910 static const StaticTypeWarningCode UNDEFINED_METHOD = | 2910 static const StaticTypeWarningCode UNDEFINED_METHOD = |
| 2911 const StaticTypeWarningCode( | 2911 const StaticTypeWarningCode( |
| 2912 'UNDEFINED_METHOD', | 2912 'UNDEFINED_METHOD', |
| 2913 "The method '{0}' isn't defined for the class '{1}'.", | 2913 "The method '{0}' isn't defined for the class '{1}'.", |
| 2914 "Try correcting the name to the name of an existing method, or" | 2914 "Try correcting the name to the name of an existing method, or " |
| 2915 "defining a method named '{0}'."); | 2915 "defining a method named '{0}'."); |
| 2916 | 2916 |
| 2917 /** | 2917 /** |
| 2918 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 2918 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 2919 * It is a static type warning if <i>T</i> does not have an accessible | 2919 * It is a static type warning if <i>T</i> does not have an accessible |
| 2920 * instance member named <i>m</i>. | 2920 * instance member named <i>m</i>. |
| 2921 * | 2921 * |
| 2922 * Parameters: | 2922 * Parameters: |
| 2923 * 0: the name of the method that is undefined | 2923 * 0: the name of the method that is undefined |
| 2924 * 1: the resolved type name that the method lookup is happening on | 2924 * 1: the resolved type name that the method lookup is happening on |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 * | 2963 * |
| 2964 * Parameters: | 2964 * Parameters: |
| 2965 * 0: the name of the setter | 2965 * 0: the name of the setter |
| 2966 * 1: the name of the enclosing type where the setter is being looked for | 2966 * 1: the name of the enclosing type where the setter is being looked for |
| 2967 */ | 2967 */ |
| 2968 static const StaticTypeWarningCode UNDEFINED_SETTER = | 2968 static const StaticTypeWarningCode UNDEFINED_SETTER = |
| 2969 const StaticTypeWarningCode( | 2969 const StaticTypeWarningCode( |
| 2970 'UNDEFINED_SETTER', | 2970 'UNDEFINED_SETTER', |
| 2971 "The setter '{0}' isn't defined for the class '{1}'.", | 2971 "The setter '{0}' isn't defined for the class '{1}'.", |
| 2972 "Try importing the library that defines '{0}', " | 2972 "Try importing the library that defines '{0}', " |
| 2973 "correcting the name to the name of an existing setter, or" | 2973 "correcting the name to the name of an existing setter, or " |
| 2974 "defining a setter or field named '{0}'."); | 2974 "defining a setter or field named '{0}'."); |
| 2975 | 2975 |
| 2976 /** | 2976 /** |
| 2977 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is | 2977 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
| 2978 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. | 2978 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
| 2979 * | 2979 * |
| 2980 * Parameters: | 2980 * Parameters: |
| 2981 * 0: the name of the getter | 2981 * 0: the name of the getter |
| 2982 * 1: the name of the enclosing type where the getter is being looked for | 2982 * 1: the name of the enclosing type where the getter is being looked for |
| 2983 */ | 2983 */ |
| 2984 static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER = | 2984 static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER = |
| 2985 const StaticTypeWarningCode( | 2985 const StaticTypeWarningCode( |
| 2986 'UNDEFINED_SUPER_GETTER', | 2986 'UNDEFINED_SUPER_GETTER', |
| 2987 "The getter '{0}' isn't defined in a superclass of '{1}'.", | 2987 "The getter '{0}' isn't defined in a superclass of '{1}'.", |
| 2988 "Try correcting the name to the name of an existing getter, or" | 2988 "Try correcting the name to the name of an existing getter, or " |
| 2989 "defining a getter or field named '{0}' in a superclass."); | 2989 "defining a getter or field named '{0}' in a superclass."); |
| 2990 | 2990 |
| 2991 /** | 2991 /** |
| 2992 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 2992 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 2993 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 2993 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
| 2994 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 2994 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
| 2995 * static type warning if <i>S</i> does not have an accessible instance member | 2995 * static type warning if <i>S</i> does not have an accessible instance member |
| 2996 * named <i>m</i>. | 2996 * named <i>m</i>. |
| 2997 * | 2997 * |
| 2998 * Parameters: | 2998 * Parameters: |
| 2999 * 0: the name of the method that is undefined | 2999 * 0: the name of the method that is undefined |
| 3000 * 1: the resolved type name that the method lookup is happening on | 3000 * 1: the resolved type name that the method lookup is happening on |
| 3001 */ | 3001 */ |
| 3002 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = | 3002 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = |
| 3003 const StaticTypeWarningCode( | 3003 const StaticTypeWarningCode( |
| 3004 'UNDEFINED_SUPER_METHOD', | 3004 'UNDEFINED_SUPER_METHOD', |
| 3005 "The method '{0}' isn't defined in a superclass of '{1}'.", | 3005 "The method '{0}' isn't defined in a superclass of '{1}'.", |
| 3006 "Try correcting the name to the name of an existing method, or" | 3006 "Try correcting the name to the name of an existing method, or " |
| 3007 "defining a method named '{0}' in a superclass."); | 3007 "defining a method named '{0}' in a superclass."); |
| 3008 | 3008 |
| 3009 /** | 3009 /** |
| 3010 * 12.18 Assignment: Evaluation of an assignment of the form | 3010 * 12.18 Assignment: Evaluation of an assignment of the form |
| 3011 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is | 3011 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
| 3012 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); | 3012 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
| 3013 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, | 3013 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
| 3014 * <i>e<sub>2</sub></i>). | 3014 * <i>e<sub>2</sub></i>). |
| 3015 * | 3015 * |
| 3016 * 12.29 Assignable Expressions: An assignable expression of the form | 3016 * 12.29 Assignable Expressions: An assignable expression of the form |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3038 * instance setter named <i>v=</i>. | 3038 * instance setter named <i>v=</i>. |
| 3039 * | 3039 * |
| 3040 * Parameters: | 3040 * Parameters: |
| 3041 * 0: the name of the setter | 3041 * 0: the name of the setter |
| 3042 * 1: the name of the enclosing type where the setter is being looked for | 3042 * 1: the name of the enclosing type where the setter is being looked for |
| 3043 */ | 3043 */ |
| 3044 static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER = | 3044 static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER = |
| 3045 const StaticTypeWarningCode( | 3045 const StaticTypeWarningCode( |
| 3046 'UNDEFINED_SUPER_SETTER', | 3046 'UNDEFINED_SUPER_SETTER', |
| 3047 "The setter '{0}' isn't defined in a superclass of '{1}'.", | 3047 "The setter '{0}' isn't defined in a superclass of '{1}'.", |
| 3048 "Try correcting the name to the name of an existing setter, or" | 3048 "Try correcting the name to the name of an existing setter, or " |
| 3049 "defining a setter or field named '{0}' in a superclass."); | 3049 "defining a setter or field named '{0}' in a superclass."); |
| 3050 | 3050 |
| 3051 /** | 3051 /** |
| 3052 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does | 3052 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does |
| 3053 * not have an accessible (3.2) instance member named <i>m</i>. | 3053 * not have an accessible (3.2) instance member named <i>m</i>. |
| 3054 * | 3054 * |
| 3055 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used | 3055 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used |
| 3056 * when we are able to find the name defined in a supertype. It exists to | 3056 * when we are able to find the name defined in a supertype. It exists to |
| 3057 * provide a more informative error message. | 3057 * provide a more informative error message. |
| 3058 * | 3058 * |
| (...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4845 * created from the optional [correction] template. | 4845 * created from the optional [correction] template. |
| 4846 */ | 4846 */ |
| 4847 const StrongModeCode(ErrorType type, String name, String message, | 4847 const StrongModeCode(ErrorType type, String name, String message, |
| 4848 [String correction]) | 4848 [String correction]) |
| 4849 : type = type, | 4849 : type = type, |
| 4850 super('STRONG_MODE_$name', message, correction); | 4850 super('STRONG_MODE_$name', message, correction); |
| 4851 | 4851 |
| 4852 @override | 4852 @override |
| 4853 ErrorSeverity get errorSeverity => type.severity; | 4853 ErrorSeverity get errorSeverity => type.severity; |
| 4854 } | 4854 } |
| OLD | NEW |