Version 2.18.0-128.0.dev
Merge commit 'd10ee227faa0e39ec09087bb8593dd724effbf30' into 'dev'
diff --git a/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart b/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
index cbe95e2..c12b308 100644
--- a/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
+++ b/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
@@ -9,33 +9,25 @@
import "package:analyzer/error/error.dart";
-// It is hard to visually separate each code's _doc comment_ from its published
-// _documentation comment_ when each is written as an end-of-line comment.
-// ignore_for_file: slash_for_doc_comments
-
class AnalysisOptionsErrorCode extends ErrorCode {
- /**
- * An error code indicating that there is a syntactic error in the included
- * file.
- *
- * Parameters:
- * 0: the path of the file containing the error
- * 1: the starting offset of the text in the file that contains the error
- * 2: the ending offset of the text in the file that contains the error
- * 3: the error message
- */
+ /// An error code indicating that there is a syntactic error in the included
+ /// file.
+ ///
+ /// Parameters:
+ /// 0: the path of the file containing the error
+ /// 1: the starting offset of the text in the file that contains the error
+ /// 2: the ending offset of the text in the file that contains the error
+ /// 3: the error message
static const AnalysisOptionsErrorCode INCLUDED_FILE_PARSE_ERROR =
AnalysisOptionsErrorCode(
'INCLUDED_FILE_PARSE_ERROR',
"{3} in {0}({1}..{2})",
);
- /**
- * An error code indicating that there is a syntactic error in the file.
- *
- * Parameters:
- * 0: the error message from the parse error
- */
+ /// An error code indicating that there is a syntactic error in the file.
+ ///
+ /// Parameters:
+ /// 0: the error message from the parse error
static const AnalysisOptionsErrorCode PARSE_ERROR = AnalysisOptionsErrorCode(
'PARSE_ERROR',
"{0}",
@@ -66,10 +58,8 @@
}
class AnalysisOptionsHintCode extends ErrorCode {
- /**
- * An error code indicating that the enablePreviewDart2 setting is
- * deprecated.
- */
+ /// An error code indicating that the enablePreviewDart2 setting is
+ /// deprecated.
static const AnalysisOptionsHintCode PREVIEW_DART_2_SETTING_DEPRECATED =
AnalysisOptionsHintCode(
'PREVIEW_DART_2_SETTING_DEPRECATED',
@@ -77,9 +67,7 @@
correctionMessage: "It is no longer necessary to explicitly enable Dart 2.",
);
- /**
- * An error code indicating that strong-mode: true is deprecated.
- */
+ /// An error code indicating that strong-mode: true is deprecated.
static const AnalysisOptionsHintCode STRONG_MODE_SETTING_DEPRECATED =
AnalysisOptionsHintCode(
'STRONG_MODE_SETTING_DEPRECATED',
@@ -88,10 +76,8 @@
"It is no longer necessary to explicitly enable strong mode.",
);
- /**
- * An error code indicating that the enablePreviewDart2 setting is
- * deprecated.
- */
+ /// An error code indicating that the enablePreviewDart2 setting is
+ /// deprecated.
static const AnalysisOptionsHintCode SUPER_MIXINS_SETTING_DEPRECATED =
AnalysisOptionsHintCode(
'SUPER_MIXINS_SETTING_DEPRECATED',
@@ -125,69 +111,57 @@
}
class AnalysisOptionsWarningCode extends ErrorCode {
- /**
- * An error code indicating that the given option is deprecated.
- */
+ /// An error code indicating that the given option is deprecated.
static const AnalysisOptionsWarningCode ANALYSIS_OPTION_DEPRECATED =
AnalysisOptionsWarningCode(
'ANALYSIS_OPTION_DEPRECATED',
"The option '{0}' is no longer supported.",
);
- /**
- * An error code indicating a specified include file has a warning.
- *
- * Parameters:
- * 0: the path of the file containing the warnings
- * 1: the starting offset of the text in the file that contains the warning
- * 2: the ending offset of the text in the file that contains the warning
- * 3: the warning message
- */
+ /// An error code indicating a specified include file has a warning.
+ ///
+ /// Parameters:
+ /// 0: the path of the file containing the warnings
+ /// 1: the starting offset of the text in the file that contains the warning
+ /// 2: the ending offset of the text in the file that contains the warning
+ /// 3: the warning message
static const AnalysisOptionsWarningCode INCLUDED_FILE_WARNING =
AnalysisOptionsWarningCode(
'INCLUDED_FILE_WARNING',
"Warning in the included options file {0}({1}..{2}): {3}",
);
- /**
- * An error code indicating a specified include file could not be found.
- *
- * Parameters:
- * 0: the uri of the file to be included
- * 1: the path of the file containing the include directive
- * 2: the path of the context being analyzed
- */
+ /// An error code indicating a specified include file could not be found.
+ ///
+ /// Parameters:
+ /// 0: the uri of the file to be included
+ /// 1: the path of the file containing the include directive
+ /// 2: the path of the context being analyzed
static const AnalysisOptionsWarningCode INCLUDE_FILE_NOT_FOUND =
AnalysisOptionsWarningCode(
'INCLUDE_FILE_NOT_FOUND',
"The include file '{0}' in '{1}' can't be found when analyzing '{2}'.",
);
- /**
- * An error code indicating that a plugin is being configured with an invalid
- * value for an option and a detail message is provided.
- */
+ /// An error code indicating that a plugin is being configured with an invalid
+ /// value for an option and a detail message is provided.
static const AnalysisOptionsWarningCode INVALID_OPTION =
AnalysisOptionsWarningCode(
'INVALID_OPTION',
"Invalid option specified for '{0}': {1}",
);
- /**
- * An error code indicating an invalid format for an options file section.
- *
- * Parameters:
- * 0: the section name
- */
+ /// An error code indicating an invalid format for an options file section.
+ ///
+ /// Parameters:
+ /// 0: the section name
static const AnalysisOptionsWarningCode INVALID_SECTION_FORMAT =
AnalysisOptionsWarningCode(
'INVALID_SECTION_FORMAT',
"Invalid format for the '{0}' section.",
);
- /**
- * An error code indicating that strong-mode: false is has been removed.
- */
+ /// An error code indicating that strong-mode: false is has been removed.
static const AnalysisOptionsWarningCode SPEC_MODE_REMOVED =
AnalysisOptionsWarningCode(
'SPEC_MODE_REMOVED',
@@ -197,42 +171,36 @@
"code Dart 2 compliant).",
);
- /**
- * An error code indicating that an unrecognized error code is being used to
- * specify an error filter.
- *
- * Parameters:
- * 0: the unrecognized error code
- */
+ /// An error code indicating that an unrecognized error code is being used to
+ /// specify an error filter.
+ ///
+ /// Parameters:
+ /// 0: the unrecognized error code
static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE =
AnalysisOptionsWarningCode(
'UNRECOGNIZED_ERROR_CODE',
"'{0}' isn't a recognized error code.",
);
- /**
- * An error code indicating that a plugin is being configured with an
- * unsupported option and legal options are provided.
- *
- * Parameters:
- * 0: the plugin name
- * 1: the unsupported option key
- */
+ /// An error code indicating that a plugin is being configured with an
+ /// unsupported option and legal options are provided.
+ ///
+ /// Parameters:
+ /// 0: the plugin name
+ /// 1: the unsupported option key
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITHOUT_VALUES =
AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITHOUT_VALUES',
"The option '{1}' isn't supported by '{0}'.",
);
- /**
- * An error code indicating that a plugin is being configured with an
- * unsupported option where there is just one legal value.
- *
- * Parameters:
- * 0: the plugin name
- * 1: the unsupported option key
- * 2: the legal value
- */
+ /// An error code indicating that a plugin is being configured with an
+ /// unsupported option where there is just one legal value.
+ ///
+ /// Parameters:
+ /// 0: the plugin name
+ /// 1: the unsupported option key
+ /// 2: the legal value
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE =
AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE',
@@ -240,15 +208,13 @@
"option: '{2}'.",
);
- /**
- * An error code indicating that a plugin is being configured with an
- * unsupported option and legal options are provided.
- *
- * Parameters:
- * 0: the plugin name
- * 1: the unsupported option key
- * 2: legal values
- */
+ /// An error code indicating that a plugin is being configured with an
+ /// unsupported option and legal options are provided.
+ ///
+ /// Parameters:
+ /// 0: the plugin name
+ /// 1: the unsupported option key
+ /// 2: legal values
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES =
AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
@@ -256,15 +222,13 @@
correctionMessage: "Try using one of the supported options: {2}.",
);
- /**
- * An error code indicating that an option entry is being configured with an
- * unsupported value.
- *
- * Parameters:
- * 0: the option name
- * 1: the unsupported value
- * 2: legal values
- */
+ /// An error code indicating that an option entry is being configured with an
+ /// unsupported value.
+ ///
+ /// Parameters:
+ /// 0: the option name
+ /// 1: the unsupported value
+ /// 2: legal values
static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE =
AnalysisOptionsWarningCode(
'UNSUPPORTED_VALUE',
diff --git a/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart b/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
index ae6c868..3e49dd7 100644
--- a/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
@@ -10,14 +10,8 @@
import "package:analyzer/error/error.dart";
import "package:analyzer/src/error/analyzer_error_code.dart";
-// It is hard to visually separate each code's _doc comment_ from its published
-// _documentation comment_ when each is written as an end-of-line comment.
-// ignore_for_file: slash_for_doc_comments
-
class FfiCode extends AnalyzerErrorCode {
- /**
- * No parameters.
- */
+ /// No parameters.
static const FfiCode ABI_SPECIFIC_INTEGER_INVALID = FfiCode(
'ABI_SPECIFIC_INTEGER_INVALID',
"Classes extending 'AbiSpecificInteger' must have exactly one const "
@@ -27,9 +21,7 @@
"const constructor.",
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const FfiCode ABI_SPECIFIC_INTEGER_MAPPING_EXTRA = FfiCode(
'ABI_SPECIFIC_INTEGER_MAPPING_EXTRA',
"Classes extending 'AbiSpecificInteger' must have exactly one "
@@ -38,9 +30,7 @@
correctionMessage: "Try removing the extra annotation.",
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const FfiCode ABI_SPECIFIC_INTEGER_MAPPING_MISSING = FfiCode(
'ABI_SPECIFIC_INTEGER_MAPPING_MISSING',
"Classes extending 'AbiSpecificInteger' must have exactly one "
@@ -49,9 +39,7 @@
correctionMessage: "Try adding an annotation.",
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const FfiCode ABI_SPECIFIC_INTEGER_MAPPING_UNSUPPORTED = FfiCode(
'ABI_SPECIFIC_INTEGER_MAPPING_UNSUPPORTED',
"Only mappings to 'Int8', 'Int16', 'Int32', 'Int64', 'Uint8', 'Uint16', "
@@ -61,43 +49,7 @@
"'Uint16', 'UInt32', or 'Uint64'.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field that's declared in a
- // subclass of `Struct` and has the type `Pointer` also has an annotation
- // associated with it.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `p`, which
- // has the type `Pointer` and is declared in a subclass of `Struct`, has the
- // annotation `@Double()`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // [!@Double()!]
- // external Pointer<Int8> p;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the annotations from the field:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // external Pointer<Int8> p;
- // }
- // ```
+ /// No parameters.
static const FfiCode ANNOTATION_ON_POINTER_FIELD = FfiCode(
'ANNOTATION_ON_POINTER_FIELD',
"Fields in a struct class whose type is 'Pointer' shouldn't have any "
@@ -106,60 +58,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the argument
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation of either
- // `Pointer.asFunction` or `DynamicLibrary.lookupFunction` has an `isLeaf`
- // argument whose value isn't a constant expression.
- //
- // The analyzer also produces this diagnostic when the value of the
- // `exceptionalReturn` argument of `Pointer.fromFunction`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of the
- // `isLeaf` argument is a parameter, and hence isn't a constant:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // int Function(int) fromPointer(
- // Pointer<NativeFunction<Int8 Function(Int8)>> p, bool isLeaf) {
- // return p.asFunction(isLeaf: [!isLeaf!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there's a suitable constant that can be used, then replace the argument
- // with a constant:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // const isLeaf = false;
- //
- // int Function(int) fromPointer(Pointer<NativeFunction<Int8 Function(Int8)>> p) {
- // return p.asFunction(isLeaf: isLeaf);
- // }
- // ```
- //
- // If there isn't a suitable constant, then replace the argument with a
- // boolean literal:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // int Function(int) fromPointer(Pointer<NativeFunction<Int8 Function(Int8)>> p) {
- // return p.asFunction(isLeaf: true);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the argument
static const FfiCode ARGUMENT_MUST_BE_A_CONSTANT = FfiCode(
'ARGUMENT_MUST_BE_A_CONSTANT',
"Argument '{0}' must be a constant.",
@@ -167,41 +67,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the struct or union class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a subclass of either `Struct`
- // or `Union` implements `Finalizable`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `S`
- // implements `Finalizable`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class [!S!] extends Struct implements Finalizable {
- // external Pointer notEmpty;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Try removing the implements clause from the class:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class S extends Struct {
- // external Pointer notEmpty;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the struct or union class
static const FfiCode COMPOUND_IMPLEMENTS_FINALIZABLE = FfiCode(
'COMPOUND_IMPLEMENTS_FINALIZABLE',
"The class '{0}' can't implement Finalizable.",
@@ -209,55 +76,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a subclass of either `Struct`
- // or `Union` is instantiated using a generative constructor.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C` is being
- // instantiated using a generative constructor:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int32()
- // external int a;
- // }
- //
- // void f() {
- // [!C!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you need to allocate the structure described by the class, then use the
- // `ffi` package to do so:
- //
- // ```dart
- // import 'dart:ffi';
- // import 'package:ffi/ffi.dart';
- //
- // class C extends Struct {
- // @Int32()
- // external int a;
- // }
- //
- // void f() {
- // final pointer = calloc.allocate<C>(4);
- // final c = pointer.ref;
- // print(c);
- // calloc.free(pointer);
- // }
- // ```
+ /// No parameters.
static const FfiCode CREATION_OF_STRUCT_OR_UNION = FfiCode(
'CREATION_OF_STRUCT_OR_UNION',
"Subclasses of 'Struct' and 'Union' are backed by native memory, and can't "
@@ -267,58 +86,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the superclass
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a subclass of `Struct` or
- // `Union` doesn't have any fields. Having an empty `Struct` or `Union`
- // isn't supported.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C`, which
- // extends `Struct`, doesn't declare any fields:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class [!C!] extends Struct {}
- // ```
- //
- // #### Common fixes
- //
- // If the class is intended to be a struct, then declare one or more fields:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int32()
- // external int x;
- // }
- // ```
- //
- // If the class is intended to be used as a type argument to `Pointer`, then
- // make it a subclass of `Opaque`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Opaque {}
- // ```
- //
- // If the class isn't intended to be a struct, then remove or change the
- // extends clause:
- //
- // ```dart
- // class C {}
- // ```
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the superclass
static const FfiCode EMPTY_STRUCT = FfiCode(
'EMPTY_STRUCT',
"The class '{0}' can't be empty because it's a subclass of '{1}'.",
@@ -327,43 +97,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of
- // `Struct` has more than one annotation describing the native type of the
- // field.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `x` has two
- // annotations describing the native type of the field:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int32()
- // [!@Int16()!]
- // external int x;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove all but one of the annotations:
- //
- // ```dart
- // import 'dart:ffi';
- // class C extends Struct {
- // @Int32()
- // external int x;
- // }
- // ```
+ /// No parameters.
static const FfiCode EXTRA_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
'EXTRA_ANNOTATION_ON_STRUCT_FIELD',
"Fields in a struct class must have exactly one annotation indicating the "
@@ -372,44 +106,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of
- // `Struct` has more than one annotation describing the size of the native
- // array.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `a0` has two
- // annotations that specify the size of the native array:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Array(4)
- // [!@Array(8)!]
- // external Array<Uint8> a0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove all but one of the annotations:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Array(8)
- // external Array<Uint8> a0;
- // }
- // ```
+ /// No parameters.
static const FfiCode EXTRA_SIZE_ANNOTATION_CARRAY = FfiCode(
'EXTRA_SIZE_ANNOTATION_CARRAY',
"'Array's must have exactly one 'Array' annotation.",
@@ -417,18 +114,14 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const FfiCode FFI_NATIVE_MUST_BE_EXTERNAL = FfiCode(
'FFI_NATIVE_MUST_BE_EXTERNAL',
"FfiNative functions must be declared external.",
correctionMessage: "Add the `external` keyword to the function.",
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const FfiCode
FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER =
FfiCode(
@@ -437,11 +130,9 @@
correctionMessage: "Pass as Handle instead.",
);
- /**
- * Parameters:
- * 0: the expected number of parameters
- * 1: the actual number of parameters
- */
+ /// Parameters:
+ /// 0: the expected number of parameters
+ /// 1: the actual number of parameters
static const FfiCode FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS = FfiCode(
'FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS',
"Unexpected number of FfiNative annotation parameters. Expected {0} but "
@@ -449,11 +140,9 @@
correctionMessage: "Make sure parameters match the function annotated.",
);
- /**
- * Parameters:
- * 0: the expected number of parameters
- * 1: the actual number of parameters
- */
+ /// Parameters:
+ /// 0: the expected number of parameters
+ /// 1: the actual number of parameters
static const FfiCode
FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS_WITH_RECEIVER = FfiCode(
'FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS_WITH_RECEIVER',
@@ -465,48 +154,7 @@
"first parameter for the receiver.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor in a subclass of
- // either `Struct` or `Union` has one or more field initializers.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C` has a
- // constructor with an initializer for the field `f`:
- //
- // ```dart
- // // @dart = 2.9
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int32()
- // int f;
- //
- // C() : [!f = 0!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the field initializer:
- //
- // ```dart
- // // @dart = 2.9
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int32()
- // int f;
- //
- // C();
- // }
- // ```
+ /// No parameters.
static const FfiCode FIELD_INITIALIZER_IN_STRUCT = FfiCode(
'FIELD_INITIALIZER_IN_STRUCT',
"Constructors in subclasses of 'Struct' and 'Union' can't have field "
@@ -516,42 +164,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of
- // `Struct` has an initializer.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `p` has an
- // initializer:
- //
- // ```dart
- // // @dart = 2.9
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // Pointer [!p!] = nullptr;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the initializer:
- //
- // ```dart
- // // @dart = 2.9
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // Pointer p;
- // }
- // ```
+ /// No parameters.
static const FfiCode FIELD_IN_STRUCT_WITH_INITIALIZER = FfiCode(
'FIELD_IN_STRUCT_WITH_INITIALIZER',
"Fields in subclasses of 'Struct' and 'Union' can't have initializers.",
@@ -560,42 +173,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of either
- // `Struct` or `Union` isn't marked as being `external`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `a` isn't
- // marked as being `external`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int16()
- // int [!a!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add the required `external` modifier:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int16()
- // external int a;
- // }
- // ```
+ /// No parameters.
static const FfiCode FIELD_MUST_BE_EXTERNAL_IN_STRUCT = FfiCode(
'FIELD_MUST_BE_EXTERNAL_IN_STRUCT',
"Fields of 'Struct' and 'Union' subclasses must be marked external.",
@@ -603,41 +181,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the struct class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a subclass of either `Struct`
- // or `Union` has a type parameter.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `S` defines
- // the type parameter `T`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class [!S!]<T> extends Struct {
- // external Pointer notEmpty;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the type parameters from the class:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class S extends Struct {
- // external Pointer notEmpty;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the struct class
static const FfiCode GENERIC_STRUCT_SUBCLASS = FfiCode(
'GENERIC_STRUCT_SUBCLASS',
"The class '{0}' can't extend 'Struct' or 'Union' because '{0}' is "
@@ -646,50 +191,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation of the method
- // `Pointer.fromFunction` has a second argument (the exceptional return
- // value) and the type to be returned from the invocation is either `void`,
- // `Handle` or `Pointer`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because a second argument is
- // provided when the return type of `f` is `void`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef T = Void Function(Int8);
- //
- // void f(int i) {}
- //
- // void g() {
- // Pointer.fromFunction<T>(f, [!42!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the exception value:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef T = Void Function(Int8);
- //
- // void f(int i) {}
- //
- // void g() {
- // Pointer.fromFunction<T>(f);
- // }
- // ```
+ /// No parameters.
static const FfiCode INVALID_EXCEPTION_VALUE = FfiCode(
'INVALID_EXCEPTION_VALUE',
"The method 'Pointer.fromFunction' can't have an exceptional return value "
@@ -699,50 +201,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of
- // `Struct` has a type other than `int`, `double`, `Array`, `Pointer`, or
- // subtype of `Struct` or `Union`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `str` has
- // the type `String`, which isn't one of the allowed types for fields in a
- // subclass of `Struct`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // external [!String!] s;
- //
- // @Int32()
- // external int i;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use one of the allowed types for the field:
- //
- // ```dart
- // import 'dart:ffi';
- // import 'package:ffi/ffi.dart';
- //
- // class C extends Struct {
- // external Pointer<Utf8> s;
- //
- // @Int32()
- // external int i;
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the field
static const FfiCode INVALID_FIELD_TYPE_IN_STRUCT = FfiCode(
'INVALID_FIELD_TYPE_IN_STRUCT',
"Fields in struct classes can't have the type '{0}'. They can only be "
@@ -754,60 +214,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of the `isLeaf`
- // argument in an invocation of either `Pointer.asFunction` or
- // `DynamicLibrary.lookupFunction` is `true` and the function that would be
- // returned would have a return type of `Handle`.
- //
- // The analyzer also produces this diagnostic when the value of the `isLeaf`
- // argument in an `FfiNative` annotation is `true` and the type argument on
- // the annotation is a function type whose return type is `Handle`.
- //
- // In all of these cases, leaf calls are only supported for the types `bool`,
- // `int`, `float`, `double`, and, as a return type `void`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `p`
- // returns a `Handle`, but the `isLeaf` argument is `true`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // void f(Pointer<NativeFunction<Handle Function()>> p) {
- // [!p.asFunction<Object Function()>(isLeaf: true)!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the function returns a handle, then remove the `isLeaf` argument:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // void f(Pointer<NativeFunction<Handle Function()>> p) {
- // p.asFunction<Object Function()>();
- // }
- // ```
- //
- // If the function returns one of the supported types, then correct the type
- // information:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // void f(Pointer<NativeFunction<Int32 Function()>> p) {
- // p.asFunction<int Function()>(isLeaf: true);
- // }
- // ```
+ /// No parameters.
static const FfiCode LEAF_CALL_MUST_NOT_RETURN_HANDLE = FfiCode(
'LEAF_CALL_MUST_NOT_RETURN_HANDLE',
"FFI leaf call can't return a 'Handle'.",
@@ -815,54 +222,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of the `isLeaf`
- // argument in an invocation of either `Pointer.asFunction` or
- // `DynamicLibrary.lookupFunction` is `true` and the function that would be
- // returned would have a parameter of type `Handle`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `p` has a
- // parameter of type `Handle`, but the `isLeaf` argument is `true`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // void f(Pointer<NativeFunction<Void Function(Handle)>> p) {
- // [!p.asFunction<void Function(Object)>(isLeaf: true)!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the function has at least one parameter of type `Handle`, then remove
- // the `isLeaf` argument:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // void f(Pointer<NativeFunction<Void Function(Handle)>> p) {
- // p.asFunction<void Function(Object)>();
- // }
- // ```
- //
- // If none of the function's parameters are `Handle`s, then correct the type
- // information:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // void f(Pointer<NativeFunction<Void Function(Int8)>> p) {
- // p.asFunction<void Function(int)>(isLeaf: true);
- // }
- // ```
+ /// No parameters.
static const FfiCode LEAF_CALL_MUST_NOT_TAKE_HANDLE = FfiCode(
'LEAF_CALL_MUST_NOT_TAKE_HANDLE',
"FFI leaf call can't take arguments of type 'Handle'.",
@@ -870,53 +230,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the annotation on a field in a
- // subclass of `Struct` or `Union` doesn't match the Dart type of the field.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the annotation
- // `Double` doesn't match the Dart type `int`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // [!@Double()!]
- // external int x;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the field is correct, then change the annotation to match:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int32()
- // external int x;
- // }
- // ```
- //
- // If the annotation is correct, then change the type of the field to match:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Double()
- // external double x;
- // }
- // ```
+ /// No parameters.
static const FfiCode MISMATCHED_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
'MISMATCHED_ANNOTATION_ON_STRUCT_FIELD',
"The annotation doesn't match the declared type of the field.",
@@ -926,46 +240,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type that is missing a native type annotation
- * 1: the superclass which is extended by this field's class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of
- // `Struct` or `Union` whose type requires an annotation doesn't have one.
- // The Dart types `int`, `double`, and `Array` are used to represent multiple
- // C types, and the annotation specifies which of the compatible C types the
- // field represents.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `x` doesn't
- // have an annotation indicating the underlying width of the integer value:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // external [!int!] x;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add an appropriate annotation to the field:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int64()
- // external int x;
- // }
- // ```
+ /// Parameters:
+ /// 0: the type that is missing a native type annotation
+ /// 1: the superclass which is extended by this field's class
static const FfiCode MISSING_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
'MISSING_ANNOTATION_ON_STRUCT_FIELD',
"Fields of type '{0}' in a subclass of '{1}' must have an annotation "
@@ -974,47 +251,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation of the method
- // `Pointer.fromFunction` doesn't have a second argument (the exceptional
- // return value) when the type to be returned from the invocation is neither
- // `void`, `Handle`, nor `Pointer`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type returned by
- // `f` is expected to be an 8-bit integer but the call to `fromFunction`
- // doesn't include an exceptional return argument:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // int f(int i) => i * 2;
- //
- // void g() {
- // Pointer.[!fromFunction!]<Int8 Function(Int8)>(f);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add an exceptional return type:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // int f(int i) => i * 2;
- //
- // void g() {
- // Pointer.fromFunction<Int8 Function(Int8)>(f, 0);
- // }
- // ```
+ /// No parameters.
static const FfiCode MISSING_EXCEPTION_VALUE = FfiCode(
'MISSING_EXCEPTION_VALUE',
"The method 'Pointer.fromFunction' must have an exceptional return value "
@@ -1024,50 +261,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of
- // `Struct` or `Union` doesn't have a type annotation. Every field must have
- // an explicit type, and the type must either be `int`, `double`, `Pointer`,
- // or a subclass of either `Struct` or `Union`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `str`
- // doesn't have a type annotation:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // external var [!str!];
- //
- // @Int32()
- // external int i;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Explicitly specify the type of the field:
- //
- // ```dart
- // import 'dart:ffi';
- // import 'package:ffi/ffi.dart';
- //
- // class C extends Struct {
- // external Pointer<Utf8> str;
- //
- // @Int32()
- // external int i;
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the field
static const FfiCode MISSING_FIELD_TYPE_IN_STRUCT = FfiCode(
'MISSING_FIELD_TYPE_IN_STRUCT',
"Fields in struct classes must have an explicitly declared type of 'int', "
@@ -1076,42 +271,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field in a subclass of either
- // `Struct` or `Union` has a type of `Array` but doesn't have a single
- // `Array` annotation indicating the dimensions of the array.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `a0` doesn't
- // have an `Array` annotation:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // external [!Array<Uint8>!] a0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Ensure that there's exactly one `Array` annotation on the field:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Array(8)
- // external Array<Uint8> a0;
- // }
- // ```
+ /// No parameters.
static const FfiCode MISSING_SIZE_ANNOTATION_CARRAY = FfiCode(
'MISSING_SIZE_ANNOTATION_CARRAY',
"Fields of type 'Array' must have exactly one 'Array' annotation.",
@@ -1121,52 +281,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type that should be a valid dart:ffi native type.
- * 1: the name of the function whose invocation depends on this relationship
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation of either
- // `Pointer.fromFunction` or `DynamicLibrary.lookupFunction` has a type
- // argument(whether explicit or inferred) that isn't a native function type.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type `T` can be
- // any subclass of `Function` but the type argument for `fromFunction` is
- // required to be a native function type:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // int f(int i) => i * 2;
- //
- // class C<T extends Function> {
- // void g() {
- // Pointer.fromFunction<[!T!]>(f, 0);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use a native function type as the type argument to the invocation:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // int f(int i) => i * 2;
- //
- // class C<T extends Function> {
- // void g() {
- // Pointer.fromFunction<Int32 Function(Int32)>(f, 0);
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the type that should be a valid dart:ffi native type.
+ /// 1: the name of the function whose invocation depends on this relationship
static const FfiCode MUST_BE_A_NATIVE_FUNCTION_TYPE = FfiCode(
'MUST_BE_A_NATIVE_FUNCTION_TYPE',
"The type '{0}' given to '{1}' must be a valid 'dart:ffi' native function "
@@ -1176,70 +293,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type that should be a subtype
- * 1: the supertype that the subtype is compared to
- * 2: the name of the function whose invocation depends on this relationship
- */
- // #### Description
- //
- // The analyzer produces this diagnostic in two cases:
- // - In an invocation of `Pointer.fromFunction` where the type argument
- // (whether explicit or inferred) isn't a supertype of the type of the
- // function passed as the first argument to the method.
- // - In an invocation of `DynamicLibrary.lookupFunction` where the first type
- // argument isn't a supertype of the second type argument.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of the
- // function `f` (`String Function(int)`) isn't a subtype of the type
- // argument `T` (`Int8 Function(Int8)`):
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef T = Int8 Function(Int8);
- //
- // double f(double i) => i;
- //
- // void g() {
- // Pointer.fromFunction<T>([!f!], 5.0);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the function is correct, then change the type argument to match:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef T = Float Function(Float);
- //
- // double f(double i) => i;
- //
- // void g() {
- // Pointer.fromFunction<T>(f, 5.0);
- // }
- // ```
- //
- // If the type argument is correct, then change the function to match:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef T = Int8 Function(Int8);
- //
- // int f(int i) => i;
- //
- // void g() {
- // Pointer.fromFunction<T>(f, 5);
- // }
- // ```
+ /// Parameters:
+ /// 0: the type that should be a subtype
+ /// 1: the supertype that the subtype is compared to
+ /// 2: the name of the function whose invocation depends on this relationship
static const FfiCode MUST_BE_A_SUBTYPE = FfiCode(
'MUST_BE_A_SUBTYPE',
"The type '{0}' must be a subtype of '{1}' for '{2}'.",
@@ -1247,50 +304,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the function, method, or constructor having type arguments
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type arguments to a method
- // are required to be known at compile time, but a type parameter, whose
- // value can't be known at compile time, is used as a type argument.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type argument to
- // `Pointer.asFunction` must be known at compile time, but the type parameter
- // `R`, which isn't known at compile time, is being used as the type
- // argument:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef T = int Function(int);
- //
- // class C<R extends T> {
- // void m(Pointer<NativeFunction<T>> p) {
- // p.asFunction<[!R!]>();
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove any uses of type parameters:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C {
- // void m(Pointer<NativeFunction<Int64 Function(Int64)>> p) {
- // p.asFunction<int Function(int)>();
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the function, method, or constructor having type arguments
static const FfiCode NON_CONSTANT_TYPE_ARGUMENT = FfiCode(
'NON_CONSTANT_TYPE_ARGUMENT',
"The type arguments to '{0}' must be known at compile time, so they can't "
@@ -1299,53 +314,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type that should be a valid dart:ffi native type.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the method `asFunction` is
- // invoked on a pointer to a native function, but the signature of the native
- // function isn't a valid C function signature.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because function signature
- // associated with the pointer `p` (`FNative`) isn't a valid C function
- // signature:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef FNative = int Function(int);
- // typedef F = int Function(int);
- //
- // class C {
- // void f(Pointer<NativeFunction<FNative>> p) {
- // p.asFunction<[!F!]>();
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Make the `NativeFunction` signature a valid C signature:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // typedef FNative = Int8 Function(Int8);
- // typedef F = int Function(int);
- //
- // class C {
- // void f(Pointer<NativeFunction<FNative>> p) {
- // p.asFunction<F>();
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the type that should be a valid dart:ffi native type.
static const FfiCode NON_NATIVE_FUNCTION_TYPE_ARGUMENT_TO_POINTER = FfiCode(
'NON_NATIVE_FUNCTION_TYPE_ARGUMENT_TO_POINTER',
"Can't invoke 'asFunction' because the function signature '{0}' for the "
@@ -1356,42 +326,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a dimension given in an `Array`
- // annotation is less than or equal to zero (`0`).
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because an array dimension of
- // `-1` was provided:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class MyStruct extends Struct {
- // @Array([!-8!])
- // external Array<Uint8> a0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the dimension to be a positive integer:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class MyStruct extends Struct {
- // @Array(8)
- // external Array<Uint8> a0;
- // }
- // ```
+ /// No parameters.
static const FfiCode NON_POSITIVE_ARRAY_DIMENSION = FfiCode(
'NON_POSITIVE_ARRAY_DIMENSION',
"Array dimensions must be positive numbers.",
@@ -1399,45 +334,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type argument for the class
- // `Array` isn't one of the valid types: either a native integer, `Float`,
- // `Double`, `Pointer`, or subtype of `Struct`, `Union`, or
- // `AbiSpecificInteger`.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type argument to
- // `Array` is `Void`, and `Void` isn't one of the valid types:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Array(8)
- // external Array<[!Void!]> a0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the type argument to one of the valid types:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Array(8)
- // external Array<Uint8> a0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the field
static const FfiCode NON_SIZED_TYPE_ARGUMENT = FfiCode(
'NON_SIZED_TYPE_ARGUMENT',
"The type '{1}' isn't a valid type argument for '{0}'. The type argument "
@@ -1449,43 +347,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a subclass of `Struct` has more
- // than one `Packed` annotation.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C`, which
- // is a subclass of `Struct`, has two `Packed` annotations:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // @Packed(1)
- // [!@Packed(1)!]
- // class C extends Struct {
- // external Pointer<Uint8> notEmpty;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove all but one of the annotations:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // @Packed(1)
- // class C extends Struct {
- // external Pointer<Uint8> notEmpty;
- // }
- // ```
+ /// No parameters.
static const FfiCode PACKED_ANNOTATION = FfiCode(
'PACKED_ANNOTATION',
"Structs must have at most one 'Packed' annotation.",
@@ -1493,42 +355,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the argument to the `Packed`
- // annotation isn't one of the allowed values: 1, 2, 4, 8, or 16.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the argument to the
- // `Packed` annotation (`3`) isn't one of the allowed values:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // @Packed([!3!])
- // class C extends Struct {
- // external Pointer<Uint8> notEmpty;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the alignment to be one of the allowed values:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // @Packed(4)
- // class C extends Struct {
- // external Pointer<Uint8> notEmpty;
- // }
- // ```
+ /// No parameters.
static const FfiCode PACKED_ANNOTATION_ALIGNMENT = FfiCode(
'PACKED_ANNOTATION_ALIGNMENT',
"Only packing to 1, 2, 4, 8, and 16 bytes is supported.",
@@ -1537,87 +364,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the outer struct
- * 1: the name of the struct being nested
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a subclass of `Struct` that is
- // annotated as being `Packed` declares a field whose type is also a subclass
- // of `Struct` and the field's type is either not packed or is packed less
- // tightly.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `Outer`,
- // which is a subclass of `Struct` and is packed on 1-byte boundaries,
- // declared a field whose type (`Inner`) is packed on 8-byte boundaries:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // @Packed(8)
- // class Inner extends Struct {
- // external Pointer<Uint8> notEmpty;
- // }
- //
- // @Packed(1)
- // class Outer extends Struct {
- // external Pointer<Uint8> notEmpty;
- //
- // external [!Inner!] nestedLooselyPacked;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the inner struct should be packed more tightly, then change the
- // argument to the inner struct's `Packed` annotation:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // @Packed(1)
- // class Inner extends Struct {
- // external Pointer<Uint8> notEmpty;
- // }
- //
- // @Packed(1)
- // class Outer extends Struct {
- // external Pointer<Uint8> notEmpty;
- //
- // external Inner nestedLooselyPacked;
- // }
- // ```
- //
- // If the outer struct should be packed less tightly, then change the
- // argument to the outer struct's `Packed` annotation:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // @Packed(8)
- // class Inner extends Struct {
- // external Pointer<Uint8> notEmpty;
- // }
- //
- // @Packed(8)
- // class Outer extends Struct {
- // external Pointer<Uint8> notEmpty;
- //
- // external Inner nestedLooselyPacked;
- // }
- // ```
- //
- // If the inner struct doesn't have an annotation and should be packed, then
- // add an annotation.
- //
- // If the inner struct doesn't have an annotation and the outer struct
- // shouldn't be packed, then remove its annotation.
+ /// Parameters:
+ /// 0: the name of the outer struct
+ /// 1: the name of the struct being nested
static const FfiCode PACKED_NESTING_NON_PACKED = FfiCode(
'PACKED_NESTING_NON_PACKED',
"Nesting the non-packed or less tightly packed struct '{0}' in a packed "
@@ -1628,56 +377,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the number of dimensions
- // specified in an `Array` annotation doesn't match the number of nested
- // arrays specified by the type of a field.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `a0` has a
- // type with three nested arrays, but only two dimensions are given in the
- // `Array` annotation:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // [!@Array(8, 8)!]
- // external Array<Array<Array<Uint8>>> a0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the field is correct, then fix the annotation to have the
- // required number of dimensions:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Array(8, 8, 4)
- // external Array<Array<Array<Uint8>>> a0;
- // }
- // ```
- //
- // If the type of the field is wrong, then fix the type of the field:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Array(8, 8)
- // external Array<Array<Uint8>> a0;
- // }
- // ```
+ /// No parameters.
static const FfiCode SIZE_ANNOTATION_DIMENSIONS = FfiCode(
'SIZE_ANNOTATION_DIMENSIONS',
"'Array's must have an 'Array' annotation that matches the dimensions.",
@@ -1685,51 +385,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the class being extended, implemented, or mixed in
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class extends any FFI class
- // other than `Struct` or `Union`, or implements or mixes in any FFI class.
- // `Struct` and `Union` are the only FFI classes that can be subtyped, and
- // then only by extending them.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C` extends
- // `Double`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends [!Double!] {}
- // ```
- //
- // #### Common fixes
- //
- // If the class should extend either `Struct` or `Union`, then change the
- // declaration of the class:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class C extends Struct {
- // @Int32()
- // external int i;
- // }
- // ```
- //
- // If the class shouldn't extend either `Struct` or `Union`, then remove any
- // references to FFI classes:
- //
- // ```dart
- // class C {}
- // ```
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the class being extended, implemented, or mixed in
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_EXTENDS = FfiCode(
'SUBTYPE_OF_FFI_CLASS',
"The class '{0}' can't extend '{1}'.",
@@ -1738,11 +396,9 @@
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_EXTENDS',
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the class being extended, implemented, or mixed in
- */
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the class being extended, implemented, or mixed in
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS = FfiCode(
'SUBTYPE_OF_FFI_CLASS',
"The class '{0}' can't implement '{1}'.",
@@ -1751,11 +407,9 @@
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS',
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the class being extended, implemented, or mixed in
- */
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the class being extended, implemented, or mixed in
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_WITH = FfiCode(
'SUBTYPE_OF_FFI_CLASS',
"The class '{0}' can't mix in '{1}'.",
@@ -1764,55 +418,9 @@
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_WITH',
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the class being extended, implemented, or mixed in
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class extends, implements, or
- // mixes in a class that extends either `Struct` or `Union`. Classes can only
- // extend either `Struct` or `Union` directly.
- //
- // For more information about FFI, see [C interop using dart:ffi][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C` extends
- // `S`, and `S` extends `Struct`:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class S extends Struct {
- // external Pointer f;
- // }
- //
- // class C extends [!S!] {
- // external Pointer g;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you're trying to define a struct or union that shares some fields
- // declared by a different struct or union, then extend `Struct` or `Union`
- // directly and copy the shared fields:
- //
- // ```dart
- // import 'dart:ffi';
- //
- // class S extends Struct {
- // external Pointer f;
- // }
- //
- // class C extends Struct {
- // external Pointer f;
- //
- // external Pointer g;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the class being extended, implemented, or mixed in
static const FfiCode SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS = FfiCode(
'SUBTYPE_OF_STRUCT_CLASS',
"The class '{0}' can't extend '{1}' because '{1}' is a subtype of "
@@ -1823,11 +431,9 @@
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS',
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the class being extended, implemented, or mixed in
- */
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the class being extended, implemented, or mixed in
static const FfiCode SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS = FfiCode(
'SUBTYPE_OF_STRUCT_CLASS',
"The class '{0}' can't implement '{1}' because '{1}' is a subtype of "
@@ -1838,11 +444,9 @@
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS',
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the class being extended, implemented, or mixed in
- */
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the class being extended, implemented, or mixed in
static const FfiCode SUBTYPE_OF_STRUCT_CLASS_IN_WITH = FfiCode(
'SUBTYPE_OF_STRUCT_CLASS',
"The class '{0}' can't mix in '{1}' because '{1}' is a subtype of "
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
index 27a6074..8df0d57 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
@@ -10,68 +10,10 @@
import "package:analyzer/error/error.dart";
import "package:analyzer/src/error/analyzer_error_code.dart";
-// It is hard to visually separate each code's _doc comment_ from its published
-// _documentation comment_ when each is written as an end-of-line comment.
-// ignore_for_file: slash_for_doc_comments
-
class HintCode extends AnalyzerErrorCode {
- /**
- * Parameters:
- * 0: the name of the actual argument type
- * 1: the name of the expected function return type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation of
- // `Future.catchError` has an argument that is a function whose parameters
- // aren't compatible with the arguments that will be passed to the function
- // when it's invoked. The static type of the first argument to `catchError`
- // is just `Function`, even though the function that is passed in is expected
- // to have either a single parameter of type `Object` or two parameters of
- // type `Object` and `StackTrace`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the closure being
- // passed to `catchError` doesn't take any parameters, but the function is
- // required to take at least one parameter:
- //
- // ```dart
- // void f(Future<int> f) {
- // f.catchError([!() => 0!]);
- // }
- // ```
- //
- // The following code produces this diagnostic because the closure being
- // passed to `catchError` takes three parameters, but it can't have more than
- // two required parameters:
- //
- // ```dart
- // void f(Future<int> f) {
- // f.catchError([!(one, two, three) => 0!]);
- // }
- // ```
- //
- // The following code produces this diagnostic because even though the closure
- // being passed to `catchError` takes one parameter, the closure doesn't have
- // a type that is compatible with `Object`:
- //
- // ```dart
- // void f(Future<int> f) {
- // f.catchError([!(String error) => 0!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the function being passed to `catchError` so that it has either one
- // or two required parameters, and the parameters have the required types:
- //
- // ```dart
- // void f(Future<int> f) {
- // f.catchError((Object error) => 0);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the actual argument type
+ /// 1: the name of the expected function return type
static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER =
HintCode(
'ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER',
@@ -80,34 +22,7 @@
hasPublishedDocs: true,
);
- /**
- * Users should not assign values marked `@doNotStore`.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of a function
- // (including methods and getters) that is explicitly or implicitly marked by
- // the `[doNotStore][meta-doNotStore]` annotation is stored in either a field
- // or top-level variable.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of the
- // function `f` is being stored in the top-level variable `x`:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @doNotStore
- // int f() => 1;
- //
- // var x = [!f()!];
- // ```
- //
- // #### Common fixes
- //
- // Replace references to the field or variable with invocations of the
- // function producing the value.
+ /// Users should not assign values marked `@doNotStore`.
static const HintCode ASSIGNMENT_OF_DO_NOT_STORE = HintCode(
'ASSIGNMENT_OF_DO_NOT_STORE',
"'{0}' is marked 'doNotStore' and shouldn't be assigned to a field or "
@@ -116,43 +31,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the declared return type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function can
- // implicitly return `null` by falling off the end. While this is valid Dart
- // code, it's better for the return of `null` to be explicit.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `f`
- // implicitly returns `null`:
- //
- // ```dart
- // String? [!f!]() {}
- // ```
- //
- // #### Common fixes
- //
- // If the return of `null` is intentional, then make it explicit:
- //
- // ```dart
- // String? f() {
- // return null;
- // }
- // ```
- //
- // If the function should return a non-null value along that path, then add
- // the missing return statement:
- //
- // ```dart
- // String? f() {
- // return '';
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the declared return type
static const HintCode BODY_MIGHT_COMPLETE_NORMALLY_NULLABLE = HintCode(
'BODY_MIGHT_COMPLETE_NORMALLY_NULLABLE',
"This function has a nullable return type of '{0}', but ends without "
@@ -162,69 +42,18 @@
"changing the return type to 'void'.",
);
- /**
- * When the target expression uses '?.' operator, it can be `null`, so all the
- * subsequent invocations should also use '?.' operator.
- */
+ /// When the target expression uses '?.' operator, it can be `null`, so all the
+ /// subsequent invocations should also use '?.' operator.
static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = HintCode(
'CAN_BE_NULL_AFTER_NULL_AWARE',
"The receiver uses '?.', so its value can be null.",
correctionMessage: "Replace the '.' with a '?.' in the invocation.",
);
- /**
- * Dead code is code that is never reached, this can happen for instance if a
- * statement follows a return statement.
- *
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when code is found that won't be
- // executed because execution will never reach the code.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the invocation of
- // `print` occurs after the function has returned:
- //
- // ```dart
- // void f() {
- // return;
- // [!print('here');!]
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the code isn't needed, then remove it:
- //
- // ```dart
- // void f() {
- // return;
- // }
- // ```
- //
- // If the code needs to be executed, then either move the code to a place
- // where it will be executed:
- //
- // ```dart
- // void f() {
- // print('here');
- // return;
- // }
- // ```
- //
- // Or, rewrite the code before it, so that it can be reached:
- //
- // ```dart
- // void f({bool skipPrinting = true}) {
- // if (skipPrinting) {
- // return;
- // }
- // print('here');
- // }
- // ```
+ /// Dead code is code that is never reached, this can happen for instance if a
+ /// statement follows a return statement.
+ ///
+ /// No parameters.
static const HintCode DEAD_CODE = HintCode(
'DEAD_CODE',
"Dead code.",
@@ -234,56 +63,10 @@
hasPublishedDocs: true,
);
- /**
- * Dead code is code that is never reached. This case covers cases where the
- * user has catch clauses after `catch (e)` or `on Object catch (e)`.
- *
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `catch` clause is found that
- // can't be executed because it’s after a `catch` clause of the form
- // `catch (e)` or `on Object catch (e)`. The first `catch` clause that matches
- // the thrown object is selected, and both of those forms will match any
- // object, so no `catch` clauses that follow them will be selected.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // void f() {
- // try {
- // } catch (e) {
- // } [!on String {
- // }!]
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the clause should be selectable, then move the clause before the general
- // clause:
- //
- // ```dart
- // void f() {
- // try {
- // } on String {
- // } catch (e) {
- // }
- // }
- // ```
- //
- // If the clause doesn't need to be selectable, then remove it:
- //
- // ```dart
- // void f() {
- // try {
- // } catch (e) {
- // }
- // }
- // ```
+ /// Dead code is code that is never reached. This case covers cases where the
+ /// user has catch clauses after `catch (e)` or `on Object catch (e)`.
+ ///
+ /// No parameters.
static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = HintCode(
'DEAD_CODE_CATCH_FOLLOWING_CATCH',
"Dead code: Catch clauses after a 'catch (e)' or an 'on Object catch (e)' "
@@ -294,60 +77,13 @@
hasPublishedDocs: true,
);
- /**
- * Dead code is code that is never reached. This case covers cases where the
- * user has an on-catch clause such as `on A catch (e)`, where a supertype of
- * `A` was already caught.
- *
- * Parameters:
- * 0: name of the subtype
- * 1: name of the supertype
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `catch` clause is found that
- // can't be executed because it is after a `catch` clause that catches either
- // the same type or a supertype of the clause's type. The first `catch` clause
- // that matches the thrown object is selected, and the earlier clause always
- // matches anything matchable by the highlighted clause, so the highlighted
- // clause will never be selected.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // void f() {
- // try {
- // } on num {
- // } [!on int {
- // }!]
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the clause should be selectable, then move the clause before the general
- // clause:
- //
- // ```dart
- // void f() {
- // try {
- // } on int {
- // } on num {
- // }
- // }
- // ```
- //
- // If the clause doesn't need to be selectable, then remove it:
- //
- // ```dart
- // void f() {
- // try {
- // } on num {
- // }
- // }
- // ```
+ /// Dead code is code that is never reached. This case covers cases where the
+ /// user has an on-catch clause such as `on A catch (e)`, where a supertype of
+ /// `A` was already caught.
+ ///
+ /// Parameters:
+ /// 0: name of the subtype
+ /// 1: name of the supertype
static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = HintCode(
'DEAD_CODE_ON_CATCH_SUBTYPE',
"Dead code: This on-catch block won’t be executed because '{0}' is a "
@@ -358,33 +94,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the class `Function` is used in
- // either the `extends`, `implements`, or `with` clause of a class or mixin.
- // Using the class `Function` in this way has no semantic value, so it's
- // effectively dead code.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `Function` is used as
- // the superclass of `F`:
- //
- // ```dart
- // class F extends [!Function!] {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the class `Function` from whichever clause it's in, and remove the
- // whole clause if `Function` is the only type in the clause:
- //
- // ```dart
- // class F {}
- // ```
+ /// No parameters.
static const HintCode DEPRECATED_EXTENDS_FUNCTION = HintCode(
'DEPRECATED_SUBTYPE_OF_FUNCTION',
"Extending 'Function' is deprecated.",
@@ -393,18 +103,14 @@
uniqueName: 'DEPRECATED_EXTENDS_FUNCTION',
);
- /**
- * Users should not create a class named `Function` anymore.
- */
+ /// Users should not create a class named `Function` anymore.
static const HintCode DEPRECATED_FUNCTION_CLASS_DECLARATION = HintCode(
'DEPRECATED_FUNCTION_CLASS_DECLARATION',
"Declaring a class named 'Function' is deprecated.",
correctionMessage: "Try renaming the class.",
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode DEPRECATED_IMPLEMENTS_FUNCTION = HintCode(
'DEPRECATED_SUBTYPE_OF_FUNCTION',
"Implementing 'Function' has no effect.",
@@ -413,30 +119,8 @@
uniqueName: 'DEPRECATED_IMPLEMENTS_FUNCTION',
);
- /**
- * Parameters:
- * 0: the name of the member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a deprecated library or class
- // member is used in a different package.
- //
- // #### Example
- //
- // If the method `m` in the class `C` is annotated with `@deprecated`, then
- // the following code produces this diagnostic:
- //
- // ```dart
- // void f(C c) {
- // c.[!m!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // The documentation for declarations that are annotated with `@deprecated`
- // should indicate what code to use in place of the deprecated code.
+ /// Parameters:
+ /// 0: the name of the member
static const HintCode DEPRECATED_MEMBER_USE = HintCode(
'DEPRECATED_MEMBER_USE',
"'{0}' is deprecated and shouldn't be used.",
@@ -445,30 +129,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a deprecated library member or
- // class member is used in the same package in which it's declared.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` is deprecated:
- //
- // ```dart
- // @deprecated
- // var x = 0;
- // var y = [!x!];
- // ```
- //
- // #### Common fixes
- //
- // The fix depends on what's been deprecated and what the replacement is. The
- // documentation for deprecated declarations should indicate what code to use
- // in place of the deprecated code.
+ /// Parameters:
+ /// 0: the name of the member
static const HintCode DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE = HintCode(
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',
"'{0}' is deprecated and shouldn't be used.",
@@ -477,11 +139,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the member
- * 1: message details
- */
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: message details
static const HintCode DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE =
HintCode(
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',
@@ -492,11 +152,9 @@
uniqueName: 'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE',
);
- /**
- * Parameters:
- * 0: the name of the member
- * 1: message details
- */
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: message details
static const HintCode DEPRECATED_MEMBER_USE_WITH_MESSAGE = HintCode(
'DEPRECATED_MEMBER_USE',
"'{0}' is deprecated and shouldn't be used. {1}.",
@@ -506,9 +164,7 @@
uniqueName: 'DEPRECATED_MEMBER_USE_WITH_MESSAGE',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode DEPRECATED_MIXIN_FUNCTION = HintCode(
'DEPRECATED_SUBTYPE_OF_FUNCTION',
"Mixing in 'Function' is deprecated.",
@@ -517,57 +173,7 @@
uniqueName: 'DEPRECATED_MIXIN_FUNCTION',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a comment reference (the name
- // of a declaration enclosed in square brackets in a documentation comment)
- // uses the keyword `new` to refer to a constructor. This form is deprecated.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the unnamed
- // constructor is being referenced using `new C`:
- //
- // ```dart
- // /// See [[!new!] C].
- // class C {
- // C();
- // }
- // ```
- //
- // The following code produces this diagnostic because the constructor named
- // `c` is being referenced using `new C.c`:
- //
- // ```dart
- // /// See [[!new!] C.c].
- // class C {
- // C.c();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you're referencing a named constructor, then remove the keyword `new`:
- //
- // ```dart
- // /// See [C.c].
- // class C {
- // C.c();
- // }
- // ```
- //
- // If you're referencing the unnamed constructor, then remove the keyword
- // `new` and append `.new` after the class name:
- //
- // ```dart
- // /// See [C.new].
- // class C {
- // C.c();
- // }
- // ```
+ /// No parameters.
static const HintCode DEPRECATED_NEW_IN_COMMENT_REFERENCE = HintCode(
'DEPRECATED_NEW_IN_COMMENT_REFERENCE',
"Using the 'new' keyword in a comment reference is deprecated.",
@@ -575,9 +181,7 @@
hasPublishedDocs: true,
);
- /**
- * Hint to use the ~/ operator.
- */
+ /// Hint to use the ~/ operator.
static const HintCode DIVISION_OPTIMIZATION = HintCode(
'DIVISION_OPTIMIZATION',
"The operator x ~/ y is more efficient than (x / y).toInt().",
@@ -585,44 +189,7 @@
"Try re-writing the expression to use the '~/' operator.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name occurs multiple times in
- // a `hide` clause. Repeating the name is unnecessary.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `min` is
- // hidden more than once:
- //
- // ```dart
- // import 'dart:math' hide min, [!min!];
- //
- // var x = pi;
- // ```
- //
- // #### Common fixes
- //
- // If the name was mistyped in one or more places, then correct the mistyped
- // names:
- //
- // ```dart
- // import 'dart:math' hide max, min;
- //
- // var x = pi;
- // ```
- //
- // If the name wasn't mistyped, then remove the unnecessary name from the
- // list:
- //
- // ```dart
- // import 'dart:math' hide min;
- //
- // var x = pi;
- // ```
+ /// No parameters.
static const HintCode DUPLICATE_HIDDEN_NAME = HintCode(
'DUPLICATE_HIDDEN_NAME',
"Duplicate hidden name.",
@@ -631,52 +198,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the diagnostic being ignored
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a diagnostic name appears in an
- // `ignore` comment, but the diagnostic is already being ignored, either
- // because it's already included in the same `ignore` comment or because it
- // appears in an `ignore-in-file` comment.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the diagnostic named
- // `unused_local_variable` is already being ignored for the whole file so it
- // doesn't need to be ignored on a specific line:
- //
- // ```dart
- // // ignore_for_file: unused_local_variable
- // void f() {
- // // ignore: [!unused_local_variable!]
- // var x = 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the diagnostic named
- // `unused_local_variable` is being ignored twice on the same line:
- //
- // ```dart
- // void f() {
- // // ignore: unused_local_variable, [!unused_local_variable!]
- // var x = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the ignore comment, or remove the unnecessary diagnostic name if the
- // ignore comment is ignoring more than one diagnostic:
- //
- // ```dart
- // // ignore_for_file: unused_local_variable
- // void f() {
- // var x = 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the diagnostic being ignored
static const HintCode DUPLICATE_IGNORE = HintCode(
'DUPLICATE_IGNORE',
"The diagnostic '{0}' doesn't need to be ignored here because it's already "
@@ -687,37 +210,9 @@
hasPublishedDocs: true,
);
- /**
- * Duplicate imports.
- *
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an import directive is found
- // that is the same as an import before it in the file. The second import
- // doesn’t add value and should be removed.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- // import [!'package:meta/meta.dart'!];
- //
- // @sealed class C {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the unnecessary import:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @sealed class C {}
- // ```
+ /// Duplicate imports.
+ ///
+ /// No parameters.
static const HintCode DUPLICATE_IMPORT = HintCode(
'DUPLICATE_IMPORT',
"Duplicate import.",
@@ -725,44 +220,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name occurs multiple times in
- // a `show` clause. Repeating the name is unnecessary.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `min` is shown
- // more than once:
- //
- // ```dart
- // import 'dart:math' show min, [!min!];
- //
- // var x = min(2, min(0, 1));
- // ```
- //
- // #### Common fixes
- //
- // If the name was mistyped in one or more places, then correct the mistyped
- // names:
- //
- // ```dart
- // import 'dart:math' show max, min;
- //
- // var x = max(2, min(0, 1));
- // ```
- //
- // If the name wasn't mistyped, then remove the unnecessary name from the
- // list:
- //
- // ```dart
- // import 'dart:math' show min;
- //
- // var x = min(2, min(0, 1));
- // ```
+ /// No parameters.
static const HintCode DUPLICATE_SHOWN_NAME = HintCode(
'DUPLICATE_SHOWN_NAME',
"Duplicate shown name.",
@@ -771,49 +229,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an element in a non-constant set
- // is the same as a previous element in the same set. If two elements are the
- // same, then the second value is ignored, which makes having both elements
- // pointless and likely signals a bug.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the element `1` appears
- // twice:
- //
- // ```dart
- // const a = 1;
- // const b = 1;
- // var s = <int>{a, [!b!]};
- // ```
- //
- // #### Common fixes
- //
- // If both elements should be included in the set, then change one of the
- // elements:
- //
- // ```dart
- // const a = 1;
- // const b = 2;
- // var s = <int>{a, b};
- // ```
- //
- // If only one of the elements is needed, then remove the one that isn't
- // needed:
- //
- // ```dart
- // const a = 1;
- // var s = <int>{a};
- // ```
- //
- // Note that literal sets preserve the order of their elements, so the choice
- // of which element to remove might affect the order in which elements are
- // returned by an iterator.
+ /// No parameters.
static const HintCode EQUAL_ELEMENTS_IN_SET = HintCode(
'EQUAL_ELEMENTS_IN_SET',
"Two elements in a set literal shouldn't be equal.",
@@ -821,48 +237,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a key in a non-constant map is
- // the same as a previous key in the same map. If two keys are the same, then
- // the second value overwrites the first value, which makes having both pairs
- // pointless and likely signals a bug.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the keys `a` and `b`
- // have the same value:
- //
- // ```dart
- // const a = 1;
- // const b = 1;
- // var m = <int, String>{a: 'a', [!b!]: 'b'};
- // ```
- //
- // #### Common fixes
- //
- // If both entries should be included in the map, then change one of the keys:
- //
- // ```dart
- // const a = 1;
- // const b = 2;
- // var m = <int, String>{a: 'a', b: 'b'};
- // ```
- //
- // If only one of the entries is needed, then remove the one that isn't
- // needed:
- //
- // ```dart
- // const a = 1;
- // var m = <int, String>{a: 'a'};
- // ```
- //
- // Note that literal maps preserve the order of their entries, so the choice
- // of which entry to remove might affect the order in which the keys and
- // values are returned by an iterator.
+ /// No parameters.
static const HintCode EQUAL_KEYS_IN_MAP = HintCode(
'EQUAL_KEYS_IN_MAP',
"Two keys in a map literal shouldn't be equal.",
@@ -870,13 +245,11 @@
hasPublishedDocs: true,
);
- /**
- * It is a bad practice for a source file in a package "lib" directory
- * hierarchy to traverse outside that directory hierarchy. For example, a
- * source file in the "lib" directory should not contain a directive such as
- * `import '../web/some.dart'` which references a file outside the lib
- * directory.
- */
+ /// It is a bad practice for a source file in a package "lib" directory
+ /// hierarchy to traverse outside that directory hierarchy. For example, a
+ /// source file in the "lib" directory should not contain a directive such as
+ /// `import '../web/some.dart'` which references a file outside the lib
+ /// directory.
static const HintCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE =
HintCode(
'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
@@ -887,13 +260,11 @@
"directory.",
);
- /**
- * It is a bad practice for a source file ouside a package "lib" directory
- * hierarchy to traverse into that directory hierarchy. For example, a source
- * file in the "web" directory should not contain a directive such as
- * `import '../lib/some.dart'` which references a file inside the lib
- * directory.
- */
+ /// It is a bad practice for a source file ouside a package "lib" directory
+ /// hierarchy to traverse into that directory hierarchy. For example, a source
+ /// file in the "web" directory should not contain a directive such as
+ /// `import '../lib/some.dart'` which references a file inside the lib
+ /// directory.
static const HintCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE =
HintCode(
'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE',
@@ -902,80 +273,7 @@
correctionMessage: "Try using a package: URI instead.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library that declares a
- // function named `loadLibrary` is imported using a deferred import. A
- // deferred import introduces an implicit function named `loadLibrary`. This
- // function is used to load the contents of the deferred library, and the
- // implicit function hides the explicit declaration in the deferred library.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // Given a file (`a.dart`) that defines a function named `loadLibrary`:
- //
- // ```dart
- // %uri="lib/a.dart"
- // void loadLibrary(Library library) {}
- //
- // class Library {}
- // ```
- //
- // The following code produces this diagnostic because the implicit
- // declaration of `a.loadLibrary` is hiding the explicit declaration of
- // `loadLibrary` in `a.dart`:
- //
- // ```dart
- // [!import 'a.dart' deferred as a;!]
- //
- // void f() {
- // a.Library();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the imported library isn't required to be deferred, then remove the
- // keyword `deferred`:
- //
- // ```dart
- // import 'a.dart' as a;
- //
- // void f() {
- // a.Library();
- // }
- // ```
- //
- // If the imported library is required to be deferred and you need to
- // reference the imported function, then rename the function in the imported
- // library:
- //
- // ```dart
- // void populateLibrary(Library library) {}
- //
- // class Library {}
- // ```
- //
- // If the imported library is required to be deferred and you don't need to
- // reference the imported function, then add a `hide` clause:
- //
- // ```dart
- // import 'a.dart' deferred as a hide loadLibrary;
- //
- // void f() {
- // a.Library();
- // }
- // ```
- //
- // If type arguments shouldn't be required for the class, then mark the class
- // with the `[optionalTypeArgs][meta-optionalTypeArgs]` annotation (from
- // `package:meta`):
+ /// No parameters.
static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = HintCode(
'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION',
"The imported library defines a top-level function named 'loadLibrary' "
@@ -986,44 +284,9 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- *
- * https://github.com/dart-lang/sdk/issues/44063
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library that is null safe
- // imports a library that isn't null safe.
- //
- // #### Example
- //
- // Given a file named `a.dart` that contains the following:
- //
- // ```dart
- // %uri="lib/a.dart"
- // // @dart = 2.9
- //
- // class A {}
- // ```
- //
- // The following code produces this diagnostic because a library that null
- // safe is importing a library that isn't null safe:
- //
- // ```dart
- // import [!'a.dart'!];
- //
- // A? f() => null;
- // ```
- //
- // #### Common fixes
- //
- // If you can migrate the imported library to be null safe, then migrate it
- // and update or remove the migrated library's language version.
- //
- // If you can't migrate the imported library, then the importing library
- // needs to have a language version that is before 2.12, when null safety was
- // enabled by default.
+ /// No parameters.
+ ///
+ /// https://github.com/dart-lang/sdk/issues/44063
static const HintCode IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE = HintCode(
'IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE',
"The library '{0}' is legacy, and shouldn't be imported into a null safe "
@@ -1032,43 +295,35 @@
hasPublishedDocs: true,
);
- /**
- * When "strict-inference" is enabled, collection literal types must be
- * inferred via the context type, or have type arguments.
- */
+ /// When "strict-inference" is enabled, collection literal types must be
+ /// inferred via the context type, or have type arguments.
static const HintCode INFERENCE_FAILURE_ON_COLLECTION_LITERAL = HintCode(
'INFERENCE_FAILURE_ON_COLLECTION_LITERAL',
"The type argument(s) of '{0}' can't be inferred.",
correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
- /**
- * When "strict-inference" is enabled, types in function invocations must be
- * inferred via the context type, or have type arguments.
- */
+ /// When "strict-inference" is enabled, types in function invocations must be
+ /// inferred via the context type, or have type arguments.
static const HintCode INFERENCE_FAILURE_ON_FUNCTION_INVOCATION = HintCode(
'INFERENCE_FAILURE_ON_FUNCTION_INVOCATION',
"The type argument(s) of the function '{0}' can't be inferred.",
correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
- /**
- * When "strict-inference" is enabled, recursive local functions, top-level
- * functions, methods, and function-typed function parameters must all
- * specify a return type. See the strict-inference resource:
- *
- * https://github.com/dart-lang/language/blob/master/resources/type-system/strict-inference.md
- */
+ /// When "strict-inference" is enabled, recursive local functions, top-level
+ /// functions, methods, and function-typed function parameters must all
+ /// specify a return type. See the strict-inference resource:
+ ///
+ /// https://github.com/dart-lang/language/blob/master/resources/type-system/strict-inference.md
static const HintCode INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE = HintCode(
'INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE',
"The return type of '{0}' cannot be inferred.",
correctionMessage: "Declare the return type of '{0}'.",
);
- /**
- * When "strict-inference" is enabled, types in function invocations must be
- * inferred via the context type, or have type arguments.
- */
+ /// When "strict-inference" is enabled, types in function invocations must be
+ /// inferred via the context type, or have type arguments.
static const HintCode INFERENCE_FAILURE_ON_GENERIC_INVOCATION = HintCode(
'INFERENCE_FAILURE_ON_GENERIC_INVOCATION',
"The type argument(s) of the generic function type '{0}' can't be "
@@ -1076,107 +331,42 @@
correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
- /**
- * When "strict-inference" is enabled, types in instance creation
- * (constructor calls) must be inferred via the context type, or have type
- * arguments.
- */
+ /// When "strict-inference" is enabled, types in instance creation
+ /// (constructor calls) must be inferred via the context type, or have type
+ /// arguments.
static const HintCode INFERENCE_FAILURE_ON_INSTANCE_CREATION = HintCode(
'INFERENCE_FAILURE_ON_INSTANCE_CREATION',
"The type argument(s) of the constructor '{0}' can't be inferred.",
correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
- /**
- * When "strict-inference" in enabled, uninitialized variables must be
- * declared with a specific type.
- */
+ /// When "strict-inference" in enabled, uninitialized variables must be
+ /// declared with a specific type.
static const HintCode INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE = HintCode(
'INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE',
"The type of {0} can't be inferred without either a type or initializer.",
correctionMessage: "Try specifying the type of the variable.",
);
- /**
- * When "strict-inference" in enabled, function parameters must be
- * declared with a specific type, or inherit a type.
- */
+ /// When "strict-inference" in enabled, function parameters must be
+ /// declared with a specific type, or inherit a type.
static const HintCode INFERENCE_FAILURE_ON_UNTYPED_PARAMETER = HintCode(
'INFERENCE_FAILURE_ON_UNTYPED_PARAMETER',
"The type of {0} can't be inferred; a type must be explicitly provided.",
correctionMessage: "Try specifying the type of the parameter.",
);
- /**
- * Parameters:
- * 0: the name of the annotation
- * 1: the list of valid targets
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an annotation is applied to a
- // kind of declaration that it doesn't support.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the `optionalTypeArgs`
- // annotation isn't defined to be valid for top-level variables:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @[!optionalTypeArgs!]
- // int x = 0;
- // ```
- //
- // #### Common fixes
- //
- // Remove the annotation from the declaration.
+ /// Parameters:
+ /// 0: the name of the annotation
+ /// 1: the list of valid targets
static const HintCode INVALID_ANNOTATION_TARGET = HintCode(
'INVALID_ANNOTATION_TARGET',
"The annotation '{0}' can only be used on {1}.",
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the element
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a [public library][] exports a
- // declaration that is marked with the `[internal][meta-internal]`
- // annotation.
- //
- // #### Example
- //
- // Given a file named `a.dart` in the `src` directory that contains:
- //
- // ```dart
- // %uri="lib/src/a.dart"
- // import 'package:meta/meta.dart';
- //
- // @internal class One {}
- // ```
- //
- // The following code, when found in a [public library][] produces this
- // diagnostic because the `export` directive is exporting a name that is only
- // intended to be used internally:
- //
- // ```dart
- // [!export 'src/a.dart';!]
- // ```
- //
- // #### Common fixes
- //
- // If the export is needed, then add a `hide` clause to hide the internal
- // names:
- //
- // ```dart
- // export 'src/a.dart' hide One;
- // ```
- //
- // If the export isn't needed, then remove it.
+ /// Parameters:
+ /// 0: the name of the element
static const HintCode INVALID_EXPORT_OF_INTERNAL_ELEMENT = HintCode(
'INVALID_EXPORT_OF_INTERNAL_ELEMENT',
"The member '{0}' can't be exported as a part of a package's public API.",
@@ -1184,47 +374,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the element
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a [public library][] exports a
- // top-level function with a return type or at least one parameter type that
- // is marked with the `[internal][meta-internal]` annotation.
- //
- // #### Example
- //
- // Given a file named `a.dart` in the `src` directory that contains the
- // following:
- //
- // ```dart
- // %uri="lib/src/a.dart"
- // import 'package:meta/meta.dart';
- //
- // @internal
- // typedef IntFunction = int Function();
- //
- // int f(IntFunction g) => g();
- // ```
- //
- // The following code produces this diagnostic because the function `f` has a
- // parameter of type `IntFunction`, and `IntFunction` is only intended to be
- // used internally:
- //
- // ```dart
- // [!export 'src/a.dart' show f;!]
- // ```
- //
- // #### Common fixes
- //
- // If the function must be public, then make all the types in the function's
- // signature public types.
- //
- // If the function doesn't need to be exported, then stop exporting it,
- // either by removing it from the `show` clause, adding it to the `hide`
- // clause, or by removing the export.
+ /// Parameters:
+ /// 0: the name of the element
static const HintCode INVALID_EXPORT_OF_INTERNAL_ELEMENT_INDIRECTLY =
HintCode(
'INVALID_EXPORT_OF_INTERNAL_ELEMENT_INDIRECTLY',
@@ -1234,172 +385,37 @@
hasPublishedDocs: true,
);
- /**
- * This hint is generated anywhere a @factory annotation is associated with
- * anything other than a method.
- */
+ /// This hint is generated anywhere a @factory annotation is associated with
+ /// anything other than a method.
static const HintCode INVALID_FACTORY_ANNOTATION = HintCode(
'INVALID_FACTORY_ANNOTATION',
"Only methods can be annotated as factories.",
);
- /**
- * Parameters:
- * 0: The name of the method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method that is annotated with
- // the `[factory][meta-factory]` annotation has a return type of `void`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the method `createC`
- // is annotated with the `[factory][meta-factory]` annotation but doesn't
- // return any value:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class Factory {
- // @factory
- // void [!createC!]() {}
- // }
- //
- // class C {}
- // ```
- //
- // #### Common fixes
- //
- // Change the return type to something other than `void`:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class Factory {
- // @factory
- // C createC() => C();
- // }
- //
- // class C {}
- // ```
+ /// Parameters:
+ /// 0: The name of the method
static const HintCode INVALID_FACTORY_METHOD_DECL = HintCode(
'INVALID_FACTORY_METHOD_DECL',
"Factory method '{0}' must have a return type.",
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method that is annotated with
- // the `[factory][meta-factory]` annotation doesn't return a newly allocated
- // object.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the method `createC`
- // returns the value of a field rather than a newly created instance of `C`:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class Factory {
- // C c = C();
- //
- // @factory
- // C [!createC!]() => c;
- // }
- //
- // class C {}
- // ```
- //
- // #### Common fixes
- //
- // Change the method to return a newly created instance of the return type:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class Factory {
- // @factory
- // C createC() => C();
- // }
- //
- // class C {}
- // ```
+ /// Parameters:
+ /// 0: the name of the method
static const HintCode INVALID_FACTORY_METHOD_IMPL = HintCode(
'INVALID_FACTORY_METHOD_IMPL',
"Factory method '{0}' doesn't return a newly allocated object.",
hasPublishedDocs: true,
);
- /**
- * This hint is generated anywhere an @immutable annotation is associated with
- * anything other than a class.
- */
+ /// This hint is generated anywhere an @immutable annotation is associated with
+ /// anything other than a class.
static const HintCode INVALID_IMMUTABLE_ANNOTATION = HintCode(
'INVALID_IMMUTABLE_ANNOTATION',
"Only classes can be annotated as being immutable.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a declaration is annotated with
- // the `[internal][meta-internal]` annotation and that declaration is either
- // in a [public library][] or has a private name.
- //
- // #### Example
- //
- // The following code, when in a [public library][], produces this diagnostic
- // because the `[internal][meta-internal]` annotation can't be applied to
- // declarations in a [public library][]:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // [!@internal!]
- // class C {}
- // ```
- //
- // The following code, whether in a public or internal library, produces this
- // diagnostic because the `[internal][meta-internal]` annotation can't be
- // applied to declarations with private names:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // [!@internal!]
- // class _C {}
- //
- // void f(_C c) {}
- // ```
- //
- // #### Common fixes
- //
- // If the declaration has a private name, then remove the annotation:
- //
- // ```dart
- // class _C {}
- //
- // void f(_C c) {}
- // ```
- //
- // If the declaration has a public name and is intended to be internal to the
- // package, then move the annotated declaration into an internal library (in
- // other words, a library inside the `src` directory).
- //
- // Otherwise, remove the use of the annotation:
- //
- // ```dart
- // class C {}
- // ```
+ /// No parameters.
static const HintCode INVALID_INTERNAL_ANNOTATION = HintCode(
'INVALID_INTERNAL_ANNOTATION',
"Only public elements in a package's private API can be annotated as being "
@@ -1407,34 +423,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a comment that appears to be an
- // attempt to specify a language version override doesn't conform to the
- // requirements for such a comment. For more information, see
- // [Per-library language version selection](https://dart.dev/guides/language/evolution#per-library-language-version-selection).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the word `dart` must
- // be lowercase in such a comment and because there's no equal sign between
- // the word `dart` and the version number:
- //
- // ```dart
- // [!// @Dart 2.9!]
- // ```
- //
- // #### Common fixes
- //
- // If the comment is intended to be a language version override, then change
- // the comment to follow the correct format:
- //
- // ```dart
- // // @dart = 2.9
- // ```
+ /// No parameters.
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override number must begin with '@dart'.",
@@ -1445,9 +434,7 @@
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override comment must be specified with an '=' "
@@ -1478,9 +465,7 @@
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_LOCATION',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_LOWER_CASE = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override comment must be specified with the "
@@ -1492,9 +477,7 @@
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_LOWER_CASE',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override comment must be specified with a "
@@ -1506,9 +489,7 @@
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override number can't be prefixed with a "
@@ -1520,9 +501,7 @@
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_TRAILING_CHARACTERS =
HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
@@ -1535,9 +514,7 @@
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TRAILING_CHARACTERS',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_TWO_SLASHES =
HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
@@ -1550,73 +527,17 @@
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TWO_SLASHES',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the `[literal][[meta-literal]]`
- // annotation is applied to anything other than a const constructor.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the constructor isn't
- // a `const` constructor:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class C {
- // [!@literal!]
- // C();
- // }
- // ```
- //
- // The following code produces this diagnostic because `x` isn't a
- // constructor:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // [!@literal!]
- // var x;
- // ```
- //
- // #### Common fixes
- //
- // If the annotation is on a constructor and the constructor should always be
- // invoked with `const`, when possible, then mark the constructor with the
- // `const` keyword:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class C {
- // @literal
- // const C();
- // }
- // ```
- //
- // If the constructor can't be marked as `const`, then remove the annotation.
- //
- // If the annotation is on anything other than a constructor, then remove the
- // annotation:
- //
- // ```dart
- // var x;
- // ```
+ /// No parameters.
static const HintCode INVALID_LITERAL_ANNOTATION = HintCode(
'INVALID_LITERAL_ANNOTATION',
"Only const constructors can have the `@literal` annotation.",
hasPublishedDocs: true,
);
- /**
- * This hint is generated anywhere where `@nonVirtual` annotates something
- * other than a non-abstract instance member in a class or mixin.
- *
- * No Parameters.
- */
+ /// This hint is generated anywhere where `@nonVirtual` annotates something
+ /// other than a non-abstract instance member in a class or mixin.
+ ///
+ /// No Parameters.
static const HintCode INVALID_NON_VIRTUAL_ANNOTATION = HintCode(
'INVALID_NON_VIRTUAL_ANNOTATION',
"The annotation '@nonVirtual' can only be applied to a concrete instance "
@@ -1624,27 +545,23 @@
correctionMessage: "Try removing @nonVirtual.",
);
- /**
- * This hint is generated anywhere where an instance member annotated with
- * `@nonVirtual` is overridden in a subclass.
- *
- * Parameters:
- * 0: the name of the member
- * 1: the name of the defining class
- */
+ /// This hint is generated anywhere where an instance member annotated with
+ /// `@nonVirtual` is overridden in a subclass.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: the name of the defining class
static const HintCode INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER = HintCode(
'INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER',
"The member '{0}' is declared non-virtual in '{1}' and can't be overridden "
"in subclasses.",
);
- /**
- * This hint is generated anywhere where `@required` annotates a named
- * parameter with a default value.
- *
- * Parameters:
- * 0: the name of the member
- */
+ /// This hint is generated anywhere where `@required` annotates a named
+ /// parameter with a default value.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
static const HintCode INVALID_REQUIRED_NAMED_PARAM = HintCode(
'INVALID_REQUIRED_NAMED_PARAM',
"The type parameter '{0}' is annotated with @required but only named "
@@ -1652,13 +569,11 @@
correctionMessage: "Remove @required.",
);
- /**
- * This hint is generated anywhere where `@required` annotates an optional
- * positional parameter.
- *
- * Parameters:
- * 0: the name of the member
- */
+ /// This hint is generated anywhere where `@required` annotates an optional
+ /// positional parameter.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
static const HintCode INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM = HintCode(
'INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM',
"Incorrect use of the annotation @required on the optional positional "
@@ -1666,13 +581,11 @@
correctionMessage: "Remove @required.",
);
- /**
- * This hint is generated anywhere where `@required` annotates a non optional
- * positional parameter.
- *
- * Parameters:
- * 0: the name of the member
- */
+ /// This hint is generated anywhere where `@required` annotates a non optional
+ /// positional parameter.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
static const HintCode INVALID_REQUIRED_POSITIONAL_PARAM = HintCode(
'INVALID_REQUIRED_POSITIONAL_PARAM',
"Redundant use of the annotation @required on the required positional "
@@ -1680,195 +593,72 @@
correctionMessage: "Remove @required.",
);
- /**
- * This hint is generated anywhere where `@sealed` annotates something other
- * than a class.
- *
- * No parameters.
- */
+ /// This hint is generated anywhere where `@sealed` annotates something other
+ /// than a class.
+ ///
+ /// No parameters.
static const HintCode INVALID_SEALED_ANNOTATION = HintCode(
'INVALID_SEALED_ANNOTATION',
"The annotation '@sealed' can only be applied to classes.",
correctionMessage: "Remove @sealed.",
);
- /**
- * Parameters:
- * 0: the name of the member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a reference to a declaration
- // that is annotated with the `[internal][meta-internal]` annotation is found
- // outside the package containing the declaration.
- //
- // #### Example
- //
- // Given a package `p` that defines a library containing a declaration marked
- // with the `[internal][meta-internal]` annotation:
- //
- // ```dart
- // %uri="package:p/src/p.dart"
- // import 'package:meta/meta.dart';
- //
- // @internal
- // class C {}
- // ```
- //
- // The following code produces this diagnostic because it's referencing the
- // class `C`, which isn't intended to be used outside the package `p`:
- //
- // ```dart
- // import 'package:p/src/p.dart';
- //
- // void f([!C!] c) {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the reference to the internal declaration.
+ /// Parameters:
+ /// 0: the name of the member
static const HintCode INVALID_USE_OF_INTERNAL_MEMBER = HintCode(
'INVALID_USE_OF_INTERNAL_MEMBER',
"The member '{0}' can only be used within its package.",
hasPublishedDocs: true,
);
- /**
- * This hint is generated anywhere where a member annotated with `@protected`
- * is used outside of an instance member of a subclass.
- *
- * Parameters:
- * 0: the name of the member
- * 1: the name of the defining class
- */
+ /// This hint is generated anywhere where a member annotated with `@protected`
+ /// is used outside of an instance member of a subclass.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: the name of the defining class
static const HintCode INVALID_USE_OF_PROTECTED_MEMBER = HintCode(
'INVALID_USE_OF_PROTECTED_MEMBER',
"The member '{0}' can only be used within instance members of subclasses "
"of '{1}'.",
);
- /**
- * Parameters:
- * 0: the name of the member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an instance member that is
- // annotated with `[visibleForOverriding][meta-visibleForOverriding]` is
- // referenced outside the library in which it's declared for any reason other
- // than to override it.
- //
- // #### Example
- //
- // Given a file named `a.dart` containing the following declaration:
- //
- // ```dart
- // %uri="lib/a.dart"
- // import 'package:meta/meta.dart';
- //
- // class A {
- // @visibleForOverriding
- // void a() {}
- // }
- // ```
- //
- // The following code produces this diagnostic because the method `m` is being
- // invoked even though the only reason it's public is to allow it to be
- // overridden:
- //
- // ```dart
- // import 'a.dart';
- //
- // class B extends A {
- // void b() {
- // [!a!]();
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the invalid use of the member.
+ /// Parameters:
+ /// 0: the name of the member
static const HintCode INVALID_USE_OF_VISIBLE_FOR_OVERRIDING_MEMBER = HintCode(
'INVALID_USE_OF_VISIBLE_FOR_OVERRIDING_MEMBER',
"The member '{0}' can only be used for overriding.",
hasPublishedDocs: true,
);
- /**
- * This hint is generated anywhere where a member annotated with
- * `@visibleForTemplate` is used outside of a "template" Dart file.
- *
- * Parameters:
- * 0: the name of the member
- * 1: the name of the defining class
- */
+ /// This hint is generated anywhere where a member annotated with
+ /// `@visibleForTemplate` is used outside of a "template" Dart file.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: the name of the defining class
static const HintCode INVALID_USE_OF_VISIBLE_FOR_TEMPLATE_MEMBER = HintCode(
'INVALID_USE_OF_VISIBLE_FOR_TEMPLATE_MEMBER',
"The member '{0}' can only be used within '{1}' or a template library.",
);
- /**
- * This hint is generated anywhere where a member annotated with
- * `@visibleForTesting` is used outside the defining library, or a test.
- *
- * Parameters:
- * 0: the name of the member
- * 1: the name of the defining class
- */
+ /// This hint is generated anywhere where a member annotated with
+ /// `@visibleForTesting` is used outside the defining library, or a test.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: the name of the defining class
static const HintCode INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER = HintCode(
'INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER',
"The member '{0}' can only be used within '{1}' or a test.",
);
- /**
- * This hint is generated anywhere where a private declaration is annotated
- * with `@visibleForTemplate` or `@visibleForTesting`.
- *
- * Parameters:
- * 0: the name of the member
- * 1: the name of the annotation
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when either the `visibleForTemplate`
- // or `[visibleForTesting][meta-visibleForTesting]` annotation is applied to
- // a non-public declaration.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // [!@visibleForTesting!]
- // void _someFunction() {}
- //
- // void f() => _someFunction();
- // ```
- //
- // #### Common fixes
- //
- // If the declaration doesn't need to be used by test code, then remove the
- // annotation:
- //
- // ```dart
- // void _someFunction() {}
- //
- // void f() => _someFunction();
- // ```
- //
- // If it does, then make it public:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @visibleForTesting
- // void someFunction() {}
- //
- // void f() => someFunction();
- // ```
+ /// This hint is generated anywhere where a private declaration is annotated
+ /// with `@visibleForTemplate` or `@visibleForTesting`.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: the name of the annotation
static const HintCode INVALID_VISIBILITY_ANNOTATION = HintCode(
'INVALID_VISIBILITY_ANNOTATION',
"The member '{0}' is annotated with '{1}', but this annotation is only "
@@ -1876,36 +666,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when anything other than a public
- // instance member of a class is annotated with
- // `[visibleForOverriding][meta-visibleForOverriding]`. Because only public
- // instance members can be overridden outside the defining library, there's
- // no value to annotating any other declarations.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the annotation is on a
- // class, and classes can't be overridden:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // [!@visibleForOverriding!]
- // class C {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the annotation:
- //
- // ```dart
- // class C {}
- // ```
+ /// No parameters.
static const HintCode INVALID_VISIBLE_FOR_OVERRIDING_ANNOTATION = HintCode(
'INVALID_VISIBLE_FOR_OVERRIDING_ANNOTATION',
"The annotation 'visibleForOverriding' can only be applied to a public "
@@ -1913,63 +674,23 @@
hasPublishedDocs: true,
);
- /**
- * Generate a hint for a constructor, function or method invocation where a
- * required parameter is missing.
- *
- * Parameters:
- * 0: the name of the parameter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function with a
- // named parameter that is annotated as being required is invoked without
- // providing a value for the parameter.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the named parameter `x`
- // is required:
- //
- // ```dart
- // %language=2.9
- // import 'package:meta/meta.dart';
- //
- // void f({@required int x}) {}
- //
- // void g() {
- // [!f!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Provide the required value:
- //
- // ```dart
- // %language=2.9
- // import 'package:meta/meta.dart';
- //
- // void f({@required int x}) {}
- //
- // void g() {
- // f(x: 2);
- // }
- // ```
+ /// Generate a hint for a constructor, function or method invocation where a
+ /// required parameter is missing.
+ ///
+ /// Parameters:
+ /// 0: the name of the parameter
static const HintCode MISSING_REQUIRED_PARAM = HintCode(
'MISSING_REQUIRED_PARAM',
"The parameter '{0}' is required.",
hasPublishedDocs: true,
);
- /**
- * Generate a hint for a constructor, function or method invocation where a
- * required parameter is missing.
- *
- * Parameters:
- * 0: the name of the parameter
- * 1: message details
- */
+ /// Generate a hint for a constructor, function or method invocation where a
+ /// required parameter is missing.
+ ///
+ /// Parameters:
+ /// 0: the name of the parameter
+ /// 1: message details
static const HintCode MISSING_REQUIRED_PARAM_WITH_DETAILS = HintCode(
'MISSING_REQUIRED_PARAM',
"The parameter '{0}' is required. {1}.",
@@ -1977,34 +698,8 @@
uniqueName: 'MISSING_REQUIRED_PARAM_WITH_DETAILS',
);
- /**
- * Parameters:
- * 0: the name of the declared return type
- */
- // #### Description
- //
- // Any function or method that doesn't end with either an explicit return or a
- // throw implicitly returns `null`. This is rarely the desired behavior. The
- // analyzer produces this diagnostic when it finds an implicit return.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` doesn't end with a
- // return:
- //
- // ```dart
- // %language=2.9
- // int [!f!](int x) {
- // if (x < 0) {
- // return 0;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add a `return` statement that makes the return value explicit, even if
- // `null` is the appropriate value.
+ /// Parameters:
+ /// 0: the name of the declared return type
static const HintCode MISSING_RETURN = HintCode(
'MISSING_RETURN',
"This function has a return type of '{0}', but doesn't end with a return "
@@ -2014,46 +709,11 @@
hasPublishedDocs: true,
);
- /**
- * This hint is generated anywhere where a `@sealed` class is used as a
- * a superclass constraint of a mixin.
- *
- * Parameters:
- * 0: the name of the sealed class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the superclass constraint of a
- // mixin is a class from a different package that was marked as
- // `[sealed][meta-sealed]`. Classes that are sealed can't be extended,
- // implemented, mixed in, or used as a superclass constraint.
- //
- // #### Example
- //
- // If the package `p` defines a sealed class:
- //
- // ```dart
- // %uri="package:p/p.dart"
- // import 'package:meta/meta.dart';
- //
- // @sealed
- // class C {}
- // ```
- //
- // Then, the following code, when in a package other than `p`, produces this
- // diagnostic:
- //
- // ```dart
- // import 'package:p/p.dart';
- //
- // [!mixin M on C {}!]
- // ```
- //
- // #### Common fixes
- //
- // If the classes that use the mixin don't need to be subclasses of the sealed
- // class, then consider adding a field and delegating to the wrapped instance
- // of the sealed class.
+ /// This hint is generated anywhere where a `@sealed` class is used as a
+ /// a superclass constraint of a mixin.
+ ///
+ /// Parameters:
+ /// 0: the name of the sealed class
static const HintCode MIXIN_ON_SEALED_CLASS = HintCode(
'MIXIN_ON_SEALED_CLASS',
"The class '{0}' shouldn't be used as a mixin constraint because it is "
@@ -2065,60 +725,8 @@
hasPublishedDocs: true,
);
- /**
- * Generate a hint for classes that inherit from classes annotated with
- * `@immutable` but that are not immutable.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an immutable class defines one
- // or more instance fields that aren't final. A class is immutable if it's
- // marked as being immutable using the annotation
- // `[immutable][meta-immutable]` or if it's a subclass of an immutable class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `x` isn't
- // final:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @immutable
- // class [!C!] {
- // int x;
- //
- // C(this.x);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If instances of the class should be immutable, then add the keyword `final`
- // to all non-final field declarations:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @immutable
- // class C {
- // final int x;
- //
- // C(this.x);
- // }
- // ```
- //
- // If the instances of the class should be mutable, then remove the
- // annotation, or choose a different superclass if the annotation is
- // inherited:
- //
- // ```dart
- // class C {
- // int x;
- //
- // C(this.x);
- // }
- // ```
+ /// Generate a hint for classes that inherit from classes annotated with
+ /// `@immutable` but that are not immutable.
static const HintCode MUST_BE_IMMUTABLE = HintCode(
'MUST_BE_IMMUTABLE',
"This class (or a class that this class inherits from) is marked as "
@@ -2127,54 +735,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the class declaring the overridden method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method that overrides a method
- // that is annotated as `[mustCallSuper][meta-mustCallSuper]` doesn't invoke
- // the overridden method as required.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the method `m` in `B`
- // doesn't invoke the overridden method `m` in `A`:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class A {
- // @mustCallSuper
- // m() {}
- // }
- //
- // class B extends A {
- // @override
- // [!m!]() {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add an invocation of the overridden method in the overriding method:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class A {
- // @mustCallSuper
- // m() {}
- // }
- //
- // class B extends A {
- // @override
- // m() {
- // super.m();
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the class declaring the overridden method
static const HintCode MUST_CALL_SUPER = HintCode(
'MUST_CALL_SUPER',
"This method overrides a method annotated as '@mustCallSuper' in '{0}', "
@@ -2182,50 +744,11 @@
hasPublishedDocs: true,
);
- /**
- * Generate a hint for non-const instance creation using a constructor
- * annotated with `@literal`.
- *
- * Parameters:
- * 0: the name of the class defining the annotated constructor
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor that has the
- // `[literal][meta-literal]` annotation is invoked without using the `const`
- // keyword, but all of the arguments to the constructor are constants. The
- // annotation indicates that the constructor should be used to create a
- // constant value whenever possible.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class C {
- // @literal
- // const C();
- // }
- //
- // C f() => [!C()!];
- // ```
- //
- // #### Common fixes
- //
- // Add the keyword `const` before the constructor invocation:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class C {
- // @literal
- // const C();
- // }
- //
- // void f() => const C();
- // ```
+ /// Generate a hint for non-const instance creation using a constructor
+ /// annotated with `@literal`.
+ ///
+ /// Parameters:
+ /// 0: the name of the class defining the annotated constructor
static const HintCode NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR = HintCode(
'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR',
"This instance creation must be 'const', because the {0} constructor is "
@@ -2234,13 +757,11 @@
hasPublishedDocs: true,
);
- /**
- * Generate a hint for non-const instance creation (with the `new` keyword)
- * using a constructor annotated with `@literal`.
- *
- * Parameters:
- * 0: the name of the class defining the annotated constructor
- */
+ /// Generate a hint for non-const instance creation (with the `new` keyword)
+ /// using a constructor annotated with `@literal`.
+ ///
+ /// Parameters:
+ /// 0: the name of the class defining the annotated constructor
static const HintCode NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW =
HintCode(
'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR',
@@ -2251,42 +772,7 @@
uniqueName: 'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type following `on` in a
- // `catch` clause is a nullable type. It isn't valid to specify a nullable
- // type because it isn't possible to catch `null` (because it's a runtime
- // error to throw `null`).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the exception type is
- // specified to allow `null` when `null` can't be thrown:
- //
- // ```dart
- // void f() {
- // try {
- // // ...
- // } on [!FormatException?!] {
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the question mark from the type:
- //
- // ```dart
- // void f() {
- // try {
- // // ...
- // } on FormatException {
- // }
- // }
- // ```
+ /// No parameters.
static const HintCode NULLABLE_TYPE_IN_CATCH_CLAUSE = HintCode(
'NULLABLE_TYPE_IN_CATCH_CLAUSE',
"A potentially nullable type can't be used in an 'on' clause because it "
@@ -2295,40 +781,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the method being invoked
- * 1: the type argument associated with the method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when `null` is passed to either the
- // constructor `Future.value` or the method `Completer.complete` when the type
- // argument used to create the instance was non-nullable. Even though the type
- // system can't express this restriction, passing in a `null` results in a
- // runtime exception.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `null` is being passed
- // to the constructor `Future.value` even though the type argument is the
- // non-nullable type `String`:
- //
- // ```dart
- // Future<String> f() {
- // return Future.value([!null!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Pass in a non-null value:
- //
- // ```dart
- // Future<String> f() {
- // return Future.value('');
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the method being invoked
+ /// 1: the type argument associated with the method
static const HintCode NULL_ARGUMENT_TO_NON_NULL_TYPE = HintCode(
'NULL_ARGUMENT_TO_NON_NULL_TYPE',
"'{0}' shouldn't be called with a null argument for the non-nullable type "
@@ -2337,19 +792,15 @@
hasPublishedDocs: true,
);
- /**
- * When the left operand of a binary expression uses '?.' operator, it can be
- * `null`.
- */
+ /// When the left operand of a binary expression uses '?.' operator, it can be
+ /// `null`.
static const HintCode NULL_AWARE_BEFORE_OPERATOR = HintCode(
'NULL_AWARE_BEFORE_OPERATOR',
"The left operand uses '?.', so its value can be null.",
);
- /**
- * A condition in a control flow statement could evaluate to `null` because it
- * uses the null-aware '?.' operator.
- */
+ /// A condition in a control flow statement could evaluate to `null` because it
+ /// uses the null-aware '?.' operator.
static const HintCode NULL_AWARE_IN_CONDITION = HintCode(
'NULL_AWARE_IN_CONDITION',
"The value of the '?.' operator can be 'null', which isn't appropriate in "
@@ -2359,53 +810,15 @@
"null if necessary.",
);
- /**
- * A condition in operands of a logical operator could evaluate to `null`
- * because it uses the null-aware '?.' operator.
- */
+ /// A condition in operands of a logical operator could evaluate to `null`
+ /// because it uses the null-aware '?.' operator.
static const HintCode NULL_AWARE_IN_LOGICAL_OPERATOR = HintCode(
'NULL_AWARE_IN_LOGICAL_OPERATOR',
"The value of the '?.' operator can be 'null', which isn't appropriate as "
"an operand of a logical operator.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the null check operator (`!`)
- // is used on an expression whose value can only be `null`. In such a case
- // the operator always throws an exception, which likely isn't the intended
- // behavior.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `g` will
- // always return `null`, which means that the null check in `f` will always
- // throw:
- //
- // ```dart
- // void f() {
- // [!g()!!];
- // }
- //
- // Null g() => null;
- // ```
- //
- // #### Common fixes
- //
- // If you intend to always throw an exception, then replace the null check
- // with an explicit `throw` expression to make the intent more clear:
- //
- // ```dart
- // void f() {
- // g();
- // throw TypeError();
- // }
- //
- // Null g() => null;
- // ```
+ /// No parameters.
static const HintCode NULL_CHECK_ALWAYS_FAILS = HintCode(
'NULL_CHECK_ALWAYS_FAILS',
"This null-check will always throw an exception because the expression "
@@ -2413,11 +826,9 @@
hasPublishedDocs: true,
);
- /**
- * A field with the override annotation does not override a getter or setter.
- *
- * No parameters.
- */
+ /// A field with the override annotation does not override a getter or setter.
+ ///
+ /// No parameters.
static const HintCode OVERRIDE_ON_NON_OVERRIDING_FIELD = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The field doesn't override an inherited getter or setter.",
@@ -2428,11 +839,9 @@
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_FIELD',
);
- /**
- * A getter with the override annotation does not override an existing getter.
- *
- * No parameters.
- */
+ /// A getter with the override annotation does not override an existing getter.
+ ///
+ /// No parameters.
static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The getter doesn't override an inherited getter.",
@@ -2443,45 +852,9 @@
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_GETTER',
);
- /**
- * A method with the override annotation does not override an existing method.
- *
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class member is annotated with
- // the `@override` annotation, but the member isn’t declared in any of the
- // supertypes of the class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `m` isn't declared in
- // any of the supertypes of `C`:
- //
- // ```dart
- // class C {
- // @override
- // String [!m!]() => '';
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the member is intended to override a member with a different name, then
- // update the member to have the same name:
- //
- // ```dart
- // class C {
- // @override
- // String toString() => '';
- // }
- // ```
- //
- // If the member is intended to override a member that was removed from the
- // superclass, then consider removing the member from the subclass.
- //
- // If the member can't be removed, then remove the annotation.
+ /// A method with the override annotation does not override an existing method.
+ ///
+ /// No parameters.
static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The method doesn't override an inherited method.",
@@ -2492,11 +865,9 @@
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_METHOD',
);
- /**
- * A setter with the override annotation does not override an existing setter.
- *
- * No parameters.
- */
+ /// A setter with the override annotation does not override an existing setter.
+ ///
+ /// No parameters.
static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The setter doesn't override an inherited setter.",
@@ -2507,31 +878,27 @@
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_SETTER',
);
- /**
- * It is a bad practice for a package import to reference anything outside the
- * given package, or more generally, it is bad practice for a package import
- * to contain a "..". For example, a source file should not contain a
- * directive such as `import 'package:foo/../some.dart'`.
- */
+ /// It is a bad practice for a package import to reference anything outside the
+ /// given package, or more generally, it is bad practice for a package import
+ /// to contain a "..". For example, a source file should not contain a
+ /// directive such as `import 'package:foo/../some.dart'`.
static const HintCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = HintCode(
'PACKAGE_IMPORT_CONTAINS_DOT_DOT',
"A package import shouldn't contain '..'.",
);
- /**
- * It is not an error to call or tear-off a method, setter, or getter, or to
- * read or write a field, on a receiver of static type `Never`.
- * Implementations that provide feedback about dead or unreachable code are
- * encouraged to indicate that any arguments to the invocation are
- * unreachable.
- *
- * It is not an error to apply an expression of type `Never` in the function
- * position of a function call. Implementations that provide feedback about
- * dead or unreachable code are encouraged to indicate that any arguments to
- * the call are unreachable.
- *
- * Parameters: none
- */
+ /// It is not an error to call or tear-off a method, setter, or getter, or to
+ /// read or write a field, on a receiver of static type `Never`.
+ /// Implementations that provide feedback about dead or unreachable code are
+ /// encouraged to indicate that any arguments to the invocation are
+ /// unreachable.
+ ///
+ /// It is not an error to apply an expression of type `Never` in the function
+ /// position of a function call. Implementations that provide feedback about
+ /// dead or unreachable code are encouraged to indicate that any arguments to
+ /// the call are unreachable.
+ ///
+ /// Parameters: none
static const HintCode RECEIVER_OF_TYPE_NEVER = HintCode(
'RECEIVER_OF_TYPE_NEVER',
"The receiver is of type 'Never', and will never complete with a value.",
@@ -2539,57 +906,9 @@
"Try checking for throw expressions or type errors in the receiver",
);
- /**
- * Parameters:
- * 0: the name of the annotated function being invoked
- * 1: the name of the function containing the return
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a value that is annotated with
- // the `[doNotStore][meta-doNotStore]` annotation is returned from a method,
- // getter, or function that doesn't have the same annotation.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the result of invoking
- // `f` shouldn't be stored, but the function `g` isn't annotated to preserve
- // that semantic:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @doNotStore
- // int f() => 0;
- //
- // int g() => [!f()!];
- // ```
- //
- // #### Common fixes
- //
- // If the value that shouldn't be stored is the correct value to return, then
- // mark the function with the `[doNotStore][meta-doNotStore]` annotation:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @doNotStore
- // int f() => 0;
- //
- // @doNotStore
- // int g() => f();
- // ```
- //
- // Otherwise, return a different value from the function:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @doNotStore
- // int f() => 0;
- //
- // int g() => 0;
- // ```
+ /// Parameters:
+ /// 0: the name of the annotated function being invoked
+ /// 1: the name of the function containing the return
static const HintCode RETURN_OF_DO_NOT_STORE = HintCode(
'RETURN_OF_DO_NOT_STORE',
"'{0}' is annotated with 'doNotStore' and shouldn't be returned unless "
@@ -2598,60 +917,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the type of the Future
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation of
- // `Future.catchError` has an argument whose return type isn't compatible with
- // the type returned by the instance of `Future`. At runtime, the method
- // `catchError` attempts to return the value from the callback as the result
- // of the future, which results in another exception being thrown.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `future` is declared to
- // return an `int` while `callback` is declared to return a `String`, and
- // `String` isn't a subtype of `int`:
- //
- // ```dart
- // void f(Future<int> future, String Function(dynamic, StackTrace) callback) {
- // future.catchError([!callback!]);
- // }
- // ```
- //
- // The following code produces this diagnostic because the closure being
- // passed to `catchError` returns an `int` while `future` is declared to
- // return a `String`:
- //
- // ```dart
- // void f(Future<String> future) {
- // future.catchError((error, stackTrace) => [!3!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the instance of `Future` is declared correctly, then change the callback
- // to match:
- //
- // ```dart
- // void f(Future<int> future, int Function(dynamic, StackTrace) callback) {
- // future.catchError(callback);
- // }
- // ```
- //
- // If the declaration of the instance of `Future` is wrong, then change it to
- // match the callback:
- //
- // ```dart
- // void f(Future<String> future, String Function(dynamic, StackTrace) callback) {
- // future.catchError(callback);
- // }
- // ```
+ /// Parameters:
+ /// 0: the return type as declared in the return statement
+ /// 1: the expected return type as defined by the type of the Future
static const HintCode RETURN_OF_INVALID_TYPE_FROM_CATCH_ERROR = HintCode(
'INVALID_RETURN_TYPE_FOR_CATCH_ERROR',
"A value of type '{0}' can't be returned by the 'onError' handler because "
@@ -2660,11 +928,9 @@
uniqueName: 'RETURN_OF_INVALID_TYPE_FROM_CATCH_ERROR',
);
- /**
- * Parameters:
- * 0: the return type of the function
- * 1: the expected return type as defined by the type of the Future
- */
+ /// Parameters:
+ /// 0: the return type of the function
+ /// 1: the expected return type as defined by the type of the Future
static const HintCode RETURN_TYPE_INVALID_FOR_CATCH_ERROR = HintCode(
'INVALID_RETURN_TYPE_FOR_CATCH_ERROR',
"The return type '{0}' isn't assignable to '{1}', as required by "
@@ -2673,53 +939,7 @@
uniqueName: 'RETURN_TYPE_INVALID_FOR_CATCH_ERROR',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when either the class `Future` or
- // `Stream` is referenced in a library that doesn't import `dart:async` in
- // code that has an SDK constraint whose lower bound is less than 2.1.0. In
- // earlier versions, these classes weren't defined in `dart:core`, so the
- // import was necessary.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.1.0:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.0.0 <2.4.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces this
- // diagnostic:
- //
- // ```dart
- // void f([!Future!] f) {}
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the classes to be referenced:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.1.0 <2.4.0'
- // ```
- //
- // If you need to support older versions of the SDK, then import the
- // `dart:async` library.
- //
- // ```dart
- // import 'dart:async';
- //
- // void f(Future f) {}
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_ASYNC_EXPORTED_FROM_CORE = HintCode(
'SDK_VERSION_ASYNC_EXPORTED_FROM_CORE',
"The class '{0}' wasn't exported from 'dart:core' until version 2.1, but "
@@ -2729,54 +949,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an `as` expression inside a
- // [constant context][] is found in code that has an SDK constraint whose
- // lower bound is less than 2.3.2. Using an `as` expression in a
- // [constant context][] wasn't supported in earlier versions, so this code
- // won't be able to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.3.2:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.1.0 <2.4.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces
- // this diagnostic:
- //
- // ```dart
- // const num n = 3;
- // const int i = [!n as int!];
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the expression to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.3.2 <2.4.0'
- // ```
- //
- // If you need to support older versions of the SDK, then either rewrite the
- // code to not use an `as` expression, or change the code so that the `as`
- // expression isn't in a [constant context][]:
- //
- // ```dart
- // num x = 3;
- // int y = x as int;
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT = HintCode(
'SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT',
"The use of an as expression in a constant expression wasn't supported "
@@ -2786,57 +959,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when any use of the `&`, `|`, or `^`
- // operators on the class `bool` inside a [constant context][] is found in
- // code that has an SDK constraint whose lower bound is less than 2.3.2. Using
- // these operators in a [constant context][] wasn't supported in earlier
- // versions, so this code won't be able to run against earlier versions of the
- // SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.3.2:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.1.0 <2.4.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces this
- // diagnostic:
- //
- // ```dart
- // const bool a = true;
- // const bool b = false;
- // const bool c = a [!&!] b;
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the operators to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.3.2 <2.4.0'
- // ```
- //
- // If you need to support older versions of the SDK, then either rewrite the
- // code to not use these operators, or change the code so that the expression
- // isn't in a [constant context][]:
- //
- // ```dart
- // const bool a = true;
- // const bool b = false;
- // bool c = a & b;
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_BOOL_OPERATOR_IN_CONST_CONTEXT = HintCode(
'SDK_VERSION_BOOL_OPERATOR_IN_CONST_CONTEXT',
"The use of the operator '{0}' for 'bool' operands in a constant context "
@@ -2846,57 +969,12 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- *
- * There is also a [ParserError.EXPERIMENT_NOT_ENABLED] code which catches
- * some cases of constructor tearoff features (like `List<int>.filled;`).
- * Other constructor tearoff cases are not realized until resolution
- * (like `List.filled;`).
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor tear-off is found
- // in code that has an SDK constraint whose lower bound is less than 2.15.
- // Constructor tear-offs weren't supported in earlier versions, so this code
- // won't be able to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.15:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.9.0 <2.15.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces this
- // diagnostic:
- //
- // ```dart
- // %language=2.14
- // var setConstructor = [!Set.identity!];
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the operator to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.15.0 <2.16.0'
- // ```
- //
- // If you need to support older versions of the SDK, then rewrite the code to
- // not use constructor tear-offs:
- //
- // ```dart
- // %language=2.14
- // var setConstructor = () => Set.identity();
- // ```
+ /// No parameters.
+ ///
+ /// There is also a [ParserError.EXPERIMENT_NOT_ENABLED] code which catches
+ /// some cases of constructor tearoff features (like `List<int>.filled;`).
+ /// Other constructor tearoff cases are not realized until resolution
+ /// (like `List.filled;`).
static const HintCode SDK_VERSION_CONSTRUCTOR_TEAROFFS = HintCode(
'SDK_VERSION_CONSTRUCTOR_TEAROFFS',
"Tearing off a constructor requires the 'constructor-tearoffs' language "
@@ -2907,60 +985,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the operator `==` is used on a
- // non-primitive type inside a [constant context][] is found in code that has
- // an SDK constraint whose lower bound is less than 2.3.2. Using this operator
- // in a [constant context][] wasn't supported in earlier versions, so this
- // code won't be able to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.3.2:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.1.0 <2.4.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces this
- // diagnostic:
- //
- // ```dart
- // %language=2.9
- // class C {}
- // const C a = null;
- // const C b = null;
- // const bool same = a [!==!] b;
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the operator to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.3.2 <2.4.0'
- // ```
- //
- // If you need to support older versions of the SDK, then either rewrite the
- // code to not use the `==` operator, or change the code so that the
- // expression isn't in a [constant context][]:
- //
- // ```dart
- // %language=2.9
- // class C {}
- // const C a = null;
- // const C b = null;
- // bool same = a == b;
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT = HintCode(
'SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT',
"Using the operator '==' for non-primitive types wasn't supported until "
@@ -2970,59 +995,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension declaration or an
- // extension override is found in code that has an SDK constraint whose lower
- // bound is less than 2.6.0. Using extensions wasn't supported in earlier
- // versions, so this code won't be able to run against earlier versions of the
- // SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.6.0:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.4.0 <2.7.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces
- // this diagnostic:
- //
- // ```dart
- // [!extension!] E on String {
- // void sayHello() {
- // print('Hello $this');
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the syntax to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.6.0 <2.7.0'
- // ```
- //
- // If you need to support older versions of the SDK, then rewrite the code to
- // not make use of extensions. The most common way to do this is to rewrite
- // the members of the extension as top-level functions (or methods) that take
- // the value that would have been bound to `this` as a parameter:
- //
- // ```dart
- // void sayHello(String s) {
- // print('Hello $s');
- // }
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_EXTENSION_METHODS = HintCode(
'SDK_VERSION_EXTENSION_METHODS',
"Extension methods weren't supported until version 2.6.0, but this code is "
@@ -3031,58 +1004,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the operator `>>>` is used in
- // code that has an SDK constraint whose lower bound is less than 2.14.0. This
- // operator wasn't supported in earlier versions, so this code won't be able
- // to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.14.0:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.0.0 <2.15.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces this
- // diagnostic:
- //
- // ```dart
- // int x = 3 [!>>>!] 4;
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the operator to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.14.0 <2.15.0'
- // ```
- //
- // If you need to support older versions of the SDK, then rewrite the code to
- // not use the `>>>` operator:
- //
- // ```dart
- // int x = logicalShiftRight(3, 4);
- //
- // int logicalShiftRight(int leftOperand, int rightOperand) {
- // int divisor = 1 << rightOperand;
- // if (divisor == 0) {
- // return 0;
- // }
- // return leftOperand ~/ divisor;
- // }
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_GT_GT_GT_OPERATOR = HintCode(
'SDK_VERSION_GT_GT_GT_OPERATOR',
"The operator '>>>' wasn't supported until version 2.14.0, but this code "
@@ -3091,55 +1013,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an `is` expression inside a
- // [constant context][] is found in code that has an SDK constraint whose
- // lower bound is less than 2.3.2. Using an `is` expression in a
- // [constant context][] wasn't supported in earlier versions, so this code
- // won't be able to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.3.2:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.1.0 <2.4.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces
- // this diagnostic:
- //
- // ```dart
- // const Object x = 4;
- // const y = [!x is int!] ? 0 : 1;
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the expression to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.3.2 <2.4.0'
- // ```
- //
- // If you need to support older versions of the SDK, then either rewrite the
- // code to not use the `is` operator, or, if that isn't possible, change the
- // code so that the `is` expression isn't in a
- // [constant context][]:
- //
- // ```dart
- // const Object x = 4;
- // var y = x is int ? 0 : 1;
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT = HintCode(
'SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT',
"The use of an is expression in a constant context wasn't supported until "
@@ -3149,51 +1023,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a reference to the class `Never`
- // is found in code that has an SDK constraint whose lower bound is less than
- // 2.12.0. This class wasn't defined in earlier versions, so this code won't
- // be able to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.12.0:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.5.0 <2.6.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces this
- // diagnostic:
- //
- // ```dart
- // %language=2.9
- // [!Never!] n;
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the type to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.12.0 <2.13.0'
- // ```
- //
- // If you need to support older versions of the SDK, then rewrite the code to
- // not reference this class:
- //
- // ```dart
- // dynamic x;
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_NEVER = HintCode(
'SDK_VERSION_NEVER',
"The type 'Never' wasn't supported until version 2.12.0, but this code is "
@@ -3202,50 +1032,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a set literal is found in code
- // that has an SDK constraint whose lower bound is less than 2.2.0. Set
- // literals weren't supported in earlier versions, so this code won't be able
- // to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.2.0:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.1.0 <2.4.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces this
- // diagnostic:
- //
- // ```dart
- // var s = [!<int>{}!];
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the syntax to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.2.0 <2.4.0'
- // ```
- //
- // If you do need to support older versions of the SDK, then replace the set
- // literal with code that creates the set without the use of a literal:
- //
- // ```dart
- // var s = new Set<int>();
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_SET_LITERAL = HintCode(
'SDK_VERSION_SET_LITERAL',
"Set literals weren't supported until version 2.2, but this code is "
@@ -3254,59 +1041,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a for, if, or spread element is
- // found in code that has an SDK constraint whose lower bound is less than
- // 2.3.0. Using a for, if, or spread element wasn't supported in earlier
- // versions, so this code won't be able to run against earlier versions of the
- // SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.3.0:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.2.0 <2.4.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces
- // this diagnostic:
- //
- // ```dart
- // var digits = [[!for (int i = 0; i < 10; i++) i!]];
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the syntax to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.3.0 <2.4.0'
- // ```
- //
- // If you need to support older versions of the SDK, then rewrite the code to
- // not make use of those elements:
- //
- // ```dart
- // var digits = _initializeDigits();
- //
- // List<int> _initializeDigits() {
- // var digits = <int>[];
- // for (int i = 0; i < 10; i++) {
- // digits.add(i);
- // }
- // return digits;
- // }
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_UI_AS_CODE = HintCode(
'SDK_VERSION_UI_AS_CODE',
"The for, if, and spread elements weren't supported until version 2.3.0, "
@@ -3315,61 +1050,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an if or spread element inside
- // a [constant context][] is found in code that has an SDK constraint whose
- // lower bound is less than 2.5.0. Using an if or spread element inside a
- // [constant context][] wasn't supported in earlier versions, so this code
- // won't be able to run against earlier versions of the SDK.
- //
- // #### Example
- //
- // Here's an example of a pubspec that defines an SDK constraint with a lower
- // bound of less than 2.5.0:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // environment:
- // sdk: '>=2.4.0 <2.6.0'
- // ```
- //
- // In the package that has that pubspec, code like the following produces
- // this diagnostic:
- //
- // ```dart
- // const a = [1, 2];
- // const b = [[!...a!]];
- // ```
- //
- // #### Common fixes
- //
- // If you don't need to support older versions of the SDK, then you can
- // increase the SDK constraint to allow the syntax to be used:
- //
- // ```yaml
- // environment:
- // sdk: '>=2.5.0 <2.6.0'
- // ```
- //
- // If you need to support older versions of the SDK, then rewrite the code to
- // not make use of those elements:
- //
- // ```dart
- // const a = [1, 2];
- // const b = [1, 2];
- // ```
- //
- // If that isn't possible, change the code so that the element isn't in a
- // [constant context][]:
- //
- // ```dart
- // const a = [1, 2];
- // var b = [...a];
- // ```
+ /// No parameters.
static const HintCode SDK_VERSION_UI_AS_CODE_IN_CONST_CONTEXT = HintCode(
'SDK_VERSION_UI_AS_CODE_IN_CONST_CONTEXT',
"The if and spread elements weren't supported in constant expressions "
@@ -3379,68 +1060,18 @@
hasPublishedDocs: true,
);
- /**
- * When "strict-raw-types" is enabled, "raw types" must have type arguments.
- *
- * A "raw type" is a type name that does not use inference to fill in missing
- * type arguments; instead, each type argument is instantiated to its bound.
- */
+ /// When "strict-raw-types" is enabled, "raw types" must have type arguments.
+ ///
+ /// A "raw type" is a type name that does not use inference to fill in missing
+ /// type arguments; instead, each type argument is instantiated to its bound.
static const HintCode STRICT_RAW_TYPE = HintCode(
'STRICT_RAW_TYPE',
"The generic type '{0}' should have explicit type arguments but doesn't.",
correctionMessage: "Use explicit type arguments for '{0}'.",
);
- /**
- * Parameters:
- * 0: the name of the sealed class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a sealed class (one that either
- // has the `[sealed][meta-sealed]` annotation or inherits or mixes in a
- // sealed class) is referenced in either the `extends`, `implements`, or
- // `with` clause of a class or mixin declaration if the declaration isn't in
- // the same package as the sealed class.
- //
- // #### Example
- //
- // Given a library in a package other than the package being analyzed that
- // contains the following:
- //
- // ```dart
- // %uri="package:a/a.dart"
- // import 'package:meta/meta.dart';
- //
- // class A {}
- //
- // @sealed
- // class B {}
- // ```
- //
- // The following code produces this diagnostic because `C`, which isn't in the
- // same package as `B`, is extending the sealed class `B`:
- //
- // ```dart
- // import 'package:a/a.dart';
- //
- // [!class C extends B {}!]
- // ```
- //
- // #### Common fixes
- //
- // If the class doesn't need to be a subtype of the sealed class, then change
- // the declaration so that it isn't:
- //
- // ```dart
- // import 'package:a/a.dart';
- //
- // class B extends A {}
- // ```
- //
- // If the class needs to be a subtype of the sealed class, then either change
- // the sealed class so that it's no longer sealed or move the subclass into
- // the same package as the sealed class.
+ /// Parameters:
+ /// 0: the name of the sealed class
static const HintCode SUBTYPE_OF_SEALED_CLASS = HintCode(
'SUBTYPE_OF_SEALED_CLASS',
"The class '{0}' shouldn't be extended, mixed in, or implemented because "
@@ -3451,42 +1082,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the unicode sequence of the code point.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters source that
- // contains text direction Unicode code points. These code points cause
- // source code in either a string literal or a comment to be interpreted
- // and compiled differently than how it appears in editors, leading to
- // possible security vulnerabilities.
- //
- // #### Example
- //
- // The following code produces this diagnostic twice because there are
- // hidden characters at the start and end of the label string:
- //
- // ```dart
- // var label = '[!I!]nteractive text[!'!];
- // ```
- //
- // #### Common fixes
- //
- // If the code points are intended to be included in the string literal,
- // then escape them:
- //
- // ```dart
- // var label = '\u202AInteractive text\u202C';
- // ```
- //
- // If the code points aren't intended to be included in the string literal,
- // then remove them:
- //
- // ```dart
- // var label = 'Interactive text';
- // ```
+ /// Parameters:
+ /// 0: the unicode sequence of the code point.
static const HintCode TEXT_DIRECTION_CODE_POINT_IN_COMMENT = HintCode(
'TEXT_DIRECTION_CODE_POINT_IN_COMMENT',
"The Unicode code point 'U+{0}' changes the appearance of text from how "
@@ -3497,42 +1094,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the unicode sequence of the code point.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters source that
- // contains text direction Unicode code points. These code points cause
- // source code in either a string literal or a comment to be interpreted
- // and compiled differently than how it appears in editors, leading to
- // possible security vulnerabilities.
- //
- // #### Example
- //
- // The following code produces this diagnostic twice because there are
- // hidden characters at the start and end of the label string:
- //
- // ```dart
- // var label = '[!I!]nteractive text[!'!];
- // ```
- //
- // #### Common fixes
- //
- // If the code points are intended to be included in the string literal,
- // then escape them:
- //
- // ```dart
- // var label = '\u202AInteractive text\u202C';
- // ```
- //
- // If the code points aren't intended to be included in the string literal,
- // then remove them:
- //
- // ```dart
- // var label = 'Interactive text';
- // ```
+ /// Parameters:
+ /// 0: the unicode sequence of the code point.
static const HintCode TEXT_DIRECTION_CODE_POINT_IN_LITERAL = HintCode(
'TEXT_DIRECTION_CODE_POINT_IN_LITERAL',
"The Unicode code point 'U+{0}' changes the appearance of text from how "
@@ -3543,54 +1106,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's a type check (using the
- // `as` operator) where the type is `Null`. There's only one value whose type
- // is `Null`, so the code is both more readable and more performant when it
- // tests for `null` explicitly.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the code is testing to
- // see whether the value of `s` is `null` by using a type check:
- //
- // ```dart
- // void f(String? s) {
- // if ([!s is Null!]) {
- // return;
- // }
- // print(s);
- // }
- // ```
- //
- // The following code produces this diagnostic because the code is testing to
- // see whether the value of `s` is something other than `null` by using a type
- // check:
- //
- // ```dart
- // void f(String? s) {
- // if ([!s is! Null!]) {
- // print(s);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the type check with the equivalent comparison with `null`:
- //
- // ```dart
- // void f(String? s) {
- // if (s == null) {
- // return;
- // }
- // print(s);
- // }
- // ```
+ /// No parameters.
static const HintCode TYPE_CHECK_IS_NOT_NULL = HintCode(
'TYPE_CHECK_WITH_NULL',
"Tests for non-null should be done with '!= null'.",
@@ -3599,9 +1115,7 @@
uniqueName: 'TYPE_CHECK_IS_NOT_NULL',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode TYPE_CHECK_IS_NULL = HintCode(
'TYPE_CHECK_WITH_NULL',
"Tests for null should be done with '== null'.",
@@ -3610,37 +1124,9 @@
uniqueName: 'TYPE_CHECK_IS_NULL',
);
- /**
- * Parameters:
- * 0: the name of the library being imported
- * 1: the name in the hide clause that isn't defined in the library
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a hide combinator includes a
- // name that isn't defined by the library being imported.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `dart:math` doesn't
- // define the name `String`:
- //
- // ```dart
- // import 'dart:math' hide [!String!], max;
- //
- // var x = min(0, 1);
- // ```
- //
- // #### Common fixes
- //
- // If a different name should be hidden, then correct the name. Otherwise,
- // remove the name from the list:
- //
- // ```dart
- // import 'dart:math' hide max;
- //
- // var x = min(0, 1);
- // ```
+ /// Parameters:
+ /// 0: the name of the library being imported
+ /// 1: the name in the hide clause that isn't defined in the library
static const HintCode UNDEFINED_HIDDEN_NAME = HintCode(
'UNDEFINED_HIDDEN_NAME',
"The library '{0}' doesn't export a member with the hidden name '{1}'.",
@@ -3648,77 +1134,18 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the undefined parameter
- * 1: the name of the targeted member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an annotation of the form
- // `[UseResult][meta-UseResult].unless(parameterDefined: parameterName)`
- // specifies a parameter name that isn't defined by the annotated function.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `f`
- // doesn't have a parameter named `b`:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @UseResult.unless(parameterDefined: [!'b'!])
- // int f([int? a]) => a ?? 0;
- // ```
- //
- // #### Common fixes
- //
- // Change the argument named `parameterDefined` to match the name of one of
- // the parameters to the function:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // @UseResult.unless(parameterDefined: 'a')
- // int f([int? a]) => a ?? 0;
- // ```
+ /// Parameters:
+ /// 0: the name of the undefined parameter
+ /// 1: the name of the targeted member
static const HintCode UNDEFINED_REFERENCED_PARAMETER = HintCode(
'UNDEFINED_REFERENCED_PARAMETER',
"The parameter '{0}' isn't defined by '{1}'.",
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the library being imported
- * 1: the name in the show clause that isn't defined in the library
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a show combinator includes a
- // name that isn't defined by the library being imported.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `dart:math` doesn't
- // define the name `String`:
- //
- // ```dart
- // import 'dart:math' show min, [!String!];
- //
- // var x = min(0, 1);
- // ```
- //
- // #### Common fixes
- //
- // If a different name should be shown, then correct the name. Otherwise,
- // remove the name from the list:
- //
- // ```dart
- // import 'dart:math' show min;
- //
- // var x = min(0, 1);
- // ```
+ /// Parameters:
+ /// 0: the name of the library being imported
+ /// 1: the name in the show clause that isn't defined in the library
static const HintCode UNDEFINED_SHOWN_NAME = HintCode(
'UNDEFINED_SHOWN_NAME',
"The library '{0}' doesn't export a member with the shown name '{1}'.",
@@ -3726,10 +1153,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the non-diagnostic being ignored
- */
+ /// Parameters:
+ /// 0: the name of the non-diagnostic being ignored
static const HintCode UNIGNORABLE_IGNORE = HintCode(
'UNIGNORABLE_IGNORE',
"The diagnostic '{0}' can't be ignored.",
@@ -3738,38 +1163,7 @@
"this is the only name in the list.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value being cast is already
- // known to be of the type that it's being cast to.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `n` is already known to
- // be an `int` as a result of the `is` test:
- //
- // ```dart
- // void f(num n) {
- // if (n is int) {
- // ([!n as int!]).isEven;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the unnecessary cast:
- //
- // ```dart
- // void f(num n) {
- // if (n is int) {
- // n.isEven;
- // }
- // }
- // ```
+ /// No parameters.
static const HintCode UNNECESSARY_CAST = HintCode(
'UNNECESSARY_CAST',
"Unnecessary cast.",
@@ -3777,9 +1171,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode UNNECESSARY_FINAL = HintCode(
'UNNECESSARY_FINAL',
"The keyword 'final' isn't necessary because the parameter is implicitly "
@@ -3787,10 +1179,8 @@
correctionMessage: "Try removing the 'final'.",
);
- /**
- * Parameters:
- * 0: the name of the diagnostic being ignored
- */
+ /// Parameters:
+ /// 0: the name of the diagnostic being ignored
static const HintCode UNNECESSARY_IGNORE = HintCode(
'UNNECESSARY_IGNORE',
"The diagnostic '{0}' isn't produced at this location so it doesn't need "
@@ -3800,53 +1190,9 @@
"this is the only name in the list.",
);
- /**
- * Parameters:
- * 0: the uri that is not necessary
- * 1: the uri that makes it unnecessary
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an import isn't needed because
- // all of the names that are imported and referenced within the importing
- // library are also visible through another import.
- //
- // #### Example
- //
- // Given a file named `a.dart` that contains the following:
- //
- // ```dart
- // %uri="lib/a.dart"
- // class A {}
- // ```
- //
- // And, given a file named `b.dart` that contains the following:
- //
- // ```dart
- // %uri="lib/b.dart"
- // export 'a.dart';
- //
- // class B {}
- // ```
- //
- // The following code produces this diagnostic because the class `A`, which is
- // imported from `a.dart`, is also imported from `b.dart`. Removing the import
- // of `a.dart` leaves the semantics unchanged:
- //
- // ```dart
- // import [!'a.dart'!];
- // import 'b.dart';
- //
- // void f(A a, B b) {}
- // ```
- //
- // #### Common fixes
- //
- // If the import isn't needed, then remove it.
- //
- // If some of the names imported by this import are intended to be used but
- // aren't yet, and if those names aren't imported by other imports, then add
- // the missing references to those names.
+ /// Parameters:
+ /// 0: the uri that is not necessary
+ /// 1: the uri that makes it unnecessary
static const HintCode UNNECESSARY_IMPORT = HintCode(
'UNNECESSARY_IMPORT',
"The import of '{0}' is unnecessary because all of the used elements are "
@@ -3855,52 +1201,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's a declaration of
- // `noSuchMethod`, the only thing the declaration does is invoke the
- // overridden declaration, and the overridden declaration isn't the
- // declaration in `Object`.
- //
- // Overriding the implementation of `Object`'s `noSuchMethod` (no matter what
- // the implementation does) signals to the analyzer that it shouldn't flag any
- // inherited abstract methods that aren't implemented in that class. This
- // works even if the overriding implementation is inherited from a superclass,
- // so there's no value to declare it again in a subclass.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the declaration of
- // `noSuchMethod` in `A` makes the declaration of `noSuchMethod` in `B`
- // unnecessary:
- //
- // ```dart
- // class A {
- // @override
- // dynamic noSuchMethod(x) => super.noSuchMethod(x);
- // }
- // class B extends A {
- // @override
- // dynamic [!noSuchMethod!](y) {
- // return super.noSuchMethod(y);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the unnecessary declaration:
- //
- // ```dart
- // class A {
- // @override
- // dynamic noSuchMethod(x) => super.noSuchMethod(x);
- // }
- // class B extends A {}
- // ```
+ /// No parameters.
static const HintCode UNNECESSARY_NO_SUCH_METHOD = HintCode(
'UNNECESSARY_NO_SUCH_METHOD',
"Unnecessary 'noSuchMethod' declaration.",
@@ -3908,60 +1209,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds an equality comparison
- // (either `==` or `!=`) with one operand of `null` and the other operand
- // can't be `null`. Such comparisons are always either `true` or `false`, so
- // they serve no purpose.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` can never be
- // `null`, so the comparison always evaluates to `true`:
- //
- // ```dart
- // void f(int x) {
- // if (x [!!= null!]) {
- // print(x);
- // }
- // }
- // ```
- //
- // The following code produces this diagnostic because `x` can never be
- // `null`, so the comparison always evaluates to `false`:
- //
- // ```dart
- // void f(int x) {
- // if (x [!== null!]) {
- // throw ArgumentError("x can't be null");
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the other operand should be able to be `null`, then change the type of
- // the operand:
- //
- // ```dart
- // void f(int? x) {
- // if (x != null) {
- // print(x);
- // }
- // }
- // ```
- //
- // If the other operand really can't be `null`, then remove the condition:
- //
- // ```dart
- // void f(int x) {
- // print(x);
- // }
- // ```
+ /// No parameters.
static const HintCode UNNECESSARY_NULL_COMPARISON_FALSE = HintCode(
'UNNECESSARY_NULL_COMPARISON',
"The operand can't be null, so the condition is always false.",
@@ -3972,9 +1220,7 @@
uniqueName: 'UNNECESSARY_NULL_COMPARISON_FALSE',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode UNNECESSARY_NULL_COMPARISON_TRUE = HintCode(
'UNNECESSARY_NULL_COMPARISON',
"The operand can't be null, so the condition is always true.",
@@ -3983,70 +1229,15 @@
uniqueName: 'UNNECESSARY_NULL_COMPARISON_TRUE',
);
- /**
- * Parameters:
- * 0: the name of the type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when either the type `dynamic` or the
- // type `Null` is followed by a question mark. Both of these types are
- // inherently nullable so the question mark doesn't change the semantics.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the question mark
- // following `dynamic` isn't necessary:
- //
- // ```dart
- // dynamic[!?!] x;
- // ```
- //
- // #### Common fixes
- //
- // Remove the unneeded question mark:
- //
- // ```dart
- // dynamic x;
- // ```
+ /// Parameters:
+ /// 0: the name of the type
static const HintCode UNNECESSARY_QUESTION_MARK = HintCode(
'UNNECESSARY_QUESTION_MARK',
"The '?' is unnecessary because '{0}' is nullable without it.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of a type check (using
- // either `is` or `is!`) is known at compile time.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the test `a is Object?`
- // is always `true`:
- //
- // ```dart
- // bool f<T>(T a) => [!a is Object?!];
- // ```
- //
- // #### Common fixes
- //
- // If the type check doesn't check what you intended to check, then change the
- // test:
- //
- // ```dart
- // bool f<T>(T a) => a is Object;
- // ```
- //
- // If the type check does check what you intended to check, then replace the
- // type check with its known value or completely remove it:
- //
- // ```dart
- // bool f<T>(T a) => true;
- // ```
+ /// No parameters.
static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = HintCode(
'UNNECESSARY_TYPE_CHECK',
"Unnecessary type check; the result is always 'false'.",
@@ -4056,9 +1247,7 @@
uniqueName: 'UNNECESSARY_TYPE_CHECK_FALSE',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = HintCode(
'UNNECESSARY_TYPE_CHECK',
"Unnecessary type check; the result is always 'true'.",
@@ -4068,43 +1257,8 @@
uniqueName: 'UNNECESSARY_TYPE_CHECK_TRUE',
);
- /**
- * Parameters:
- * 0: the name of the exception variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `catch` clause is found, and
- // neither the exception parameter nor the optional stack trace parameter are
- // used in the `catch` block.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `e` isn't referenced:
- //
- // ```dart
- // void f() {
- // try {
- // int.parse(';');
- // } on FormatException catch ([!e!]) {
- // // ignored
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the unused `catch` clause:
- //
- // ```dart
- // void f() {
- // try {
- // int.parse(';');
- // } on FormatException {
- // // ignored
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the exception variable
static const HintCode UNUSED_CATCH_CLAUSE = HintCode(
'UNUSED_CATCH_CLAUSE',
"The exception variable '{0}' isn't used, so the 'catch' clause can be "
@@ -4113,44 +1267,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the stack trace variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the stack trace parameter in a
- // `catch` clause isn't referenced within the body of the `catch` block.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `stackTrace` isn't
- // referenced:
- //
- // ```dart
- // void f() {
- // try {
- // // ...
- // } catch (exception, [!stackTrace!]) {
- // // ...
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you need to reference the stack trace parameter, then add a reference to
- // it. Otherwise, remove it:
- //
- // ```dart
- // void f() {
- // try {
- // // ...
- // } catch (exception) {
- // // ...
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the stack trace variable
static const HintCode UNUSED_CATCH_STACK = HintCode(
'UNUSED_CATCH_STACK',
"The stack trace variable '{0}' isn't used and can be removed.",
@@ -4158,55 +1276,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name that is declared but not referenced
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a private declaration isn't
- // referenced in the library that contains the declaration. The following
- // kinds of declarations are analyzed:
- // - Private top-level declarations, such as classes, enums, mixins, typedefs,
- // top-level variables, and top-level functions
- // - Private static and instance methods
- // - Optional parameters of private functions for which a value is never
- // passed, even when the parameter doesn't have a private name
- //
- // #### Example
- //
- // Assuming that no code in the library references `_C`, the following code
- // produces this diagnostic:
- //
- // ```dart
- // class [!_C!] {}
- // ```
- //
- // Assuming that no code in the library passes a value for `y` in any
- // invocation of `_m`, the following code produces this diagnostic:
- //
- // ```dart
- // %language=2.9
- // class C {
- // void _m(int x, [int [!y!]]) {}
- //
- // void n() => _m(0);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the declaration isn't needed, then remove it:
- //
- // ```dart
- // class C {
- // void _m(int x) {}
- //
- // void n() => _m(0);
- // }
- // ```
- //
- // If the declaration is intended to be used, then add the code to use it.
+ /// Parameters:
+ /// 0: the name that is declared but not referenced
static const HintCode UNUSED_ELEMENT = HintCode(
'UNUSED_ELEMENT',
"The declaration '{0}' isn't referenced.",
@@ -4214,10 +1285,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the parameter that is declared but not used
- */
+ /// Parameters:
+ /// 0: the name of the parameter that is declared but not used
static const HintCode UNUSED_ELEMENT_PARAMETER = HintCode(
'UNUSED_ELEMENT',
"A value for optional parameter '{0}' isn't ever given.",
@@ -4226,40 +1295,8 @@
uniqueName: 'UNUSED_ELEMENT_PARAMETER',
);
- /**
- * Parameters:
- * 0: the name of the unused field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a private field is declared but
- // never read, even if it's written in one or more places.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field
- // `_originalValue` isn't read anywhere in the library:
- //
- // ```dart
- // class C {
- // final String [!_originalValue!];
- // final String _currentValue;
- //
- // C(this._originalValue) : _currentValue = _originalValue;
- //
- // String get value => _currentValue;
- // }
- // ```
- //
- // It might appear that the field `_originalValue` is being read in the
- // initializer (`_currentValue = _originalValue`), but that is actually a
- // reference to the parameter of the same name, not a reference to the field.
- //
- // #### Common fixes
- //
- // If the field isn't needed, then remove it.
- //
- // If the field was intended to be used, then add the missing code.
+ /// Parameters:
+ /// 0: the name of the unused field
static const HintCode UNUSED_FIELD = HintCode(
'UNUSED_FIELD',
"The value of the field '{0}' isn't used.",
@@ -4267,33 +1304,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the content of the unused import's uri
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an import isn't needed because
- // none of the names that are imported are referenced within the importing
- // library.
- //
- // #### Example
- //
- // The following code produces this diagnostic because nothing defined in
- // `dart:async` is referenced in the library:
- //
- // ```dart
- // import [!'dart:async'!];
- //
- // void main() {}
- // ```
- //
- // #### Common fixes
- //
- // If the import isn't needed, then remove it.
- //
- // If some of the imported names are intended to be used, then add the missing
- // code.
+ /// Parameters:
+ /// 0: the content of the unused import's uri
static const HintCode UNUSED_IMPORT = HintCode(
'UNUSED_IMPORT',
"Unused import: '{0}'.",
@@ -4301,51 +1313,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the label that isn't used
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a label that isn't used is
- // found.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the label `loop` isn't
- // referenced anywhere in the method:
- //
- // ```dart
- // void f(int limit) {
- // [!loop:!] for (int i = 0; i < limit; i++) {
- // print(i);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the label isn't needed, then remove it:
- //
- // ```dart
- // void f(int limit) {
- // for (int i = 0; i < limit; i++) {
- // print(i);
- // }
- // }
- // ```
- //
- // If the label is needed, then use it:
- //
- // ```dart
- // void f(int limit) {
- // loop: for (int i = 0; i < limit; i++) {
- // print(i);
- // break loop;
- // }
- // }
- // ```
- // TODO(brianwilkerson) Highlight the identifier without the colon.
+ /// Parameters:
+ /// 0: the label that isn't used
static const HintCode UNUSED_LABEL = HintCode(
'UNUSED_LABEL',
"The label '{0}' isn't used.",
@@ -4355,31 +1324,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the unused variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a local variable is declared but
- // never read, even if it's written in one or more places.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of `count` is
- // never read:
- //
- // ```dart
- // void main() {
- // int [!count!] = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the variable isn't needed, then remove it.
- //
- // If the variable was intended to be used, then add the missing code.
+ /// Parameters:
+ /// 0: the name of the unused variable
static const HintCode UNUSED_LOCAL_VARIABLE = HintCode(
'UNUSED_LOCAL_VARIABLE',
"The value of the local variable '{0}' isn't used.",
@@ -4387,76 +1333,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the annotated method, property or function
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a function annotated with
- // `[useResult][meta-useResult]` is invoked, and the value returned by that
- // function isn't used. The value is considered to be used if a member of the
- // value is invoked, if the value is passed to another function, or if the
- // value is assigned to a variable or field.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the invocation of
- // `c.a()` isn't used, even though the method `a` is annotated with
- // `[useResult][meta-useResult]`:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class C {
- // @useResult
- // int a() => 0;
- //
- // int b() => 0;
- // }
- //
- // void f(C c) {
- // c.[!a!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you intended to invoke the annotated function, then use the value that
- // was returned:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class C {
- // @useResult
- // int a() => 0;
- //
- // int b() => 0;
- // }
- //
- // void f(C c) {
- // print(c.a());
- // }
- // ```
- //
- // If you intended to invoke a different function, then correct the name of
- // the function being invoked:
- //
- // ```dart
- // import 'package:meta/meta.dart';
- //
- // class C {
- // @useResult
- // int a() => 0;
- //
- // int b() => 0;
- // }
- //
- // void f(C c) {
- // c.b();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the annotated method, property or function
static const HintCode UNUSED_RESULT = HintCode(
'UNUSED_RESULT',
"The value of '{0}' should be used.",
@@ -4466,15 +1344,13 @@
hasPublishedDocs: true,
);
- /**
- * The result of invoking a method, property, or function annotated with
- * `@useResult` must be used (assigned, passed to a function as an argument,
- * or returned by a function).
- *
- * Parameters:
- * 0: the name of the annotated method, property or function
- * 1: message details
- */
+ /// The result of invoking a method, property, or function annotated with
+ /// `@useResult` must be used (assigned, passed to a function as an argument,
+ /// or returned by a function).
+ ///
+ /// Parameters:
+ /// 0: the name of the annotated method, property or function
+ /// 1: message details
static const HintCode UNUSED_RESULT_WITH_MESSAGE = HintCode(
'UNUSED_RESULT',
"'{0}' should be used. {1}.",
@@ -4485,36 +1361,8 @@
uniqueName: 'UNUSED_RESULT_WITH_MESSAGE',
);
- /**
- * Parameters:
- * 0: the name that is shown but not used
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a show combinator includes a
- // name that isn't used within the library. Because it isn't referenced, the
- // name can be removed.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `max`
- // isn't used:
- //
- // ```dart
- // import 'dart:math' show min, [!max!];
- //
- // var x = min(0, 1);
- // ```
- //
- // #### Common fixes
- //
- // Either use the name or remove it:
- //
- // ```dart
- // import 'dart:math' show min;
- //
- // var x = min(0, 1);
- // ```
+ /// Parameters:
+ /// 0: the name that is shown but not used
static const HintCode UNUSED_SHOWN_NAME = HintCode(
'UNUSED_SHOWN_NAME',
"The name {0} is shown, but isn’t used.",
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index 41bb550..4834ee8 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -9,10 +9,6 @@
import "package:analyzer/error/error.dart";
-// It is hard to visually separate each code's _doc comment_ from its published
-// _documentation comment_ when each is written as an end-of-line comment.
-// ignore_for_file: slash_for_doc_comments
-
final fastaAnalyzerErrorCodes = <ErrorCode?>[
null,
ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND,
@@ -216,11 +212,9 @@
"An annotation with type arguments must be followed by an argument list.",
);
- /**
- * 16.32 Identifier Reference: It is a compile-time error if any of the
- * identifiers async, await, or yield is used as an identifier in a function
- * body marked with either async, async, or sync.
- */
+ /// 16.32 Identifier Reference: It is a compile-time error if any of the
+ /// identifiers async, await, or yield is used as an identifier in a function
+ /// body marked with either async, async, or sync.
static const ParserErrorCode ASYNC_KEYWORD_USED_AS_IDENTIFIER =
ParserErrorCode(
'ASYNC_KEYWORD_USED_AS_IDENTIFIER',
@@ -377,34 +371,7 @@
correctionMessage: "Try removing the keyword 'covariant'.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a function type associated with
- // a parameter includes optional parameters that have a default value. This
- // isn't allowed because the default values of parameters aren't part of the
- // function's type, and therefore including them doesn't provide any value.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the parameter `p` has a
- // default value even though it's part of the type of the parameter `g`:
- //
- // ```dart
- // void f(void Function([int p [!=!] 0]) g) {
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the default value from the function-type's parameter:
- //
- // ```dart
- // void f(void Function([int p]) g) {
- // }
- // ```
+ /// No parameters.
static const ParserErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE = ParserErrorCode(
'DEFAULT_VALUE_IN_FUNCTION_TYPE',
"Parameters in a function type can't have default values.",
@@ -425,10 +392,8 @@
correctionMessage: "Try moving the directive before any declarations.",
);
- /**
- * Parameters:
- * 0: the modifier that was duplicated
- */
+ /// Parameters:
+ /// 0: the modifier that was duplicated
static const ParserErrorCode DUPLICATED_MODIFIER = ParserErrorCode(
'DUPLICATED_MODIFIER',
"The modifier '{0}' was already specified.",
@@ -441,10 +406,8 @@
correctionMessage: "Try removing all but one 'deferred' keyword.",
);
- /**
- * Parameters:
- * 0: the label that was duplicated
- */
+ /// Parameters:
+ /// 0: the label that was duplicated
static const ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT =
ParserErrorCode(
'DUPLICATE_LABEL_IN_SWITCH_STATEMENT',
@@ -533,10 +496,8 @@
"Expected a string literal.",
);
- /**
- * Parameters:
- * 0: the token that was expected but not found
- */
+ /// Parameters:
+ /// 0: the token that was expected but not found
static const ParserErrorCode EXPECTED_TOKEN = ParserErrorCode(
'EXPECTED_TOKEN',
"Expected to find '{0}'.",
@@ -563,28 +524,7 @@
"Try moving the export directives before the part directives.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an abstract declaration is
- // declared in an extension. Extensions can declare only concrete members.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the method `a` doesn't
- // have a body:
- //
- // ```dart
- // extension E on String {
- // int [!a!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Either provide an implementation for the member or remove it.
+ /// No parameters.
static const ParserErrorCode EXTENSION_DECLARES_ABSTRACT_MEMBER =
ParserErrorCode(
'EXTENSION_DECLARES_ABSTRACT_MEMBER',
@@ -593,30 +533,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor declaration is
- // found in an extension. It isn't valid to define a constructor because
- // extensions aren't classes, and it isn't possible to create an instance of
- // an extension.
- //
- // #### Example
- //
- // The following code produces this diagnostic because there is a constructor
- // declaration in `E`:
- //
- // ```dart
- // extension E on String {
- // [!E!]() : super();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the constructor or replace it with a static method.
+ /// No parameters.
static const ParserErrorCode EXTENSION_DECLARES_CONSTRUCTOR = ParserErrorCode(
'EXTENSION_DECLARES_CONSTRUCTOR',
"Extensions can't declare constructors.",
@@ -624,31 +541,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an instance field declaration is
- // found in an extension. It isn't valid to define an instance field because
- // extensions can only add behavior, not state.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `s` is an instance
- // field:
- //
- // ```dart
- // %language=2.9
- // extension E on String {
- // String [!s!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the field, make it a static field, or convert it to be a getter,
- // setter, or method.
+ /// No parameters.
static const ParserErrorCode EXTENSION_DECLARES_INSTANCE_FIELD =
ParserErrorCode(
'EXTENSION_DECLARES_INSTANCE_FIELD',
@@ -920,10 +813,8 @@
correctionMessage: "Try removing the keyword, or use a for-each statement.",
);
- /**
- * Parameters:
- * 0: the invalid escape sequence
- */
+ /// Parameters:
+ /// 0: the invalid escape sequence
static const ParserErrorCode INVALID_CODE_POINT = ParserErrorCode(
'INVALID_CODE_POINT',
"The escape sequence '{0}' isn't a valid code point.",
@@ -967,22 +858,18 @@
correctionMessage: "Try removing the interpolation expressions.",
);
- /**
- * Parameters:
- * 0: the operator that is invalid
- */
+ /// Parameters:
+ /// 0: the operator that is invalid
static const ParserErrorCode INVALID_OPERATOR = ParserErrorCode(
'INVALID_OPERATOR',
"The string '{0}' isn't a user-definable operator.",
);
- /**
- * Parameters:
- * 0: the operator being applied to 'super'
- *
- * Only generated by the old parser.
- * Replaced by INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER.
- */
+ /// Parameters:
+ /// 0: the operator being applied to 'super'
+ ///
+ /// Only generated by the old parser.
+ /// Replaced by INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER.
static const ParserErrorCode INVALID_OPERATOR_FOR_SUPER = ParserErrorCode(
'INVALID_OPERATOR_FOR_SUPER',
"The operator '{0}' can't be used with 'super'.",
@@ -1048,36 +935,7 @@
"digits or from 1 to 6 digits between '{' and '}'.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a member declared inside an
- // extension uses the keyword `covariant` in the declaration of a parameter.
- // Extensions aren't classes and don't have subclasses, so the keyword serves
- // no purpose.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `i` is marked as being
- // covariant:
- //
- // ```dart
- // extension E on String {
- // void a([!covariant!] int i) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the `covariant` keyword:
- //
- // ```dart
- // extension E on String {
- // void a(int i) {}
- // }
- // ```
+ /// No parameters.
static const ParserErrorCode INVALID_USE_OF_COVARIANT_IN_EXTENSION =
ParserErrorCode(
'INVALID_USE_OF_COVARIANT_IN_EXTENSION',
@@ -1273,10 +1131,8 @@
"Expected a statement.",
);
- /**
- * Parameters:
- * 0: the terminator that is missing
- */
+ /// Parameters:
+ /// 0: the terminator that is missing
static const ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP =
ParserErrorCode(
'MISSING_TERMINATOR_FOR_PARAMETER_GROUP',
@@ -1372,10 +1228,8 @@
correctionMessage: "Try combining all of the groups into a single group.",
);
- /**
- * Parameters:
- * 0: the number of variables being declared
- */
+ /// Parameters:
+ /// 0: the number of variables being declared
static const ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = ParserErrorCode(
'MULTIPLE_VARIABLES_IN_FOR_EACH',
"A single loop variable must be declared in a for-each loop before the "
@@ -1469,10 +1323,8 @@
"Try enclosing the URI in either single or double quotes.",
);
- /**
- * Parameters:
- * 0: the operator that the user is trying to define
- */
+ /// Parameters:
+ /// 0: the operator that the user is trying to define
static const ParserErrorCode NON_USER_DEFINABLE_OPERATOR = ParserErrorCode(
'NON_USER_DEFINABLE_OPERATOR',
"The operator '{0}' isn't user definable.",
@@ -1639,20 +1491,16 @@
correctionMessage: "Try removing the type parameters.",
);
- /**
- * 7.1.1 Operators: Type parameters are not syntactically supported on an
- * operator.
- */
+ /// 7.1.1 Operators: Type parameters are not syntactically supported on an
+ /// operator.
static const ParserErrorCode TYPE_PARAMETER_ON_OPERATOR = ParserErrorCode(
'TYPE_PARAMETER_ON_OPERATOR',
"Types parameters aren't allowed when defining an operator.",
correctionMessage: "Try removing the type parameters.",
);
- /**
- * Parameters:
- * 0: the starting character that was missing
- */
+ /// Parameters:
+ /// 0: the starting character that was missing
static const ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP =
ParserErrorCode(
'UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP',
@@ -1660,10 +1508,8 @@
correctionMessage: "Try inserting the '{0}' at the appropriate location.",
);
- /**
- * Parameters:
- * 0: the unexpected text that was found
- */
+ /// Parameters:
+ /// 0: the unexpected text that was found
static const ParserErrorCode UNEXPECTED_TOKEN = ParserErrorCode(
'UNEXPECTED_TOKEN',
"Unexpected text '{0}'.",
@@ -1733,11 +1579,9 @@
correctionMessage: "Try replacing the ':' with '='.",
);
- /**
- * Parameters:
- * 0: the terminator that was expected
- * 1: the terminator that was found
- */
+ /// Parameters:
+ /// 0: the terminator that was expected
+ /// 1: the terminator that was found
static const ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP =
ParserErrorCode(
'WRONG_TERMINATOR_FOR_PARAMETER_GROUP',
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index a230ed1..6b26d64 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -10,58 +10,8 @@
import "package:analyzer/error/error.dart";
import "package:analyzer/src/error/analyzer_error_code.dart";
-// It is hard to visually separate each code's _doc comment_ from its published
-// _documentation comment_ when each is written as an end-of-line comment.
-// ignore_for_file: slash_for_doc_comments
-
class CompileTimeErrorCode extends AnalyzerErrorCode {
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field that has the `abstract`
- // modifier also has an initializer.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `f` is marked as
- // `abstract` and has an initializer:
- //
- // ```dart
- // abstract class C {
- // abstract int [!f!] = 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because `f` is marked as
- // `abstract` and there's an initializer in the constructor:
- //
- // ```dart
- // abstract class C {
- // abstract int f;
- //
- // C() : [!f!] = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field must be abstract, then remove the initializer:
- //
- // ```dart
- // abstract class C {
- // abstract int f;
- // }
- // ```
- //
- // If the field isn't required to be abstract, then remove the keyword:
- //
- // ```dart
- // abstract class C {
- // int f = 0;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ABSTRACT_FIELD_CONSTRUCTOR_INITIALIZER =
CompileTimeErrorCode(
'ABSTRACT_FIELD_INITIALIZER',
@@ -73,9 +23,7 @@
uniqueName: 'ABSTRACT_FIELD_CONSTRUCTOR_INITIALIZER',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode ABSTRACT_FIELD_INITIALIZER =
CompileTimeErrorCode(
'ABSTRACT_FIELD_INITIALIZER',
@@ -85,37 +33,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the display name for the kind of the found abstract member
- * 1: the name of the member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an inherited member is
- // referenced using `super`, but there is no concrete implementation of the
- // member in the superclass chain. Abstract members can't be invoked.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `B` doesn't inherit a
- // concrete implementation of `a`:
- //
- // ```dart
- // abstract class A {
- // int get a;
- // }
- // class B extends A {
- // int get a => super.[!a!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the invocation of the abstract member, possibly replacing it with an
- // invocation of a concrete member.
- // TODO(brianwilkerson) This either needs to be generalized (use 'member'
- // rather than '{0}') or split into multiple codes.
+ /// Parameters:
+ /// 0: the display name for the kind of the found abstract member
+ /// 1: the name of the member
static const CompileTimeErrorCode ABSTRACT_SUPER_MEMBER_REFERENCE =
CompileTimeErrorCode(
'ABSTRACT_SUPER_MEMBER_REFERENCE',
@@ -123,57 +43,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the ambiguous element
- * 1: the name of the first library in which the type is found
- * 2: the name of the second library in which the type is found
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when two or more export directives
- // cause the same name to be exported from multiple libraries.
- //
- // #### Example
- //
- // Given a file named `a.dart` containing
- //
- // ```dart
- // %uri="lib/a.dart"
- // class C {}
- // ```
- //
- // And a file named `b.dart` containing
- //
- // ```dart
- // %uri="lib/b.dart"
- // class C {}
- // ```
- //
- // The following code produces this diagnostic because the name `C` is being
- // exported from both `a.dart` and `b.dart`:
- //
- // ```dart
- // export 'a.dart';
- // export [!'b.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // If none of the names in one of the libraries needs to be exported, then
- // remove the unnecessary export directives:
- //
- // ```dart
- // export 'a.dart';
- // ```
- //
- // If all of the export directives are needed, then hide the name in all
- // except one of the directives:
- //
- // ```dart
- // export 'a.dart';
- // export 'b.dart' hide C;
- // ```
+ /// Parameters:
+ /// 0: the name of the ambiguous element
+ /// 1: the name of the first library in which the type is found
+ /// 2: the name of the second library in which the type is found
static const CompileTimeErrorCode AMBIGUOUS_EXPORT = CompileTimeErrorCode(
'AMBIGUOUS_EXPORT',
"The name '{0}' is defined in the libraries '{1}' and '{2}'.",
@@ -183,65 +56,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the member
- * 1: the names of the declaring extensions
- */
- // #### Description
- //
- // When code refers to a member of an object (for example, `o.m()` or `o.m` or
- // `o[i]`) where the static type of `o` doesn't declare the member (`m` or
- // `[]`, for example), then the analyzer tries to find the member in an
- // extension. For example, if the member is `m`, then the analyzer looks for
- // extensions that declare a member named `m` and have an extended type that
- // the static type of `o` can be assigned to. When there's more than one such
- // extension in scope, the extension whose extended type is most specific is
- // selected.
- //
- // The analyzer produces this diagnostic when none of the extensions has an
- // extended type that's more specific than the extended types of all of the
- // other extensions, making the reference to the member ambiguous.
- //
- // #### Example
- //
- // The following code produces this diagnostic because there's no way to
- // choose between the member in `E1` and the member in `E2`:
- //
- // ```dart
- // extension E1 on String {
- // int get charCount => 1;
- // }
- //
- // extension E2 on String {
- // int get charCount => 2;
- // }
- //
- // void f(String s) {
- // print(s.[!charCount!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you don't need both extensions, then you can delete or hide one of them.
- //
- // If you need both, then explicitly select the one you want to use by using
- // an extension override:
- //
- // ```dart
- // extension E1 on String {
- // int get charCount => length;
- // }
- //
- // extension E2 on String {
- // int get charCount => length;
- // }
- //
- // void f(String s) {
- // print(E2(s).charCount);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: the names of the declaring extensions
static const CompileTimeErrorCode AMBIGUOUS_EXTENSION_MEMBER_ACCESS =
CompileTimeErrorCode(
'AMBIGUOUS_EXTENSION_MEMBER_ACCESS',
@@ -252,75 +69,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the ambiguous type
- * 1: the name of the first library that the type is found
- * 2: the name of the second library that the type is found
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name is referenced that is
- // declared in two or more imported libraries.
- //
- // #### Example
- //
- // Given a library (`a.dart`) that defines a class (`C` in this example):
- //
- // ```dart
- // %uri="lib/a.dart"
- // class A {}
- // class C {}
- // ```
- //
- // And a library (`b.dart`) that defines a different class with the same name:
- //
- // ```dart
- // %uri="lib/b.dart"
- // class B {}
- // class C {}
- // ```
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // import 'a.dart';
- // import 'b.dart';
- //
- // void f([!C!] c1, [!C!] c2) {}
- // ```
- //
- // #### Common fixes
- //
- // If any of the libraries aren't needed, then remove the import directives
- // for them:
- //
- // ```dart
- // import 'a.dart';
- //
- // void f(C c1, C c2) {}
- // ```
- //
- // If the name is still defined by more than one library, then add a `hide`
- // clause to the import directives for all except one library:
- //
- // ```dart
- // import 'a.dart' hide C;
- // import 'b.dart';
- //
- // void f(C c1, C c2) {}
- // ```
- //
- // If you must be able to reference more than one of these types, then add a
- // prefix to each of the import directives, and qualify the references with
- // the appropriate prefix:
- //
- // ```dart
- // import 'a.dart' as a;
- // import 'b.dart' as b;
- //
- // void f(a.C c1, b.C c2) {}
- // ```
+ /// Parameters:
+ /// 0: the name of the ambiguous type
+ /// 1: the name of the first library that the type is found
+ /// 2: the name of the second library that the type is found
static const CompileTimeErrorCode AMBIGUOUS_IMPORT = CompileTimeErrorCode(
'AMBIGUOUS_IMPORT',
"The name '{0}' is defined in the libraries {1}.",
@@ -330,57 +82,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // Because map and set literals use the same delimiters (`{` and `}`), the
- // analyzer looks at the type arguments and the elements to determine which
- // kind of literal you meant. When there are no type arguments, then the
- // analyzer uses the types of the elements. If all of the elements are literal
- // map entries and all of the spread operators are spreading a `Map` then it's
- // a `Map`. If none of the elements are literal map entries and all of the
- // spread operators are spreading an `Iterable`, then it's a `Set`. If neither
- // of those is true then it's ambiguous.
- //
- // The analyzer produces this diagnostic when at least one element is a
- // literal map entry or a spread operator spreading a `Map`, and at least one
- // element is neither of these, making it impossible for the analyzer to
- // determine whether you are writing a map literal or a set literal.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // union(Map<String, String> a, List<String> b, Map<String, String> c) =>
- // [!{...a, ...b, ...c}!];
- // ```
- //
- // The list `b` can only be spread into a set, and the maps `a` and `c` can
- // only be spread into a map, and the literal can't be both.
- //
- // #### Common fixes
- //
- // There are two common ways to fix this problem. The first is to remove all
- // of the spread elements of one kind or another, so that the elements are
- // consistent. In this case, that likely means removing the list and deciding
- // what to do about the now unused parameter:
- //
- // ```dart
- // union(Map<String, String> a, List<String> b, Map<String, String> c) =>
- // {...a, ...c};
- // ```
- //
- // The second fix is to change the elements of one kind into elements that are
- // consistent with the other elements. For example, you can add the elements
- // of the list as keys that map to themselves:
- //
- // ```dart
- // union(Map<String, String> a, List<String> b, Map<String, String> c) =>
- // {...a, for (String s in b) s: s, ...c};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode AMBIGUOUS_SET_OR_MAP_LITERAL_BOTH =
CompileTimeErrorCode(
'AMBIGUOUS_SET_OR_MAP_LITERAL_BOTH',
@@ -393,77 +95,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // Because map and set literals use the same delimiters (`{` and `}`), the
- // analyzer looks at the type arguments and the elements to determine which
- // kind of literal you meant. When there are no type arguments and all of the
- // elements are spread elements (which are allowed in both kinds of literals)
- // then the analyzer uses the types of the expressions that are being spread.
- // If all of the expressions have the type `Iterable`, then it's a set
- // literal; if they all have the type `Map`, then it's a map literal.
- //
- // This diagnostic is produced when none of the expressions being spread have
- // a type that allows the analyzer to decide whether you were writing a map
- // literal or a set literal.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // union(a, b) => [!{...a, ...b}!];
- // ```
- //
- // The problem occurs because there are no type arguments, and there is no
- // information about the type of either `a` or `b`.
- //
- // #### Common fixes
- //
- // There are three common ways to fix this problem. The first is to add type
- // arguments to the literal. For example, if the literal is intended to be a
- // map literal, you might write something like this:
- //
- // ```dart
- // union(a, b) => <String, String>{...a, ...b};
- // ```
- //
- // The second fix is to add type information so that the expressions have
- // either the type `Iterable` or the type `Map`. You can add an explicit cast
- // or, in this case, add types to the declarations of the two parameters:
- //
- // ```dart
- // union(List<int> a, List<int> b) => {...a, ...b};
- // ```
- //
- // The third fix is to add context information. In this case, that means
- // adding a return type to the function:
- //
- // ```dart
- // Set<String> union(a, b) => {...a, ...b};
- // ```
- //
- // In other cases, you might add a type somewhere else. For example, say the
- // original code looks like this:
- //
- // ```dart
- // union(a, b) {
- // var x = [!{...a, ...b}!];
- // return x;
- // }
- // ```
- //
- // You might add a type annotation on `x`, like this:
- //
- // ```dart
- // union(a, b) {
- // Map<String, String> x = {...a, ...b};
- // return x;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER =
CompileTimeErrorCode(
'AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER',
@@ -475,64 +107,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the actual argument type
- * 1: the name of the expected type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the static type of an argument
- // can't be assigned to the static type of the corresponding parameter.
- //
- // #### Example
- //
- // The following code produces this diagnostic because a `num` can't be
- // assigned to a `String`:
- //
- // ```dart
- // %language=2.9
- // String f(String x) => x;
- // String g(num y) => f([!y!]);
- // ```
- //
- // #### Common fixes
- //
- // If possible, rewrite the code so that the static type is assignable. In the
- // example above you might be able to change the type of the parameter `y`:
- //
- // ```dart
- // %language=2.9
- // String f(String x) => x;
- // String g(String y) => f(y);
- // ```
- //
- // If that fix isn't possible, then add code to handle the case where the
- // argument value isn't the required type. One approach is to coerce other
- // types to the required type:
- //
- // ```dart
- // %language=2.9
- // String f(String x) => x;
- // String g(num y) => f(y.toString());
- // ```
- //
- // Another approach is to add explicit type tests and fallback code:
- //
- // ```dart
- // %language=2.9
- // String f(String x) => x;
- // String g(num y) => f(y is String ? y : '');
- // ```
- //
- // If you believe that the runtime type of the argument will always be the
- // same as the static type of the parameter, and you're willing to risk having
- // an exception thrown at runtime if you're wrong, then add an explicit cast:
- //
- // ```dart
- // String f(String x) => x;
- // String g(num y) => f(y as String);
- // ```
+ /// Parameters:
+ /// 0: the name of the actual argument type
+ /// 1: the name of the expected type
static const CompileTimeErrorCode ARGUMENT_TYPE_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'ARGUMENT_TYPE_NOT_ASSIGNABLE',
@@ -540,51 +117,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a redirecting constructor (a
- // constructor that redirects to another constructor in the same class) has an
- // assert in the initializer list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the unnamed constructor
- // is a redirecting constructor and also has an assert in the initializer
- // list:
- //
- // ```dart
- // class C {
- // C(int x) : [!assert(x > 0)!], this.name();
- // C.name() {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the assert isn't needed, then remove it:
- //
- // ```dart
- // class C {
- // C(int x) : this.name();
- // C.name() {}
- // }
- // ```
- //
- // If the assert is needed, then convert the constructor into a factory
- // constructor:
- //
- // ```dart
- // class C {
- // factory C(int x) {
- // assert(x > 0);
- // return C.name();
- // }
- // C.name() {}
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ASSERT_IN_REDIRECTING_CONSTRUCTOR =
CompileTimeErrorCode(
'ASSERT_IN_REDIRECTING_CONSTRUCTOR',
@@ -592,54 +125,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds an assignment to a
- // top-level variable, a static field, or a local variable that has the
- // `const` modifier. The value of a compile-time constant can't be changed at
- // runtime.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `c` is being assigned a
- // value even though it has the `const` modifier:
- //
- // ```dart
- // const c = 0;
- //
- // void f() {
- // [!c!] = 1;
- // print(c);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the variable must be assignable, then remove the `const` modifier:
- //
- // ```dart
- // var c = 0;
- //
- // void f() {
- // c = 1;
- // print(c);
- // }
- // ```
- //
- // If the constant shouldn't be changed, then either remove the assignment or
- // use a local variable in place of references to the constant:
- //
- // ```dart
- // const c = 0;
- //
- // void f() {
- // var v = 1;
- // print(v);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ASSIGNMENT_TO_CONST = CompileTimeErrorCode(
'ASSIGNMENT_TO_CONST',
"Constant variables can't be assigned a value.",
@@ -649,44 +135,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the final variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds an invocation of a
- // setter, but there's no setter because the field with the same name was
- // declared to be `final` or `const`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `v` is final:
- //
- // ```dart
- // class C {
- // final v = 0;
- // }
- //
- // f(C c) {
- // c.[!v!] = 1;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you need to be able to set the value of the field, then remove the
- // modifier `final` from the field:
- //
- // ```dart
- // class C {
- // int v = 0;
- // }
- //
- // f(C c) {
- // c.v = 1;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the final variable
static const CompileTimeErrorCode ASSIGNMENT_TO_FINAL = CompileTimeErrorCode(
'ASSIGNMENT_TO_FINAL',
"'{0}' can't be used as a setter because it's final.",
@@ -695,39 +145,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a local variable that was
- // declared to be final is assigned after it was initialized.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` is final, so it
- // can't have a value assigned to it after it was initialized:
- //
- // ```dart
- // void f() {
- // final x = 0;
- // [!x!] = 3;
- // print(x);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the keyword `final`, and replace it with `var` if there's no type
- // annotation:
- //
- // ```dart
- // void f() {
- // var x = 0;
- // x = 3;
- // print(x);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ASSIGNMENT_TO_FINAL_LOCAL =
CompileTimeErrorCode(
'ASSIGNMENT_TO_FINAL_LOCAL',
@@ -736,60 +154,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a reference to a setter is
- // found; there is no setter defined for the type; but there is a getter
- // defined with the same name.
- //
- // #### Example
- //
- // The following code produces this diagnostic because there is no setter
- // named `x` in `C`, but there is a getter named `x`:
- //
- // ```dart
- // class C {
- // int get x => 0;
- // set y(int p) {}
- // }
- //
- // void f(C c) {
- // c.[!x!] = 1;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you want to invoke an existing setter, then correct the name:
- //
- // ```dart
- // class C {
- // int get x => 0;
- // set y(int p) {}
- // }
- //
- // void f(C c) {
- // c.y = 1;
- // }
- // ```
- //
- // If you want to invoke the setter but it just doesn't exist yet, then
- // declare it:
- //
- // ```dart
- // class C {
- // int get x => 0;
- // set x(int p) {}
- // set y(int p) {}
- // }
- //
- // void f(C c) {
- // c.x = 1;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ASSIGNMENT_TO_FINAL_NO_SETTER =
CompileTimeErrorCode(
'ASSIGNMENT_TO_FINAL_NO_SETTER',
@@ -800,51 +165,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name of a function appears
- // on the left-hand side of an assignment expression.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the assignment to the
- // function `f` is invalid:
- //
- // ```dart
- // void f() {}
- //
- // void g() {
- // [!f!] = () {};
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the right-hand side should be assigned to something else, such as a
- // local variable, then change the left-hand side:
- //
- // ```dart
- // void f() {}
- //
- // void g() {
- // var x = () {};
- // print(x);
- // }
- // ```
- //
- // If the intent is to change the implementation of the function, then define
- // a function-valued variable instead of a function:
- //
- // ```dart
- // void Function() f = () {};
- //
- // void g() {
- // f = () {};
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ASSIGNMENT_TO_FUNCTION =
CompileTimeErrorCode(
'ASSIGNMENT_TO_FUNCTION',
@@ -852,134 +173,21 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the target of an assignment is a
- // method.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` can't be assigned a
- // value because it's a method:
- //
- // ```dart
- // class C {
- // void f() {}
- //
- // void g() {
- // [!f!] = null;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rewrite the code so that there isn't an assignment to a method.
+ /// No parameters.
static const CompileTimeErrorCode ASSIGNMENT_TO_METHOD = CompileTimeErrorCode(
'ASSIGNMENT_TO_METHOD',
"Methods can't be assigned a value.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name of a type name appears
- // on the left-hand side of an assignment expression.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the assignment to the
- // class `C` is invalid:
- //
- // ```dart
- // class C {}
- //
- // void f() {
- // [!C!] = null;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the right-hand side should be assigned to something else, such as a
- // local variable, then change the left-hand side:
- //
- // ```dart
- // void f() {}
- //
- // void g() {
- // var c = null;
- // print(c);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ASSIGNMENT_TO_TYPE = CompileTimeErrorCode(
'ASSIGNMENT_TO_TYPE',
"Types can't be assigned a value.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an async for-in loop is found in
- // a function or method whose body isn't marked as being either `async` or
- // `async*`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of `f` isn't
- // marked as being either `async` or `async*`, but `f` contains an async
- // for-in loop:
- //
- // ```dart
- // void f(list) {
- // await for (var e [!in!] list) {
- // print(e);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the function should return a `Future`, then mark the body with `async`:
- //
- // ```dart
- // Future<void> f(list) async {
- // await for (var e in list) {
- // print(e);
- // }
- // }
- // ```
- //
- // If the function should return a `Stream` of values, then mark the body with
- // `async*`:
- //
- // ```dart
- // Stream<void> f(list) async* {
- // await for (var e in list) {
- // print(e);
- // }
- // }
- // ```
- //
- // If the function should be synchronous, then remove the `await` before the
- // loop:
- //
- // ```dart
- // void f(list) {
- // for (var e in list) {
- // print(e);
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ASYNC_FOR_IN_WRONG_CONTEXT =
CompileTimeErrorCode(
'ASYNC_FOR_IN_WRONG_CONTEXT',
@@ -990,45 +198,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a local variable that has the
- // `late` modifier uses an `await` expression in the initializer.
- //
- // #### Example
- //
- // The following code produces this diagnostic because an `await` expression
- // is used in the initializer for `v`, a local variable that is marked `late`:
- //
- // ```dart
- // Future<int> f() async {
- // late var v = [!await!] 42;
- // return v;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the initializer can be rewritten to not use `await`, then rewrite it:
- //
- // ```dart
- // Future<int> f() async {
- // late var v = 42;
- // return v;
- // }
- // ```
- //
- // If the initializer can't be rewritten, then remove the `late` modifier:
- //
- // ```dart
- // Future<int> f() async {
- // var v = await 42;
- // return v;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode AWAIT_IN_LATE_LOCAL_VARIABLE_INITIALIZER =
CompileTimeErrorCode(
'AWAIT_IN_LATE_LOCAL_VARIABLE_INITIALIZER',
@@ -1040,11 +210,9 @@
hasPublishedDocs: true,
);
- /**
- * 16.30 Await Expressions: It is a compile-time error if the function
- * immediately enclosing _a_ is not declared asynchronous. (Where _a_ is the
- * await expression.)
- */
+ /// 16.30 Await Expressions: It is a compile-time error if the function
+ /// immediately enclosing _a_ is not declared asynchronous. (Where _a_ is the
+ /// await expression.)
static const CompileTimeErrorCode AWAIT_IN_WRONG_CONTEXT =
CompileTimeErrorCode(
'AWAIT_IN_WRONG_CONTEXT',
@@ -1053,80 +221,7 @@
"Try marking the function body with either 'async' or 'async*'.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function has a
- // return type that's [potentially non-nullable][] but would implicitly return
- // `null` if control reached the end of the function.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the method `m` has an
- // implicit return of `null` inserted at the end of the method, but the method
- // is declared to not return `null`:
- //
- // ```dart
- // class C {
- // int [!m!](int t) {
- // print(t);
- // }
- // }
- // ```
- //
- // The following code produces this diagnostic because the method `m` has an
- // implicit return of `null` inserted at the end of the method, but because
- // the class `C` can be instantiated with a non-nullable type argument, the
- // method is effectively declared to not return `null`:
- //
- // ```dart
- // class C<T> {
- // T [!m!](T t) {
- // print(t);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there's a reasonable value that can be returned, then add a `return`
- // statement at the end of the method:
- //
- // ```dart
- // class C<T> {
- // T m(T t) {
- // print(t);
- // return t;
- // }
- // }
- // ```
- //
- // If the method won't reach the implicit return, then add a `throw` at the
- // end of the method:
- //
- // ```dart
- // class C<T> {
- // T m(T t) {
- // print(t);
- // throw '';
- // }
- // }
- // ```
- //
- // If the method intentionally returns `null` at the end, then add an
- // explicit return of `null` at the end of the method and change the
- // return type so that it's valid to return `null`:
- //
- // ```dart
- // class C<T> {
- // T? m(T t) {
- // print(t);
- // return null;
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode BODY_MIGHT_COMPLETE_NORMALLY =
CompileTimeErrorCode(
'BODY_MIGHT_COMPLETE_NORMALLY',
@@ -1137,59 +232,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a break in a case clause inside
- // a switch statement has a label that is associated with another case clause.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the label `l` is
- // associated with the case clause for `0`:
- //
- // ```dart
- // void f(int i) {
- // switch (i) {
- // l: case 0:
- // break;
- // case 1:
- // break [!l!];
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the intent is to transfer control to the statement after the switch,
- // then remove the label from the break statement:
- //
- // ```dart
- // void f(int i) {
- // switch (i) {
- // case 0:
- // break;
- // case 1:
- // break;
- // }
- // }
- // ```
- //
- // If the intent is to transfer control to a different case block, then use
- // `continue` rather than `break`:
- //
- // ```dart
- // void f(int i) {
- // switch (i) {
- // l: case 0:
- // break;
- // case 1:
- // continue l;
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode BREAK_LABEL_ON_SWITCH_MEMBER =
CompileTimeErrorCode(
'BREAK_LABEL_ON_SWITCH_MEMBER',
@@ -1197,29 +240,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the built-in identifier that is being used
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name used in the declaration
- // of a class, extension, mixin, typedef, type parameter, or import prefix is
- // a built-in identifier. Built-in identifiers can’t be used to name any of
- // these kinds of declarations.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `mixin` is a built-in
- // identifier:
- //
- // ```dart
- // extension [!mixin!] on int {}
- // ```
- //
- // #### Common fixes
- //
- // Choose a different name for the declaration.
+ /// Parameters:
+ /// 0: the built-in identifier that is being used
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME =
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
@@ -1229,10 +251,8 @@
uniqueName: 'BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME',
);
- /**
- * Parameters:
- * 0: the built-in identifier that is being used
- */
+ /// Parameters:
+ /// 0: the built-in identifier that is being used
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_PREFIX_NAME =
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
@@ -1242,31 +262,8 @@
uniqueName: 'BUILT_IN_IDENTIFIER_AS_PREFIX_NAME',
);
- /**
- * Parameters:
- * 0: the built-in identifier that is being used
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a built-in identifier is used
- // where a type name is expected.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `import` can't be used
- // as a type because it's a built-in identifier:
- //
- // ```dart
- // [!import!]<int> x;
- // ```
- //
- // #### Common fixes
- //
- // Replace the built-in identifier with the name of a valid type:
- //
- // ```dart
- // List<int> x;
- // ```
+ /// Parameters:
+ /// 0: the built-in identifier that is being used
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE =
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_AS_TYPE',
@@ -1275,10 +272,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the built-in identifier that is being used
- */
+ /// Parameters:
+ /// 0: the built-in identifier that is being used
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME =
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
@@ -1288,10 +283,8 @@
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME',
);
- /**
- * Parameters:
- * 0: the built-in identifier that is being used
- */
+ /// Parameters:
+ /// 0: the built-in identifier that is being used
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME =
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
@@ -1301,10 +294,8 @@
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_NAME',
);
- /**
- * Parameters:
- * 0: the built-in identifier that is being used
- */
+ /// Parameters:
+ /// 0: the built-in identifier that is being used
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME =
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
@@ -1314,48 +305,7 @@
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the last statement in a `case`
- // block isn't one of the required terminators: `break`, `continue`,
- // `rethrow`, `return`, or `throw`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the `case` block ends
- // with an assignment:
- //
- // ```dart
- // %language=2.9
- // void f(int x) {
- // switch (x) {
- // [!case!] 0:
- // x += 2;
- // default:
- // x += 1;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add one of the required terminators:
- //
- // ```dart
- // %language=2.9
- // void f(int x) {
- // switch (x) {
- // case 0:
- // x += 2;
- // break;
- // default:
- // x += 1;
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CASE_BLOCK_NOT_TERMINATED =
CompileTimeErrorCode(
'CASE_BLOCK_NOT_TERMINATED',
@@ -1365,104 +315,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the this of the switch case expression
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type of the expression
- // following the keyword `case` has an implementation of the `==` operator
- // other than the one in `Object`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the expression
- // following the keyword `case` (`C(0)`) has the type `C`, and the class `C`
- // overrides the `==` operator:
- //
- // ```dart
- // class C {
- // final int value;
- //
- // const C(this.value);
- //
- // bool operator ==(Object other) {
- // return false;
- // }
- // }
- //
- // void f(C c) {
- // switch (c) {
- // case [!C(0)!]:
- // break;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there isn't a strong reason not to do so, then rewrite the code to use
- // an if-else structure:
- //
- // ```dart
- // class C {
- // final int value;
- //
- // const C(this.value);
- //
- // bool operator ==(Object other) {
- // return false;
- // }
- // }
- //
- // void f(C c) {
- // if (c == C(0)) {
- // // ...
- // }
- // }
- // ```
- //
- // If you can't rewrite the switch statement and the implementation of `==`
- // isn't necessary, then remove it:
- //
- // ```dart
- // class C {
- // final int value;
- //
- // const C(this.value);
- // }
- //
- // void f(C c) {
- // switch (c) {
- // case C(0):
- // break;
- // }
- // }
- // ```
- //
- // If you can't rewrite the switch statement and you can't remove the
- // definition of `==`, then find some other value that can be used to control
- // the switch:
- //
- // ```dart
- // class C {
- // final int value;
- //
- // const C(this.value);
- //
- // bool operator ==(Object other) {
- // return false;
- // }
- // }
- //
- // void f(C c) {
- // switch (c.value) {
- // case 0:
- // break;
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the this of the switch case expression
static const CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS =
CompileTimeErrorCode(
'CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS',
@@ -1470,56 +324,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the case expression
- * 1: the type of the switch expression
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the expression following `case`
- // in a `switch` statement has a static type that isn't a subtype of the
- // static type of the expression following `switch`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `1` is an `int`, which
- // isn't a subtype of `String` (the type of `s`):
- //
- // ```dart
- // void f(String s) {
- // switch (s) {
- // case [!1!]:
- // break;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the value of the `case` expression is wrong, then change the `case`
- // expression so that it has the required type:
- //
- // ```dart
- // void f(String s) {
- // switch (s) {
- // case '1':
- // break;
- // }
- // }
- // ```
- //
- // If the value of the `case` expression is correct, then change the `switch`
- // expression to have the required type:
- //
- // ```dart
- // void f(int s) {
- // switch (s) {
- // case 1:
- // break;
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the case expression
+ /// 1: the type of the switch expression
static const CompileTimeErrorCode
CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE =
CompileTimeErrorCode(
@@ -1529,32 +336,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name following the `as` in a
- // cast expression is defined to be something other than a type.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` is a variable, not
- // a type:
- //
- // ```dart
- // num x = 0;
- // int y = x as [!x!];
- // ```
- //
- // #### Common fixes
- //
- // Replace the name with the name of a type:
- //
- // ```dart
- // num x = 0;
- // int y = x as int;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CAST_TO_NON_TYPE = CompileTimeErrorCode(
'CAST_TO_NON_TYPE',
"The name '{0}' isn't a type, so it can't be used in an 'as' expression.",
@@ -1564,10 +346,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the member
- */
+ /// Parameters:
+ /// 0: the name of the member
static const CompileTimeErrorCode
CLASS_INSTANTIATION_ACCESS_TO_INSTANCE_MEMBER = CompileTimeErrorCode(
'CLASS_INSTANTIATION_ACCESS_TO_MEMBER',
@@ -1577,10 +357,8 @@
uniqueName: 'CLASS_INSTANTIATION_ACCESS_TO_INSTANCE_MEMBER',
);
- /**
- * Parameters:
- * 0: the name of the member
- */
+ /// Parameters:
+ /// 0: the name of the member
static const CompileTimeErrorCode
CLASS_INSTANTIATION_ACCESS_TO_STATIC_MEMBER = CompileTimeErrorCode(
'CLASS_INSTANTIATION_ACCESS_TO_MEMBER',
@@ -1591,10 +369,8 @@
uniqueName: 'CLASS_INSTANTIATION_ACCESS_TO_STATIC_MEMBER',
);
- /**
- * Parameters:
- * 0: the name of the member
- */
+ /// Parameters:
+ /// 0: the name of the member
static const CompileTimeErrorCode
CLASS_INSTANTIATION_ACCESS_TO_UNKNOWN_MEMBER = CompileTimeErrorCode(
'CLASS_INSTANTIATION_ACCESS_TO_MEMBER',
@@ -1605,52 +381,6 @@
uniqueName: 'CLASS_INSTANTIATION_ACCESS_TO_UNKNOWN_MEMBER',
);
- // #### Description
- //
- // The analyzer produces this diagnostic when a concrete class indirectly has
- // the class `Enum` as a superinterface.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the concrete class `B`
- // has `Enum` as a superinterface as a result of implementing `A`:
- //
- // ```dart
- // abstract class A implements Enum {}
- //
- // class [!B!] implements A {}
- // ```
- //
- // #### Common fixes
- //
- // If the implemented class isn't the class you intend to implement, then
- // change it:
- //
- // ```dart
- // abstract class A implements Enum {}
- //
- // class B implements C {}
- //
- // class C {}
- // ```
- //
- // If the implemented class can be changed to not implement `Enum`, then do
- // so:
- //
- // ```dart
- // abstract class A {}
- //
- // class B implements A {}
- // ```
- //
- // If the implemented class can't be changed to not implement `Enum`, then
- // remove it from the `implements` clause:
- //
- // ```dart
- // abstract class A implements Enum {}
- //
- // class B {}
- // ```
static const CompileTimeErrorCode CONCRETE_CLASS_HAS_ENUM_SUPERINTERFACE =
CompileTimeErrorCode(
'CONCRETE_CLASS_HAS_ENUM_SUPERINTERFACE',
@@ -1660,47 +390,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the abstract method
- * 1: the name of the enclosing class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a member of a concrete class is
- // found that doesn't have a concrete implementation. Concrete classes aren't
- // allowed to contain abstract members.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `m` is an abstract
- // method but `C` isn't an abstract class:
- //
- // ```dart
- // class C {
- // [!void m();!]
- // }
- // ```
- //
- // #### Common fixes
- //
- // If it's valid to create instances of the class, provide an implementation
- // for the member:
- //
- // ```dart
- // class C {
- // void m() {}
- // }
- // ```
- //
- // If it isn't valid to create instances of the class, mark the class as being
- // abstract:
- //
- // ```dart
- // abstract class C {
- // void m();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the abstract method
+ /// 1: the name of the enclosing class
static const CompileTimeErrorCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER =
CompileTimeErrorCode(
'CONCRETE_CLASS_WITH_ABSTRACT_MEMBER',
@@ -1709,42 +401,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the constructor and field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a named constructor and either a
- // static method or static field have the same name. Both are accessed using
- // the name of the class, so having the same name makes the reference
- // ambiguous.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the static field `foo`
- // and the named constructor `foo` have the same name:
- //
- // ```dart
- // class C {
- // C.[!foo!]();
- // static int foo = 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the static method `foo`
- // and the named constructor `foo` have the same name:
- //
- // ```dart
- // class C {
- // C.[!foo!]();
- // static void foo() {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rename either the member or the constructor.
+ /// Parameters:
+ /// 0: the name of the constructor and field
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD =
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
@@ -1755,10 +413,8 @@
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD',
);
- /**
- * Parameters:
- * 0: the name of the constructor and getter
- */
+ /// Parameters:
+ /// 0: the name of the constructor and getter
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_AND_STATIC_GETTER =
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
@@ -1769,10 +425,8 @@
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_GETTER',
);
- /**
- * Parameters:
- * 0: the name of the constructor
- */
+ /// Parameters:
+ /// 0: the name of the constructor
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_AND_STATIC_METHOD =
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
@@ -1783,10 +437,8 @@
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_METHOD',
);
- /**
- * Parameters:
- * 0: the name of the constructor and setter
- */
+ /// Parameters:
+ /// 0: the name of the constructor and setter
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_AND_STATIC_SETTER =
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
@@ -1797,16 +449,14 @@
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_SETTER',
);
- /**
- * 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
- * error if `C` declares a getter or a setter with basename `n`, and has a
- * method named `n`.
- *
- * Parameters:
- * 0: the name of the class defining the conflicting field
- * 1: the name of the conflicting field
- * 2: the name of the class defining the method with which the field conflicts
- */
+ /// 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
+ /// error if `C` declares a getter or a setter with basename `n`, and has a
+ /// method named `n`.
+ ///
+ /// Parameters:
+ /// 0: the name of the class defining the conflicting field
+ /// 1: the name of the conflicting field
+ /// 2: the name of the class defining the method with which the field conflicts
static const CompileTimeErrorCode CONFLICTING_FIELD_AND_METHOD =
CompileTimeErrorCode(
'CONFLICTING_FIELD_AND_METHOD',
@@ -1817,43 +467,10 @@
"name that doesn't conflict.",
);
- /**
- * Parameters:
- * 0: the name of the class implementing the conflicting interface
- * 1: the first conflicting type
- * 2: the second conflicting type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class attempts to implement a
- // generic interface multiple times, and the values of the type arguments
- // aren't the same.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `C` is defined to
- // implement both `I<int>` (because it extends `A`) and `I<String>` (because
- // it implements`B`), but `int` and `String` aren't the same type:
- //
- // ```dart
- // class I<T> {}
- // class A implements I<int> {}
- // class B implements I<String> {}
- // class [!C!] extends A implements B {}
- // ```
- //
- // #### Common fixes
- //
- // Rework the type hierarchy to avoid this situation. For example, you might
- // make one or both of the inherited types generic so that `C` can specify the
- // same type for both type arguments:
- //
- // ```dart
- // class I<T> {}
- // class A<S> implements I<S> {}
- // class B implements I<String> {}
- // class C extends A<String> implements B {}
- // ```
+ /// Parameters:
+ /// 0: the name of the class implementing the conflicting interface
+ /// 1: the first conflicting type
+ /// 2: the second conflicting type
static const CompileTimeErrorCode CONFLICTING_GENERIC_INTERFACES =
CompileTimeErrorCode(
'CONFLICTING_GENERIC_INTERFACES',
@@ -1862,16 +479,14 @@
hasPublishedDocs: true,
);
- /**
- * 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
- * error if `C` declares a method named `n`, and has a getter or a setter
- * with basename `n`.
- *
- * Parameters:
- * 0: the name of the class defining the conflicting method
- * 1: the name of the conflicting method
- * 2: the name of the class defining the field with which the method conflicts
- */
+ /// 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
+ /// error if `C` declares a method named `n`, and has a getter or a setter
+ /// with basename `n`.
+ ///
+ /// Parameters:
+ /// 0: the name of the class defining the conflicting method
+ /// 1: the name of the conflicting method
+ /// 2: the name of the class defining the field with which the method conflicts
static const CompileTimeErrorCode CONFLICTING_METHOD_AND_FIELD =
CompileTimeErrorCode(
'CONFLICTING_METHOD_AND_FIELD',
@@ -1882,16 +497,14 @@
"name that doesn't conflict.",
);
- /**
- * 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
- * error if `C` declares a static member with basename `n`, and has an
- * instance member with basename `n`.
- *
- * Parameters:
- * 0: the name of the class defining the conflicting member
- * 1: the name of the conflicting static member
- * 2: the name of the class defining the field with which the method conflicts
- */
+ /// 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
+ /// error if `C` declares a static member with basename `n`, and has an
+ /// instance member with basename `n`.
+ ///
+ /// Parameters:
+ /// 0: the name of the class defining the conflicting member
+ /// 1: the name of the conflicting static member
+ /// 2: the name of the class defining the field with which the method conflicts
static const CompileTimeErrorCode CONFLICTING_STATIC_AND_INSTANCE =
CompileTimeErrorCode(
'CONFLICTING_STATIC_AND_INSTANCE',
@@ -1901,32 +514,8 @@
"Try renaming the member to a name that doesn't conflict.",
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class, mixin, or extension
- // declaration declares a type parameter with the same name as the class,
- // mixin, or extension that declares it.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type parameter `C`
- // has the same name as the class `C` of which it's a part:
- //
- // ```dart
- // class C<[!C!]> {}
- // ```
- //
- // #### Common fixes
- //
- // Rename either the type parameter, or the class, mixin, or extension:
- //
- // ```dart
- // class C<T> {}
- // ```
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS =
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
@@ -1937,10 +526,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_CLASS',
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_ENUM =
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
@@ -1951,10 +538,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_ENUM',
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_EXTENSION =
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
@@ -1966,36 +551,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_EXTENSION',
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class, mixin, or extension
- // declaration declares a type parameter with the same name as one of the
- // members of the class, mixin, or extension that declares it.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type parameter `T`
- // has the same name as the field `T`:
- //
- // ```dart
- // class C<[!T!]> {
- // int T = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rename either the type parameter or the member with which it conflicts:
- //
- // ```dart
- // class C<T> {
- // int total = 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS =
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
@@ -2006,10 +563,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS',
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER_ENUM =
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
@@ -2020,10 +575,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_ENUM',
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode
CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION = CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
@@ -2034,10 +587,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION',
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER_MIXIN =
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
@@ -2048,10 +599,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_MIXIN',
);
- /**
- * Parameters:
- * 0: the name of the type variable
- */
+ /// Parameters:
+ /// 0: the name of the type variable
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MIXIN =
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
@@ -2062,10 +611,8 @@
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MIXIN',
);
- /**
- * 16.12.2 Const: It is a compile-time error if evaluation of a constant
- * object results in an uncaught exception being thrown.
- */
+ /// 16.12.2 Const: It is a compile-time error if evaluation of a constant
+ /// object results in an uncaught exception being thrown.
static const CompileTimeErrorCode CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH =
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH',
@@ -2074,53 +621,9 @@
correctionMessage: "Try using a subtype, or removing the keyword 'const'.",
);
- /**
- * Parameters:
- * 0: the type of the runtime value of the argument
- * 1: the static type of the parameter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the runtime type of a constant
- // value can't be assigned to the static type of a constant constructor's
- // parameter.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the runtime type of `i`
- // is `int`, which can't be assigned to the static type of `s`:
- //
- // ```dart
- // class C {
- // final String s;
- //
- // const C(this.s);
- // }
- //
- // const dynamic i = 0;
- //
- // void f() {
- // const C([!i!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Pass a value of the correct type to the constructor:
- //
- // ```dart
- // class C {
- // final String s;
- //
- // const C(this.s);
- // }
- //
- // const dynamic i = 0;
- //
- // void f() {
- // const C('$i');
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the runtime value of the argument
+ /// 1: the static type of the parameter
static const CompileTimeErrorCode CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH =
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH',
@@ -2130,10 +633,8 @@
hasPublishedDocs: true,
);
- /**
- * 16.12.2 Const: It is a compile-time error if evaluation of a constant
- * object results in an uncaught exception being thrown.
- */
+ /// 16.12.2 Const: It is a compile-time error if evaluation of a constant
+ /// object results in an uncaught exception being thrown.
static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION =
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_THROWS_EXCEPTION',
@@ -2142,48 +643,8 @@
"Try removing the throw statement, or removing the keyword 'const'.",
);
- /**
- * Parameters:
- * 0: the name of the field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor has the keyword
- // `const`, but a field in the class is initialized to a non-constant value.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `s` is
- // initialized to a non-constant value:
- //
- // ```dart
- // class C {
- // final String s = 3.toString();
- // [!const!] C();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field can be initialized to a constant value, then change the
- // initializer to a constant expression:
- //
- // ```dart
- // class C {
- // final String s = '3';
- // const C();
- // }
- // ```
- //
- // If the field can't be initialized to a constant value, then remove the
- // keyword `const` from the constructor:
- //
- // ```dart
- // class C {
- // final String s = 3.toString();
- // C();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the field
static const CompileTimeErrorCode
CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST =
CompileTimeErrorCode(
@@ -2196,20 +657,18 @@
hasPublishedDocs: true,
);
- /**
- * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
- * or implicitly, in the initializer list of a constant constructor must
- * specify a constant constructor of the superclass of the immediately
- * enclosing class or a compile-time error occurs.
- *
- * 12.1 Mixin Application: For each generative constructor named ... an
- * implicitly declared constructor named ... is declared. If Sq is a
- * generative const constructor, and M does not declare any fields, Cq is
- * also a const constructor.
- *
- * Parameters:
- * 0: the name of the instance field.
- */
+ /// 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
+ /// or implicitly, in the initializer list of a constant constructor must
+ /// specify a constant constructor of the superclass of the immediately
+ /// enclosing class or a compile-time error occurs.
+ ///
+ /// 12.1 Mixin Application: For each generative constructor named ... an
+ /// implicitly declared constructor named ... is declared. If Sq is a
+ /// generative const constructor, and M does not declare any fields, Cq is
+ /// also a const constructor.
+ ///
+ /// Parameters:
+ /// 0: the name of the instance field.
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD =
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD',
@@ -2220,20 +679,18 @@
"the class declaration, or removing the field from the mixin class.",
);
- /**
- * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
- * or implicitly, in the initializer list of a constant constructor must
- * specify a constant constructor of the superclass of the immediately
- * enclosing class or a compile-time error occurs.
- *
- * 12.1 Mixin Application: For each generative constructor named ... an
- * implicitly declared constructor named ... is declared. If Sq is a
- * generative const constructor, and M does not declare any fields, Cq is
- * also a const constructor.
- *
- * Parameters:
- * 0: the names of the instance fields.
- */
+ /// 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
+ /// or implicitly, in the initializer list of a constant constructor must
+ /// specify a constant constructor of the superclass of the immediately
+ /// enclosing class or a compile-time error occurs.
+ ///
+ /// 12.1 Mixin Application: For each generative constructor named ... an
+ /// implicitly declared constructor named ... is declared. If Sq is a
+ /// generative const constructor, and M does not declare any fields, Cq is
+ /// also a const constructor.
+ ///
+ /// Parameters:
+ /// 0: the names of the instance fields.
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELDS =
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD',
@@ -2245,77 +702,8 @@
uniqueName: 'CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELDS',
);
- /**
- * Parameters:
- * 0: the name of the superclass
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor that is marked as
- // `const` invokes a constructor from its superclass that isn't marked as
- // `const`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the `const` constructor
- // in `B` invokes the constructor `nonConst` from the class `A`, and the
- // superclass constructor isn't a `const` constructor:
- //
- // ```dart
- // class A {
- // const A();
- // A.nonConst();
- // }
- //
- // class B extends A {
- // const B() : [!super.nonConst()!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If it isn't essential to invoke the superclass constructor that is
- // currently being invoked, then invoke a constant constructor from the
- // superclass:
- //
- // ```dart
- // class A {
- // const A();
- // A.nonConst();
- // }
- //
- // class B extends A {
- // const B() : super();
- // }
- // ```
- //
- // If it's essential that the current constructor be invoked and if you can
- // modify it, then add `const` to the constructor in the superclass:
- //
- // ```dart
- // class A {
- // const A();
- // const A.nonConst();
- // }
- //
- // class B extends A {
- // const B() : super.nonConst();
- // }
- // ```
- //
- // If it's essential that the current constructor be invoked and you can't
- // modify it, then remove `const` from the constructor in the subclass:
- //
- // ```dart
- // class A {
- // const A();
- // A.nonConst();
- // }
- //
- // class B extends A {
- // B() : super.nonConst();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the superclass
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER =
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER',
@@ -2327,50 +715,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor is marked as a
- // const constructor, but the constructor is defined in a class that has at
- // least one non-final instance field (either directly or by inheritance).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `x` isn't
- // final:
- //
- // ```dart
- // class C {
- // int x;
- //
- // const [!C!](this.x);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If it's possible to mark all of the fields as final, then do so:
- //
- // ```dart
- // class C {
- // final int x;
- //
- // const C(this.x);
- // }
- // ```
- //
- // If it isn't possible to mark all of the fields as final, then remove the
- // keyword `const` from the constructor:
- //
- // ```dart
- // class C {
- // int x;
- //
- // C(this.x);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD =
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD',
@@ -2381,49 +726,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class from a library that is
- // imported using a deferred import is used to create a `const` object.
- // Constants are evaluated at compile time, and classes from deferred
- // libraries aren't available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // The following code produces this diagnostic because it attempts to create a
- // `const` instance of a class from a deferred library:
- //
- // ```dart
- // import 'dart:convert' deferred as convert;
- //
- // const json2 = [!convert.JsonCodec()!];
- // ```
- //
- // #### Common fixes
- //
- // If the object isn't required to be a constant, then change the code so that
- // a non-constant instance is created:
- //
- // ```dart
- // import 'dart:convert' deferred as convert;
- //
- // final json2 = convert.JsonCodec();
- // ```
- //
- // If the object must be a constant, then remove `deferred` from the import
- // directive:
- //
- // ```dart
- // import 'dart:convert' as convert;
- //
- // const json2 = convert.JsonCodec();
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_DEFERRED_CLASS = CompileTimeErrorCode(
'CONST_DEFERRED_CLASS',
"Deferred classes can't be created with 'const'.",
@@ -2433,20 +736,16 @@
hasPublishedDocs: true,
);
- /**
- * 16.12.2 Const: It is a compile-time error if evaluation of a constant
- * object results in an uncaught exception being thrown.
- */
+ /// 16.12.2 Const: It is a compile-time error if evaluation of a constant
+ /// object results in an uncaught exception being thrown.
static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION =
CompileTimeErrorCode(
'CONST_EVAL_THROWS_EXCEPTION',
"Evaluation of this constant expression throws an exception.",
);
- /**
- * 16.12.2 Const: It is a compile-time error if evaluation of a constant
- * object results in an uncaught exception being thrown.
- */
+ /// 16.12.2 Const: It is a compile-time error if evaluation of a constant
+ /// object results in an uncaught exception being thrown.
static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE =
CompileTimeErrorCode(
'CONST_EVAL_THROWS_IDBZE',
@@ -2454,22 +753,18 @@
"IntegerDivisionByZeroException.",
);
- /**
- * 16.12.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
- * where e, e1 and e2 are constant expressions that evaluate to a boolean
- * value.
- */
+ /// 16.12.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
+ /// where e, e1 and e2 are constant expressions that evaluate to a boolean
+ /// value.
static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = CompileTimeErrorCode(
'CONST_EVAL_TYPE_BOOL',
"In constant expressions, operands of this operator must be of type "
"'bool'.",
);
- /**
- * 16.12.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
- * where e, e1 and e2 are constant expressions that evaluate to a boolean
- * value.
- */
+ /// 16.12.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
+ /// where e, e1 and e2 are constant expressions that evaluate to a boolean
+ /// value.
static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_INT =
CompileTimeErrorCode(
'CONST_EVAL_TYPE_BOOL_INT',
@@ -2477,11 +772,9 @@
"or 'int'.",
);
- /**
- * 16.12.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where
- * e1 and e2 are constant expressions that evaluate to a numeric, string or
- * boolean value or to null.
- */
+ /// 16.12.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where
+ /// e1 and e2 are constant expressions that evaluate to a numeric, string or
+ /// boolean value or to null.
static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING =
CompileTimeErrorCode(
'CONST_EVAL_TYPE_BOOL_NUM_STRING',
@@ -2489,22 +782,18 @@
"'bool', 'num', 'String' or 'null'.",
);
- /**
- * 16.12.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2,
- * e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions
- * that evaluate to an integer value or to null.
- */
+ /// 16.12.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2,
+ /// e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions
+ /// that evaluate to an integer value or to null.
static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = CompileTimeErrorCode(
'CONST_EVAL_TYPE_INT',
"In constant expressions, operands of this operator must be of type 'int'.",
);
- /**
- * 16.12.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1
- * e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2,
- * where e, e1 and e2 are constant expressions that evaluate to a numeric
- * value or to null.
- */
+ /// 16.12.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1
+ /// e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2,
+ /// where e, e1 and e2 are constant expressions that evaluate to a numeric
+ /// value or to null.
static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = CompileTimeErrorCode(
'CONST_EVAL_TYPE_NUM',
"In constant expressions, operands of this operator must be of type 'num'.",
@@ -2516,11 +805,9 @@
"'Type'.",
);
- /**
- * Parameters:
- * 0: the name of the type of the initializer expression
- * 1: the name of the type of the field
- */
+ /// Parameters:
+ /// 0: the name of the type of the initializer expression
+ /// 1: the name of the type of the field
static const CompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'FIELD_INITIALIZER_NOT_ASSIGNABLE',
@@ -2531,42 +818,7 @@
uniqueName: 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a value that isn't statically
- // known to be a constant is assigned to a variable that's declared to be a
- // `const` variable.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` isn't declared to
- // be `const`:
- //
- // ```dart
- // var x = 0;
- // const y = [!x!];
- // ```
- //
- // #### Common fixes
- //
- // If the value being assigned can be declared to be `const`, then change the
- // declaration:
- //
- // ```dart
- // const x = 0;
- // const y = x;
- // ```
- //
- // If the value can't be declared to be `const`, then remove the `const`
- // modifier from the variable, possibly using `final` in its place:
- //
- // ```dart
- // var x = 0;
- // final y = x;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE =
CompileTimeErrorCode(
'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE',
@@ -2576,48 +828,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `const` variable is
- // initialized using a `const` variable from a library that is imported using
- // a deferred import. Constants are evaluated at compile time, and values from
- // deferred libraries aren't available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the variable `pi` is
- // being initialized using the constant `math.pi` from the library
- // `dart:math`, and `dart:math` is imported as a deferred library:
- //
- // ```dart
- // import 'dart:math' deferred as math;
- //
- // const pi = [!math.pi!];
- // ```
- //
- // #### Common fixes
- //
- // If you need to reference the value of the constant from the imported
- // library, then remove the keyword `deferred`:
- //
- // ```dart
- // import 'dart:math' as math;
- //
- // const pi = math.pi;
- // ```
- //
- // If you don't need to reference the imported constant, then remove the
- // reference:
- //
- // ```dart
- // const pi = 3.14;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY =
CompileTimeErrorCode(
@@ -2630,43 +841,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an instance field is marked as
- // being const.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is an instance
- // field:
- //
- // ```dart
- // class C {
- // [!const!] int f = 3;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field needs to be an instance field, then remove the keyword
- // `const`, or replace it with `final`:
- //
- // ```dart
- // class C {
- // final int f = 3;
- // }
- // ```
- //
- // If the field really should be a const field, then make it a static field:
- //
- // ```dart
- // class C {
- // static const int f = 3;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_INSTANCE_FIELD = CompileTimeErrorCode(
'CONST_INSTANCE_FIELD',
"Only static fields can be declared as const.",
@@ -2675,58 +850,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the entry's key
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the class of object used as a
- // key in a constant map literal implements the `==` operator. The
- // implementation of constant maps uses the `==` operator, so any
- // implementation other than the one inherited from `Object` requires
- // executing arbitrary code at compile time, which isn't supported.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constant map
- // contains a key whose type is `C`, and the class `C` overrides the
- // implementation of `==`:
- //
- // ```dart
- // class C {
- // const C();
- //
- // bool operator ==(Object other) => true;
- // }
- //
- // const map = {[!C()!] : 0};
- // ```
- //
- // #### Common fixes
- //
- // If you can remove the implementation of `==` from the class, then do so:
- //
- // ```dart
- // class C {
- // const C();
- // }
- //
- // const map = {C() : 0};
- // ```
- //
- // If you can't remove the implementation of `==` from the class, then make
- // the map be non-constant:
- //
- // ```dart
- // class C {
- // const C();
- //
- // bool operator ==(Object other) => true;
- // }
- //
- // final map = {C() : 0};
- // ```
+ /// Parameters:
+ /// 0: the type of the entry's key
static const CompileTimeErrorCode
CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = CompileTimeErrorCode(
'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS',
@@ -2738,30 +863,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the uninitialized final variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a variable that is declared to
- // be a constant doesn't have an initializer.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `c` isn't initialized:
- //
- // ```dart
- // const [!c!];
- // ```
- //
- // #### Common fixes
- //
- // Add an initializer:
- //
- // ```dart
- // const c = 'c';
- // ```
+ /// Parameters:
+ /// 0: the name of the uninitialized final variable
static const CompileTimeErrorCode CONST_NOT_INITIALIZED =
CompileTimeErrorCode(
'CONST_NOT_INITIALIZED',
@@ -2770,58 +873,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the element
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the class of object used as an
- // element in a constant set literal implements the `==` operator. The
- // implementation of constant sets uses the `==` operator, so any
- // implementation other than the one inherited from `Object` requires
- // executing arbitrary code at compile time, which isn't supported.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constant set
- // contains an element whose type is `C`, and the class `C` overrides the
- // implementation of `==`:
- //
- // ```dart
- // class C {
- // const C();
- //
- // bool operator ==(Object other) => true;
- // }
- //
- // const set = {[!C()!]};
- // ```
- //
- // #### Common fixes
- //
- // If you can remove the implementation of `==` from the class, then do so:
- //
- // ```dart
- // class C {
- // const C();
- // }
- //
- // const set = {C()};
- // ```
- //
- // If you can't remove the implementation of `==` from the class, then make
- // the set be non-constant:
- //
- // ```dart
- // class C {
- // const C();
- //
- // bool operator ==(Object other) => true;
- // }
- //
- // final set = {C()};
- // ```
+ /// Parameters:
+ /// 0: the type of the element
static const CompileTimeErrorCode CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS =
CompileTimeErrorCode(
'CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS',
@@ -2833,36 +886,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the expression of a spread
- // operator in a constant list or set evaluates to something other than a list
- // or a set.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of `list1` is
- // `null`, which is neither a list nor a set:
- //
- // ```dart
- // %language=2.9
- // const List<int> list1 = null;
- // const List<int> list2 = [...[!list1!]];
- // ```
- //
- // #### Common fixes
- //
- // Change the expression to something that evaluates to either a constant list
- // or a constant set:
- //
- // ```dart
- // %language=2.9
- // const List<int> list1 = [];
- // const List<int> list2 = [...list1];
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_SPREAD_EXPECTED_LIST_OR_SET =
CompileTimeErrorCode(
'CONST_SPREAD_EXPECTED_LIST_OR_SET',
@@ -2870,34 +894,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the expression of a spread
- // operator in a constant map evaluates to something other than a map.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of `map1` is
- // `null`, which isn't a map:
- //
- // ```dart
- // %language=2.9
- // const Map<String, int> map1 = null;
- // const Map<String, int> map2 = {...[!map1!]};
- // ```
- //
- // #### Common fixes
- //
- // Change the expression to something that evaluates to a constant map:
- //
- // ```dart
- // %language=2.9
- // const Map<String, int> map1 = {};
- // const Map<String, int> map2 = {...map1};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_SPREAD_EXPECTED_MAP =
CompileTimeErrorCode(
'CONST_SPREAD_EXPECTED_MAP',
@@ -2905,50 +902,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the keyword `const` is used to
- // invoke a constructor that isn't marked with `const`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor in `A`
- // isn't a const constructor:
- //
- // ```dart
- // class A {
- // A();
- // }
- //
- // A f() => [!const!] A();
- // ```
- //
- // #### Common fixes
- //
- // If it's desirable and possible to make the class a constant class (by
- // making all of the fields of the class, including inherited fields, final),
- // then add the keyword `const` to the constructor:
- //
- // ```dart
- // class A {
- // const A();
- // }
- //
- // A f() => const A();
- // ```
- //
- // Otherwise, remove the keyword `const`:
- //
- // ```dart
- // class A {
- // A();
- // }
- //
- // A f() => A();
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_WITH_NON_CONST = CompileTimeErrorCode(
'CONST_WITH_NON_CONST',
"The constructor being called isn't a const constructor.",
@@ -2956,38 +910,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a const constructor is invoked
- // with an argument that isn't a constant expression.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `i` isn't a constant:
- //
- // ```dart
- // class C {
- // final int i;
- // const C(this.i);
- // }
- // C f(int i) => const C([!i!]);
- // ```
- //
- // #### Common fixes
- //
- // Either make all of the arguments constant expressions, or remove the
- // `const` keyword to use the non-constant form of the constructor:
- //
- // ```dart
- // class C {
- // final int i;
- // const C(this.i);
- // }
- // C f(int i) => C(i);
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT =
CompileTimeErrorCode(
'CONST_WITH_NON_CONSTANT_ARGUMENT',
@@ -2998,10 +921,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the non-type element
- */
+ /// Parameters:
+ /// 0: the name of the non-type element
static const CompileTimeErrorCode CONST_WITH_NON_TYPE = CompileTimeErrorCode(
'CREATION_WITH_NON_TYPE',
"The name '{0}' isn't a class.",
@@ -3011,52 +932,7 @@
uniqueName: 'CONST_WITH_NON_TYPE',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type parameter is used as a
- // type argument in a `const` invocation of a constructor. This isn't allowed
- // because the value of the type parameter (the actual type that will be used
- // at runtime) can't be known at compile time.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type parameter `T`
- // is being used as a type argument when creating a constant:
- //
- // ```dart
- // class C<T> {
- // const C();
- // }
- //
- // C<T> newC<T>() => const C<[!T!]>();
- // ```
- //
- // #### Common fixes
- //
- // If the type that will be used for the type parameter can be known at
- // compile time, then remove the use of the type parameter:
- //
- // ```dart
- // class C<T> {
- // const C();
- // }
- //
- // C<int> newC() => const C<int>();
- // ```
- //
- // If the type that will be used for the type parameter can't be known until
- // runtime, then remove the keyword `const`:
- //
- // ```dart
- // class C<T> {
- // const C();
- // }
- //
- // C<T> newC<T>() => C<T>();
- // ```
+ /// No parameters.
static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS =
CompileTimeErrorCode(
'CONST_WITH_TYPE_PARAMETERS',
@@ -3066,9 +942,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
CONST_WITH_TYPE_PARAMETERS_CONSTRUCTOR_TEAROFF = CompileTimeErrorCode(
'CONST_WITH_TYPE_PARAMETERS',
@@ -3080,9 +954,7 @@
uniqueName: 'CONST_WITH_TYPE_PARAMETERS_CONSTRUCTOR_TEAROFF',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF = CompileTimeErrorCode(
'CONST_WITH_TYPE_PARAMETERS',
@@ -3094,14 +966,12 @@
uniqueName: 'CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF',
);
- /**
- * 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
- * a constant constructor declared by the type <i>T</i>.
- *
- * Parameters:
- * 0: the name of the type
- * 1: the name of the requested constant constructor
- */
+ /// 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
+ /// a constant constructor declared by the type <i>T</i>.
+ ///
+ /// Parameters:
+ /// 0: the name of the type
+ /// 1: the name of the requested constant constructor
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR =
CompileTimeErrorCode(
'CONST_WITH_UNDEFINED_CONSTRUCTOR',
@@ -3109,13 +979,11 @@
correctionMessage: "Try calling a different constructor.",
);
- /**
- * 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
- * a constant constructor declared by the type <i>T</i>.
- *
- * Parameters:
- * 0: the name of the type
- */
+ /// 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
+ /// a constant constructor declared by the type <i>T</i>.
+ ///
+ /// Parameters:
+ /// 0: the name of the type
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT =
CompileTimeErrorCode(
'CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
@@ -3123,29 +991,6 @@
correctionMessage: "Try calling a different constructor.",
);
- // #### Description
- //
- // The analyzer produces this diagnostic when the label in a `continue`
- // statement resolves to a label on a `switch` statement.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the label `l`, used to
- // label a `switch` statement, is used in the `continue` statement:
- //
- // ```dart
- // void f(int i) {
- // l: switch (i) {
- // case 0:
- // continue [!l!];
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Find a different way to achieve the control flow you need; for example, by
- // introducing a loop that re-executes the `switch` statement.
static const CompileTimeErrorCode CONTINUE_LABEL_ON_SWITCH =
CompileTimeErrorCode(
'CONTINUE_LABEL_ON_SWITCH',
@@ -3154,55 +999,15 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type parameter
- * 1: detail text explaining why the type could not be inferred
- */
+ /// Parameters:
+ /// 0: the name of the type parameter
+ /// 1: detail text explaining why the type could not be inferred
static const CompileTimeErrorCode COULD_NOT_INFER = CompileTimeErrorCode(
'COULD_NOT_INFER',
"Couldn't infer type parameter '{0}'.{1}",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds a use of the default
- // constructor for the class `List` in code that has opted in to null safety.
- //
- // #### Example
- //
- // Assuming the following code is opted in to null safety, it produces this
- // diagnostic because it uses the default `List` constructor:
- //
- // ```dart
- // var l = [!List<int>!]();
- // ```
- //
- // #### Common fixes
- //
- // If no initial size is provided, then convert the code to use a list
- // literal:
- //
- // ```dart
- // var l = <int>[];
- // ```
- //
- // If an initial size needs to be provided and there is a single reasonable
- // initial value for the elements, then use `List.filled`:
- //
- // ```dart
- // var l = List.filled(3, 0);
- // ```
- //
- // If an initial size needs to be provided but each element needs to be
- // computed, then use `List.generate`:
- //
- // ```dart
- // var l = List.generate(3, (i) => i);
- // ```
+ /// No parameters.
static const CompileTimeErrorCode DEFAULT_LIST_CONSTRUCTOR =
CompileTimeErrorCode(
'DEFAULT_LIST_CONSTRUCTOR',
@@ -3213,57 +1018,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a factory constructor that
- // redirects to another constructor specifies a default value for an optional
- // parameter.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the factory constructor
- // in `A` has a default value for the optional parameter `x`:
- //
- // ```dart
- // class A {
- // factory A([int [!x!] = 0]) = B;
- // }
- //
- // class B implements A {
- // B([int x = 1]) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the default value from the factory constructor:
- //
- // ```dart
- // class A {
- // factory A([int x]) = B;
- // }
- //
- // class B implements A {
- // B([int x = 1]) {}
- // }
- // ```
- //
- // Note that this fix might change the value used when the optional parameter
- // is omitted. If that happens, and if that change is a problem, then consider
- // making the optional parameter a required parameter in the factory method:
- //
- // ```dart
- // class A {
- // factory A(int x) = B;
- // }
- //
- // class B implements A {
- // B([int x = 1]) {}
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR = CompileTimeErrorCode(
'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR',
@@ -3273,38 +1028,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a named parameter has both the
- // `required` modifier and a default value. If the parameter is required, then
- // a value for the parameter is always provided at the call sites, so the
- // default value can never be used.
- //
- // #### Example
- //
- // The following code generates this diagnostic:
- //
- // ```dart
- // void log({required String [!message!] = 'no message'}) {}
- // ```
- //
- // #### Common fixes
- //
- // If the parameter is really required, then remove the default value:
- //
- // ```dart
- // void log({required String message}) {}
- // ```
- //
- // If the parameter isn't always required, then remove the `required`
- // modifier:
- //
- // ```dart
- // void log({String message = 'no message'}) {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode DEFAULT_VALUE_ON_REQUIRED_PARAMETER =
CompileTimeErrorCode(
'DEFAULT_VALUE_ON_REQUIRED_PARAMETER',
@@ -3314,82 +1038,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library that is imported using
- // a deferred import declares an extension that is visible in the importing
- // library. Extension methods are resolved at compile time, and extensions
- // from deferred libraries aren't available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // Given a file (`a.dart`) that defines a named extension:
- //
- // ```dart
- // %uri="lib/a.dart"
- // class C {}
- //
- // extension E on String {
- // int get size => length;
- // }
- // ```
- //
- // The following code produces this diagnostic because the named extension is
- // visible to the library:
- //
- // ```dart
- // import [!'a.dart'!] deferred as a;
- //
- // void f() {
- // a.C();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the library must be imported as `deferred`, then either add a `show`
- // clause listing the names being referenced or add a `hide` clause listing
- // all of the named extensions. Adding a `show` clause would look like this:
- //
- // ```dart
- // import 'a.dart' deferred as a show C;
- //
- // void f() {
- // a.C();
- // }
- // ```
- //
- // Adding a `hide` clause would look like this:
- //
- // ```dart
- // import 'a.dart' deferred as a hide E;
- //
- // void f() {
- // a.C();
- // }
- // ```
- //
- // With the first fix, the benefit is that if new extensions are added to the
- // imported library, then the extensions won't cause a diagnostic to be
- // generated.
- //
- // If the library doesn't need to be imported as `deferred`, or if you need to
- // make use of the extension method declared in it, then remove the keyword
- // `deferred`:
- //
- // ```dart
- // import 'a.dart' as a;
- //
- // void f() {
- // a.C();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode DEFERRED_IMPORT_OF_EXTENSION =
CompileTimeErrorCode(
'DEFERRED_IMPORT_OF_EXTENSION',
@@ -3400,39 +1049,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the variable that is invalid
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when [definite assignment][] analysis
- // shows that a local variable that's marked as `late` is read before being
- // assigned.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` wasn't assigned a
- // value before being read:
- //
- // ```dart
- // void f(bool b) {
- // late int x;
- // print([!x!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Assign a value to the variable before reading from it:
- //
- // ```dart
- // void f(bool b) {
- // late int x;
- // x = b ? 1 : 0;
- // print(x);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the variable that is invalid
static const CompileTimeErrorCode DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE =
CompileTimeErrorCode(
'DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE',
@@ -3442,43 +1060,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an expression with a value that
- // is anything other than one of the allowed kinds of values is followed by
- // type arguments. The allowed kinds of values are:
- // - generic types,
- // - generic constructors, and
- // - generic functions, including top-level functions, static and instance
- // members, and local functions.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `i` is a top-level
- // variable, which isn't one of the allowed cases:
- //
- // ```dart
- // int i = 1;
- //
- // void f() {
- // print([!i!]<int>);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the referenced value is correct, then remove the type arguments:
- //
- // ```dart
- // int i = 1;
- //
- // void f() {
- // print(i);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode DISALLOWED_TYPE_INSTANTIATION_EXPRESSION =
CompileTimeErrorCode(
'DISALLOWED_TYPE_INSTANTIATION_EXPRESSION',
@@ -3491,80 +1073,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class declares more than one
- // unnamed constructor or when it declares more than one constructor with the
- // same name.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because there are two
- // declarations for the unnamed constructor:
- //
- // ```dart
- // class C {
- // C();
- //
- // [!C!]();
- // }
- // ```
- //
- // The following code produces this diagnostic because there are two
- // declarations for the constructor named `m`:
- //
- // ```dart
- // class C {
- // C.m();
- //
- // [!C.m!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there are multiple unnamed constructors and all of the constructors are
- // needed, then give all of them, or all except one of them, a name:
- //
- // ```dart
- // class C {
- // C();
- //
- // C.n();
- // }
- // ```
- //
- // If there are multiple unnamed constructors and all except one of them are
- // unneeded, then remove the constructors that aren't needed:
- //
- // ```dart
- // class C {
- // C();
- // }
- // ```
- //
- // If there are multiple named constructors and all of the constructors are
- // needed, then rename all except one of them:
- //
- // ```dart
- // class C {
- // C.m();
- //
- // C.n();
- // }
- // ```
- //
- // If there are multiple named constructors and all except one of them are
- // unneeded, then remove the constructorsthat aren't needed:
- //
- // ```dart
- // class C {
- // C.m();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT =
CompileTimeErrorCode(
'DUPLICATE_CONSTRUCTOR',
@@ -3574,10 +1083,8 @@
uniqueName: 'DUPLICATE_CONSTRUCTOR_DEFAULT',
);
- /**
- * Parameters:
- * 0: the name of the duplicate entity
- */
+ /// Parameters:
+ /// 0: the name of the duplicate entity
static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME =
CompileTimeErrorCode(
'DUPLICATE_CONSTRUCTOR',
@@ -3587,33 +1094,8 @@
uniqueName: 'DUPLICATE_CONSTRUCTOR_NAME',
);
- /**
- * Parameters:
- * 0: the name of the duplicate entity
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name is declared, and there is
- // a previous declaration with the same name in the same scope.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `x` is
- // declared twice:
- //
- // ```dart
- // int x = 0;
- // int [!x!] = 1;
- // ```
- //
- // #### Common fixes
- //
- // Choose a different name for one of the declarations.
- //
- // ```dart
- // int x = 0;
- // int y = 1;
- // ```
+ /// Parameters:
+ /// 0: the name of the duplicate entity
static const CompileTimeErrorCode DUPLICATE_DEFINITION = CompileTimeErrorCode(
'DUPLICATE_DEFINITION',
"The name '{0}' is already defined.",
@@ -3621,41 +1103,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's more than one
- // initializing formal parameter for the same field in a constructor's
- // parameter list. It isn't useful to assign a value that will immediately be
- // overwritten.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `this.f` appears twice
- // in the parameter list:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f, this.[!f!]) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove one of the initializing formal parameters:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f) {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the field
static const CompileTimeErrorCode DUPLICATE_FIELD_FORMAL_PARAMETER =
CompileTimeErrorCode(
'DUPLICATE_FIELD_FORMAL_PARAMETER',
@@ -3666,58 +1115,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the parameter that was duplicated
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation has two or more
- // named arguments that have the same name.
- //
- // #### Example
- //
- // The following code produces this diagnostic because there are two arguments
- // with the name `a`:
- //
- // ```dart
- // %language=2.9
- // void f(C c) {
- // c.m(a: 0, [!a!]: 1);
- // }
- //
- // class C {
- // void m({int a, int b}) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // If one of the arguments should have a different name, then change the name:
- //
- // ```dart
- // %language=2.9
- // void f(C c) {
- // c.m(a: 0, b: 1);
- // }
- //
- // class C {
- // void m({int a, int b}) {}
- // }
- // ```
- //
- // If one of the arguments is wrong, then remove it:
- //
- // ```dart
- // %language=2.9
- // void f(C c) {
- // c.m(a: 1);
- // }
- //
- // class C {
- // void m({int a, int b}) {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the parameter that was duplicated
static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT =
CompileTimeErrorCode(
'DUPLICATE_NAMED_ARGUMENT',
@@ -3728,43 +1127,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the URI of the duplicate part
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a single file is referenced in
- // multiple part directives.
- //
- // #### Example
- //
- // Given a file named `part.dart` containing
- //
- // ```dart
- // %uri="lib/part.dart"
- // part of lib;
- // ```
- //
- // The following code produces this diagnostic because the file `part.dart` is
- // included multiple times:
- //
- // ```dart
- // library lib;
- //
- // part 'part.dart';
- // part [!'part.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // Remove all except the first of the duplicated part directives:
- //
- // ```dart
- // library lib;
- //
- // part 'part.dart';
- // ```
+ /// Parameters:
+ /// 0: the URI of the duplicate part
static const CompileTimeErrorCode DUPLICATE_PART = CompileTimeErrorCode(
'DUPLICATE_PART',
"The library already contains a part with the URI '{0}'.",
@@ -3773,39 +1137,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when an enum constant has the same
- // name as the enum in which it's declared.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the enum constant `E`
- // has the same name as the enclosing enum `E`:
- //
- // ```dart
- // enum E {
- // [!E!]
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the name of the enum is correct, then rename the constant:
- //
- // ```dart
- // enum E {
- // e
- // }
- // ```
- //
- // If the name of the constant is correct, then rename the enum:
- //
- // ```dart
- // enum F {
- // E
- // }
- // ```
static const CompileTimeErrorCode ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING =
CompileTimeErrorCode(
'ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING',
@@ -3814,38 +1145,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when an enum constant is being
- // created using either a factory constructor or a generative constructor
- // that isn't marked as being `const`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the enum constant `e`
- // is being initialized by a factory constructor:
- //
- // ```dart
- // enum E {
- // [!e!]();
- //
- // factory E() => e;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use a generative constructor marked as `const`:
- //
- // ```dart
- // enum E {
- // e._();
- //
- // factory E() => e;
- //
- // const E._();
- // }
- // ```
static const CompileTimeErrorCode ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR =
CompileTimeErrorCode(
'ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR',
@@ -3861,50 +1160,6 @@
correctionMessage: "Try using different bounds for type parameters.",
);
- // #### Description
- //
- // The analyzer produces this diagnostic when a mixin that's applied to an
- // enum declares one or more instance variables. This isn't allowed because
- // the enum constants are constant, and there isn't any way for the
- // constructor in the enum to initialize any of the mixin's fields.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the mixin `M` defines
- // the instance field `x`:
- //
- // ```dart
- // mixin M {
- // int x = 0;
- // }
- //
- // enum E with [!M!] {
- // a
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you need to apply the mixin, then change all instance fields into
- // getter and setter pairs and implement them in the enum if necessary:
- //
- // ```dart
- // mixin M {
- // int get x => 0;
- // }
- //
- // enum E with M {
- // a
- // }
- // ```
- //
- // If you don't need to apply the mixin, then remove it:
- //
- // ```dart
- // enum E {
- // a
- // }
- // ```
static const CompileTimeErrorCode ENUM_MIXIN_WITH_INSTANCE_VARIABLE =
CompileTimeErrorCode(
'ENUM_MIXIN_WITH_INSTANCE_VARIABLE',
@@ -3913,41 +1168,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the abstract method
- * 1: the name of the enclosing enum
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a member of an enum is found
- // that doesn't have a concrete implementation. Enums aren't allowed to
- // contain abstract members.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `m` is an abstract
- // method and `E` is an enum:
- //
- // ```dart
- // enum E {
- // e;
- //
- // [!void m();!]
- // }
- // ```
- //
- // #### Common fixes
- //
- // Provide an implementation for the member:
- //
- // ```dart
- // enum E {
- // e;
- //
- // void m() {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the abstract method
+ /// 1: the name of the enclosing enum
static const CompileTimeErrorCode ENUM_WITH_ABSTRACT_MEMBER =
CompileTimeErrorCode(
'ENUM_WITH_ABSTRACT_MEMBER',
@@ -3956,26 +1179,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when an enum is declared to have the
- // name `values`. This isn't allowed because the enum has an implicit static
- // field named `values`, and the two would collide.
- //
- // #### Example
- //
- // The following code produces this diagnostic because there's an enum
- // declaration that has the name `values`:
- //
- // ```dart
- // enum [!values!] {
- // c
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rename the enum to something other than `values`.
static const CompileTimeErrorCode ENUM_WITH_NAME_VALUES =
CompileTimeErrorCode(
'ENUM_WITH_NAME_VALUES',
@@ -3984,35 +1187,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when two elements in a constant set
- // literal have the same value. The set can only contain each value once,
- // which means that one of the values is unnecessary.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the string `'a'` is
- // specified twice:
- //
- // ```dart
- // const Set<String> set = {'a', [!'a'!]};
- // ```
- //
- // #### Common fixes
- //
- // Remove one of the duplicate values:
- //
- // ```dart
- // const Set<String> set = {'a'};
- // ```
- //
- // Note that literal sets preserve the order of their elements, so the choice
- // of which element to remove might affect the order in which elements are
- // returned by an iterator.
+ /// No parameters.
static const CompileTimeErrorCode EQUAL_ELEMENTS_IN_CONST_SET =
CompileTimeErrorCode(
'EQUAL_ELEMENTS_IN_CONST_SET',
@@ -4021,44 +1196,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a key in a constant map is the
- // same as a previous key in the same map. If two keys are the same, then the
- // second value would overwrite the first value, which makes having both pairs
- // pointless.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the key `1` is used
- // twice:
- //
- // ```dart
- // const map = <int, String>{1: 'a', 2: 'b', [!1!]: 'c', 4: 'd'};
- // ```
- //
- // #### Common fixes
- //
- // If both entries should be included in the map, then change one of the keys
- // to be different:
- //
- // ```dart
- // const map = <int, String>{1: 'a', 2: 'b', 3: 'c', 4: 'd'};
- // ```
- //
- // If only one of the entries is needed, then remove the one that isn't
- // needed:
- //
- // ```dart
- // const map = <int, String>{1: 'a', 2: 'b', 4: 'd'};
- // ```
- //
- // Note that literal maps preserve the order of their entries, so the choice
- // of which entry to remove might affect the order in which keys and values
- // are returned by an iterator.
+ /// No parameters.
static const CompileTimeErrorCode EQUAL_KEYS_IN_CONST_MAP =
CompileTimeErrorCode(
'EQUAL_KEYS_IN_CONST_MAP',
@@ -4067,31 +1205,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the number of provided type arguments
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a list literal has more than one
- // type argument.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the list literal has
- // two type arguments when it can have at most one:
- //
- // ```dart
- // var l = [!<int, int>!][];
- // ```
- //
- // #### Common fixes
- //
- // Remove all except one of the type arguments:
- //
- // ```dart
- // var l = <int>[];
- // ```
+ /// Parameters:
+ /// 0: the number of provided type arguments
static const CompileTimeErrorCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS =
CompileTimeErrorCode(
'EXPECTED_ONE_LIST_TYPE_ARGUMENTS',
@@ -4100,31 +1215,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the number of provided type arguments
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a set literal has more than one
- // type argument.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the set literal has
- // three type arguments when it can have at most one:
- //
- // ```dart
- // var s = [!<int, String, int>!]{0, 'a', 1};
- // ```
- //
- // #### Common fixes
- //
- // Remove all except one of the type arguments:
- //
- // ```dart
- // var s = <int>{0, 1};
- // ```
+ /// Parameters:
+ /// 0: the number of provided type arguments
static const CompileTimeErrorCode EXPECTED_ONE_SET_TYPE_ARGUMENTS =
CompileTimeErrorCode(
'EXPECTED_ONE_SET_TYPE_ARGUMENTS',
@@ -4133,31 +1225,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the number of provided type arguments
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a map literal has either one or
- // more than two type arguments.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the map literal has
- // three type arguments when it can have either two or zero:
- //
- // ```dart
- // var m = [!<int, String, int>!]{};
- // ```
- //
- // #### Common fixes
- //
- // Remove all except two of the type arguments:
- //
- // ```dart
- // var m = <int, String>{};
- // ```
+ /// Parameters:
+ /// 0: the number of provided type arguments
static const CompileTimeErrorCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS =
CompileTimeErrorCode(
'EXPECTED_TWO_MAP_TYPE_ARGUMENTS',
@@ -4166,27 +1235,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the uri pointing to a library
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds an export whose `dart:`
- // URI references an internal library.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `_interceptors` is an
- // internal library:
- //
- // ```dart
- // export [!'dart:_interceptors'!];
- // ```
- //
- // #### Common fixes
- //
- // Remove the export directive.
+ /// Parameters:
+ /// 0: the uri pointing to a library
static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY =
CompileTimeErrorCode(
'EXPORT_INTERNAL_LIBRARY',
@@ -4194,55 +1244,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of a symbol defined in a legacy library
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library that was opted in to
- // null safety exports another library, and the exported library is opted out
- // of null safety.
- //
- // #### Example
- //
- // Given a library that is opted out of null safety:
- //
- // ```dart
- // %uri="lib/optedOut.dart"
- // // @dart = 2.8
- // String s;
- // ```
- //
- // The following code produces this diagnostic because it's exporting symbols
- // from an opted-out library:
- //
- // ```dart
- // export [!'optedOut.dart'!];
- //
- // class C {}
- // ```
- //
- // #### Common fixes
- //
- // If you're able to do so, migrate the exported library so that it doesn't
- // need to opt out:
- //
- // ```dart
- // String? s;
- // ```
- //
- // If you can't migrate the library, then remove the export:
- //
- // ```dart
- // class C {}
- // ```
- //
- // If the exported library (the one that is opted out) itself exports an
- // opted-in library, then it's valid for your library to indirectly export the
- // symbols from the opted-in library. You can do so by adding a hide
- // combinator to the export directive in your library that hides all of the
- // names declared in the opted-out library.
+ /// Parameters:
+ /// 0: the name of a symbol defined in a legacy library
static const CompileTimeErrorCode EXPORT_LEGACY_SYMBOL = CompileTimeErrorCode(
'EXPORT_LEGACY_SYMBOL',
"The symbol '{0}' is defined in a legacy library, and can't be re-exported "
@@ -4252,37 +1255,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the uri pointing to a non-library declaration
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an export directive references a
- // part rather than a library.
- //
- // #### Example
- //
- // Given a file named `part.dart` containing
- //
- // ```dart
- // %uri="lib/part.dart"
- // part of lib;
- // ```
- //
- // The following code produces this diagnostic because the file `part.dart` is
- // a part, and only libraries can be exported:
- //
- // ```dart
- // library lib;
- //
- // export [!'part.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // Either remove the export directive, or change the URI to be the URI of the
- // library containing the part.
+ /// Parameters:
+ /// 0: the uri pointing to a non-library declaration
static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY =
CompileTimeErrorCode(
'EXPORT_OF_NON_LIBRARY',
@@ -4291,31 +1265,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the analyzer finds an
- // expression, rather than a map entry, in what appears to be a map literal.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // var map = <String, int>{'a': 0, 'b': 1, [!'c'!]};
- // ```
- //
- // #### Common fixes
- //
- // If the expression is intended to compute either a key or a value in an
- // entry, fix the issue by replacing the expression with the key or the value.
- // For example:
- //
- // ```dart
- // var map = <String, int>{'a': 0, 'b': 1, 'c': 2};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode EXPRESSION_IN_MAP = CompileTimeErrorCode(
'EXPRESSION_IN_MAP',
"Expressions can't be used in a map literal.",
@@ -4324,48 +1274,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type (class or mixin) is a
- // subtype of a class from a library being imported using a deferred import.
- // The supertypes of a type must be compiled at the same time as the type, and
- // classes from deferred libraries aren't compiled until the library is
- // loaded.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // Given a file (`a.dart`) that defines the class `A`:
- //
- // ```dart
- // %uri="lib/a.dart"
- // class A {}
- // ```
- //
- // The following code produces this diagnostic because the superclass of `B`
- // is declared in a deferred library:
- //
- // ```dart
- // import 'a.dart' deferred as a;
- //
- // class B extends [!a.A!] {}
- // ```
- //
- // #### Common fixes
- //
- // If you need to create a subtype of a type from the deferred library, then
- // remove the `deferred` keyword:
- //
- // ```dart
- // import 'a.dart' as a;
- //
- // class B extends a.A {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS =
CompileTimeErrorCode(
'SUBTYPE_OF_DEFERRED_CLASS',
@@ -4377,62 +1286,8 @@
uniqueName: 'EXTENDS_DEFERRED_CLASS',
);
- /**
- * Parameters:
- * 0: the name of the disallowed type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when one of the restricted classes is
- // used in either an `extends`, `implements`, `with`, or `on` clause. The
- // classes `bool`, `double`, `FutureOr`, `int`, `Null`, `num`, and `String`
- // are all restricted in this way, to allow for more efficient
- // implementations.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `String` is used in an
- // `extends` clause:
- //
- // ```dart
- // class A extends [!String!] {}
- // ```
- //
- // The following code produces this diagnostic because `String` is used in an
- // `implements` clause:
- //
- // ```dart
- // class B implements [!String!] {}
- // ```
- //
- // The following code produces this diagnostic because `String` is used in a
- // `with` clause:
- //
- // ```dart
- // class C with [!String!] {}
- // ```
- //
- // The following code produces this diagnostic because `String` is used in an
- // `on` clause:
- //
- // ```dart
- // mixin M on [!String!] {}
- // ```
- //
- // #### Common fixes
- //
- // If a different type should be specified, then replace the type:
- //
- // ```dart
- // class A extends Object {}
- // ```
- //
- // If there isn't a different type that would be appropriate, then remove the
- // type, and possibly the whole clause:
- //
- // ```dart
- // class B {}
- // ```
+ /// Parameters:
+ /// 0: the name of the disallowed type
static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS =
CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
@@ -4444,46 +1299,8 @@
uniqueName: 'EXTENDS_DISALLOWED_CLASS',
);
- /**
- * Parameters:
- * 0: the name in the extends clause
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an `extends` clause contains a
- // name that is declared to be something other than a class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is declared to be a
- // function:
- //
- // ```dart
- // void f() {}
- //
- // class C extends [!f!] {}
- // ```
- //
- // #### Common fixes
- //
- // If you want the class to extend a class other than `Object`, then replace
- // the name in the `extends` clause with the name of that class:
- //
- // ```dart
- // void f() {}
- //
- // class C extends B {}
- //
- // class B {}
- // ```
- //
- // If you want the class to extend `Object`, then remove the `extends` clause:
- //
- // ```dart
- // void f() {}
- //
- // class C {}
- // ```
+ /// Parameters:
+ /// 0: the name in the extends clause
static const CompileTimeErrorCode EXTENDS_NON_CLASS = CompileTimeErrorCode(
'EXTENDS_NON_CLASS',
"Classes can only extend other classes.",
@@ -4494,36 +1311,7 @@
isUnresolvedIdentifier: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type alias that expands to a
- // type parameter is used in an `extends`, `implements`, `with`, or `on`
- // clause.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type alias `T`,
- // which expands to the type parameter `S`, is used in the `extends` clause of
- // the class `C`:
- //
- // ```dart
- // typedef T<S> = S;
- //
- // class C extends [!T!]<Object> {}
- // ```
- //
- // #### Common fixes
- //
- // Use the value of the type argument directly:
- //
- // ```dart
- // typedef T<S> = S;
- //
- // class C extends Object {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
EXTENDS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
@@ -4536,43 +1324,8 @@
uniqueName: 'EXTENDS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
);
- /**
- * Parameters:
- * 0: the name of the extension
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name of an extension is used
- // in an expression other than in an extension override or to qualify an
- // access to a static member of the extension. Because classes define a type,
- // the name of a class can be used to refer to the instance of `Type`
- // representing the type of the class. Extensions, on the other hand, don't
- // define a type and can't be used as a type literal.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `E` is an extension:
- //
- // ```dart
- // extension E on int {
- // static String m() => '';
- // }
- //
- // var x = [!E!];
- // ```
- //
- // #### Common fixes
- //
- // Replace the name of the extension with a name that can be referenced, such
- // as a static member defined on the extension:
- //
- // ```dart
- // extension E on int {
- // static String m() => '';
- // }
- //
- // var x = E.m();
- // ```
+ /// Parameters:
+ /// 0: the name of the extension
static const CompileTimeErrorCode EXTENSION_AS_EXPRESSION =
CompileTimeErrorCode(
'EXTENSION_AS_EXPRESSION',
@@ -4581,40 +1334,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the conflicting static member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension declaration
- // contains both an instance member and a static member that have the same
- // name. The instance member and the static member can't have the same name
- // because it's unclear which member is being referenced by an unqualified use
- // of the name within the body of the extension.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `a` is being
- // used for two different members:
- //
- // ```dart
- // extension E on Object {
- // int get a => 0;
- // static int [!a!]() => 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rename or remove one of the members:
- //
- // ```dart
- // extension E on Object {
- // int get a => 0;
- // static int b() => 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the conflicting static member
static const CompileTimeErrorCode EXTENSION_CONFLICTING_STATIC_AND_INSTANCE =
CompileTimeErrorCode(
'EXTENSION_CONFLICTING_STATIC_AND_INSTANCE',
@@ -4625,37 +1346,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension declaration
- // declares a member with the same name as a member declared in the class
- // `Object`. Such a member can never be used because the member in `Object` is
- // always found first.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `toString` is defined
- // by `Object`:
- //
- // ```dart
- // extension E on String {
- // String [!toString!]() => this;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the member or rename it so that the name doesn't conflict with the
- // member in `Object`:
- //
- // ```dart
- // extension E on String {
- // String displayString() => this;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode EXTENSION_DECLARES_MEMBER_OF_OBJECT =
CompileTimeErrorCode(
'EXTENSION_DECLARES_MEMBER_OF_OBJECT',
@@ -4665,43 +1356,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override is the
- // receiver of the invocation of a static member. Similar to static members in
- // classes, the static members of an extension should be accessed using the
- // name of the extension, not an extension override.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `m` is static:
- //
- // ```dart
- // extension E on String {
- // static void m() {}
- // }
- //
- // void f() {
- // E('').[!m!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the extension override with the name of the extension:
- //
- // ```dart
- // extension E on String {
- // static void m() {}
- // }
- //
- // void f() {
- // E.m();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode EXTENSION_OVERRIDE_ACCESS_TO_STATIC_MEMBER =
CompileTimeErrorCode(
'EXTENSION_OVERRIDE_ACCESS_TO_STATIC_MEMBER',
@@ -4711,48 +1366,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the argument
- * 1: the extended type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the argument to an extension
- // override isn't assignable to the type being extended by the extension.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `3` isn't a `String`:
- //
- // ```dart
- // extension E on String {
- // void method() {}
- // }
- //
- // void f() {
- // E([!3!]).method();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you're using the correct extension, then update the argument to have the
- // correct type:
- //
- // ```dart
- // extension E on String {
- // void method() {}
- // }
- //
- // void f() {
- // E(3.toString()).method();
- // }
- // ```
- //
- // If there's a different extension that's valid for the type of the argument,
- // then either replace the name of the extension or unwrap the argument so
- // that the correct extension is found.
+ /// Parameters:
+ /// 0: the type of the argument
+ /// 1: the extended type
static const CompileTimeErrorCode EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE',
@@ -4761,57 +1377,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override is found
- // that isn't being used to access one of the members of the extension. The
- // extension override syntax doesn't have any runtime semantics; it only
- // controls which member is selected at compile time.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `E(i)` isn't an
- // expression:
- //
- // ```dart
- // extension E on int {
- // int get a => 0;
- // }
- //
- // void f(int i) {
- // print([!E(i)!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you want to invoke one of the members of the extension, then add the
- // invocation:
- //
- // ```dart
- // extension E on int {
- // int get a => 0;
- // }
- //
- // void f(int i) {
- // print(E(i).a);
- // }
- // ```
- //
- // If you don't want to invoke a member, then unwrap the argument:
- //
- // ```dart
- // extension E on int {
- // int get a => 0;
- // }
- //
- // void f(int i) {
- // print(i);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode EXTENSION_OVERRIDE_WITHOUT_ACCESS =
CompileTimeErrorCode(
'EXTENSION_OVERRIDE_WITHOUT_ACCESS',
@@ -4820,45 +1386,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override is used as
- // the receiver of a cascade expression. The value of a cascade expression
- // `e..m` is the value of the receiver `e`, but extension overrides aren't
- // expressions and don't have a value.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `E(3)` isn't an
- // expression:
- //
- // ```dart
- // extension E on int {
- // void m() {}
- // }
- // f() {
- // [!E!](3)..m();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use `.` rather than `..`:
- //
- // ```dart
- // extension E on int {
- // void m() {}
- // }
- // f() {
- // E(3).m();
- // }
- // ```
- //
- // If there are multiple cascaded accesses, you'll need to duplicate the
- // extension override for each one.
+ /// No parameters.
static const CompileTimeErrorCode EXTENSION_OVERRIDE_WITH_CASCADE =
CompileTimeErrorCode(
'EXTENSION_OVERRIDE_WITH_CASCADE',
@@ -4868,49 +1396,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when a field or variable marked with
- // the keyword `external` has an initializer, or when an external field is
- // initialized in a constructor.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the external field `x`
- // is assigned a value in an initializer:
- //
- // ```dart
- // class C {
- // external int x;
- // C() : [!x!] = 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the external field `x`
- // has an initializer:
- //
- // ```dart
- // class C {
- // external final int [!x!] = 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the external top level
- // variable `x` has an initializer:
- //
- // ```dart
- // external final int [!x!] = 0;
- // ```
- //
- // #### Common fixes
- //
- // Remove the initializer:
- //
- // ```dart
- // class C {
- // external final int x;
- // }
- // ```
static const CompileTimeErrorCode EXTERNAL_FIELD_CONSTRUCTOR_INITIALIZER =
CompileTimeErrorCode(
'EXTERNAL_WITH_INITIALIZER',
@@ -4942,38 +1427,9 @@
uniqueName: 'EXTERNAL_VARIABLE_INITIALIZER',
);
- /**
- * Parameters:
- * 0: the maximum number of positional arguments
- * 1: the actual number of positional arguments given
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function invocation
- // has more positional arguments than the method or function allows.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` defines 2
- // parameters but is invoked with 3 arguments:
- //
- // ```dart
- // void f(int a, int b) {}
- // void g() {
- // f(1, 2, [!3!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the arguments that don't correspond to parameters:
- //
- // ```dart
- // void f(int a, int b) {}
- // void g() {
- // f(1, 2);
- // }
- // ```
+ /// Parameters:
+ /// 0: the maximum number of positional arguments
+ /// 1: the actual number of positional arguments given
static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS =
CompileTimeErrorCode(
'EXTRA_POSITIONAL_ARGUMENTS',
@@ -4982,54 +1438,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the maximum number of positional arguments
- * 1: the actual number of positional arguments given
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function invocation
- // has more positional arguments than the method or function allows, but the
- // method or function defines named parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` defines 2
- // positional parameters but has a named parameter that could be used for the
- // third argument:
- //
- // ```dart
- // %language=2.9
- // void f(int a, int b, {int c}) {}
- // void g() {
- // f(1, 2, [!3!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If some of the arguments should be values for named parameters, then add
- // the names before the arguments:
- //
- // ```dart
- // %language=2.9
- // void f(int a, int b, {int c}) {}
- // void g() {
- // f(1, 2, c: 3);
- // }
- // ```
- //
- // Otherwise, remove the arguments that don't correspond to positional
- // parameters:
- //
- // ```dart
- // %language=2.9
- // void f(int a, int b, {int c}) {}
- // void g() {
- // f(1, 2);
- // }
- // ```
+ /// Parameters:
+ /// 0: the maximum number of positional arguments
+ /// 1: the actual number of positional arguments given
static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED =
CompileTimeErrorCode(
'EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED',
@@ -5040,40 +1451,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the field being initialized multiple times
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the initializer list of a
- // constructor initializes a field more than once. There is no value to allow
- // both initializers because only the last value is preserved.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `f` is being
- // initialized twice:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C() : f = 0, [!f!] = 1;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove one of the initializers:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C() : f = 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the field being initialized multiple times
static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS =
CompileTimeErrorCode(
'FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS',
@@ -5082,50 +1461,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a final field is initialized in
- // both the declaration of the field and in an initializer in a constructor.
- // Final fields can only be assigned once, so it can't be initialized in both
- // places.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is :
- //
- // ```dart
- // class C {
- // final int f = 0;
- // C() : [!f!] = 1;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the initialization doesn't depend on any values passed to the
- // constructor, and if all of the constructors need to initialize the field to
- // the same value, then remove the initializer from the constructor:
- //
- // ```dart
- // class C {
- // final int f = 0;
- // C();
- // }
- // ```
- //
- // If the initialization depends on a value passed to the constructor, or if
- // different constructors need to initialize the field differently, then
- // remove the initializer in the field's declaration:
- //
- // ```dart
- // class C {
- // final int f;
- // C() : f = 1;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = CompileTimeErrorCode(
'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION',
@@ -5135,62 +1471,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field is initialized in both
- // the parameter list and in the initializer list of a constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `f` is
- // initialized both by an initializing formal parameter and in the
- // initializer list:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f) : [!f!] = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field should be initialized by the parameter, then remove the
- // initialization in the initializer list:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f);
- // }
- // ```
- //
- // If the field should be initialized in the initializer list and the
- // parameter isn't needed, then remove the parameter:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C() : f = 0;
- // }
- // ```
- //
- // If the field should be initialized in the initializer list and the
- // parameter is needed, then make it a normal parameter:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(int g) : f = g * 2;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = CompileTimeErrorCode(
'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER',
@@ -5200,39 +1481,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a factory constructor has an
- // initializing formal parameter. Factory constructors can't assign values to
- // fields because no instance is created; hence, there is no field to assign.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the factory constructor
- // uses an initializing formal parameter:
- //
- // ```dart
- // class C {
- // int? f;
- //
- // factory C([!this.f!]) => throw 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the initializing formal parameter with a normal parameter:
- //
- // ```dart
- // class C {
- // int? f;
- //
- // factory C(int f) => throw 0;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR =
CompileTimeErrorCode(
'FIELD_INITIALIZER_FACTORY_CONSTRUCTOR',
@@ -5241,53 +1490,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type of the initializer expression
- * 1: the name of the type of the field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the initializer list of a
- // constructor initializes a field to a value that isn't assignable to the
- // field.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `0` has the type `int`,
- // and an `int` can't be assigned to a field of type `String`:
- //
- // ```dart
- // class C {
- // String s;
- //
- // C() : s = [!0!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the field is correct, then change the value assigned to it
- // so that the value has a valid type:
- //
- // ```dart
- // class C {
- // String s;
- //
- // C() : s = '0';
- // }
- // ```
- //
- // If the type of the value is correct, then change the type of the field to
- // allow the assignment:
- //
- // ```dart
- // class C {
- // int s;
- //
- // C() : s = 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the type of the initializer expression
+ /// 1: the name of the type of the field
static const CompileTimeErrorCode FIELD_INITIALIZER_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'FIELD_INITIALIZER_NOT_ASSIGNABLE',
@@ -5295,42 +1500,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an initializing formal
- // parameter is used in the parameter list for anything other than a
- // constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the initializing
- // formal parameter `this.x` is being used in the method `m`:
- //
- // ```dart
- // class A {
- // int x = 0;
- //
- // m([[!this.x!] = 0]) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the initializing formal parameter with a normal parameter and
- // assign the field within the body of the method:
- //
- // ```dart
- // class A {
- // int x = 0;
- //
- // m([int x = 0]) {
- // this.x = x;
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR =
CompileTimeErrorCode(
'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR',
@@ -5339,73 +1509,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a redirecting constructor
- // initializes a field in the object. This isn't allowed because the instance
- // that has the field hasn't been created at the point at which it should be
- // initialized.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the constructor
- // `C.zero`, which redirects to the constructor `C`, has an initializing
- // formal parameter that initializes the field `f`:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f);
- //
- // C.zero([!this.f!]) : this(f);
- // }
- // ```
- //
- // The following code produces this diagnostic because the constructor
- // `C.zero`, which redirects to the constructor `C`, has an initializer that
- // initializes the field `f`:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f);
- //
- // C.zero() : [!f = 0!], this(1);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the initialization is done by an initializing formal parameter, then
- // use a normal parameter:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f);
- //
- // C.zero(int f) : this(f);
- // }
- // ```
- //
- // If the initialization is done in an initializer, then remove the
- // initializer:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f);
- //
- // C.zero() : this(0);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR =
CompileTimeErrorCode(
'FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR',
@@ -5415,68 +1519,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type of the field formal parameter
- * 1: the name of the type of the field
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type of an initializing
- // formal parameter isn't assignable to the type of the field being
- // initialized.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the initializing
- // formal parameter has the type `String`, but the type of the field is
- // `int`. The parameter must have a type that is a subtype of the field's
- // type.
- //
- // ```dart
- // class C {
- // int f;
- //
- // C([!String this.f!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the field is incorrect, then change the type of the field to
- // match the type of the parameter, and consider removing the type from the
- // parameter:
- //
- // ```dart
- // class C {
- // String f;
- //
- // C(this.f);
- // }
- // ```
- //
- // If the type of the parameter is incorrect, then remove the type of the
- // parameter:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(this.f);
- // }
- // ```
- //
- // If the types of both the field and the parameter are correct, then use an
- // initializer rather than an initializing formal parameter to convert the
- // parameter value into a value of the correct type:
- //
- // ```dart
- // class C {
- // int f;
- //
- // C(String s) : f = int.parse(s);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the type of the field formal parameter
+ /// 1: the name of the type of the field
static const CompileTimeErrorCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE',
@@ -5487,51 +1532,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the field in question
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a final field is initialized
- // twice: once where it's declared and once by a constructor's parameter.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `f` is
- // initialized twice:
- //
- // ```dart
- // class C {
- // final int f = 0;
- //
- // C(this.[!f!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field should have the same value for all instances, then remove the
- // initialization in the parameter list:
- //
- // ```dart
- // class C {
- // final int f = 0;
- //
- // C();
- // }
- // ```
- //
- // If the field can have different values in different instances, then remove
- // the initialization in the declaration:
- //
- // ```dart
- // class C {
- // final int f;
- //
- // C(this.f);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the field in question
static const CompileTimeErrorCode
FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = CompileTimeErrorCode(
'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR',
@@ -5541,52 +1543,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the uninitialized final variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a final field or variable isn't
- // initialized.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` doesn't have an
- // initializer:
- //
- // ```dart
- // final [!x!];
- // ```
- //
- // #### Common fixes
- //
- // For variables and static fields, you can add an initializer:
- //
- // ```dart
- // final x = 0;
- // ```
- //
- // For instance fields, you can add an initializer as shown in the previous
- // example, or you can initialize the field in every constructor. You can
- // initialize the field by using an initializing formal parameter:
- //
- // ```dart
- // class C {
- // final int x;
- // C(this.x);
- // }
- // ```
- //
- // You can also initialize the field by using an initializer in the
- // constructor:
- //
- // ```dart
- // class C {
- // final int x;
- // C(int y) : x = y * 2;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the uninitialized final variable
static const CompileTimeErrorCode FINAL_NOT_INITIALIZED =
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED',
@@ -5595,91 +1553,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the uninitialized final variable
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class defines one or more
- // final instance fields without initializers and has at least one constructor
- // that doesn't initialize those fields. All final instance fields must be
- // initialized when the instance is created, either by the field's initializer
- // or by the constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // class C {
- // final String value;
- //
- // [!C!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the value should be passed in to the constructor directly, then use an
- // initializing formal parameter to initialize the field `value`:
- //
- // ```dart
- // class C {
- // final String value;
- //
- // C(this.value);
- // }
- // ```
- //
- // If the value should be computed indirectly from a value provided by the
- // caller, then add a parameter and include an initializer:
- //
- // ```dart
- // class C {
- // final String value;
- //
- // C(Object o) : value = o.toString();
- // }
- // ```
- //
- // If the value of the field doesn't depend on values that can be passed to
- // the constructor, then add an initializer for the field as part of the field
- // declaration:
- //
- // ```dart
- // class C {
- // final String value = '';
- //
- // C();
- // }
- // ```
- //
- // If the value of the field doesn't depend on values that can be passed to
- // the constructor but different constructors need to initialize it to
- // different values, then add an initializer for the field in the initializer
- // list:
- //
- // ```dart
- // class C {
- // final String value;
- //
- // C() : value = '';
- //
- // C.named() : value = 'c';
- // }
- // ```
- //
- // However, if the value is the same for all instances, then consider using a
- // static field instead of an instance field:
- //
- // ```dart
- // class C {
- // static const String value = '';
- //
- // C();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the uninitialized final variable
static const CompileTimeErrorCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_1 =
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR',
@@ -5689,11 +1564,9 @@
uniqueName: 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_1',
);
- /**
- * Parameters:
- * 0: the name of the uninitialized final variable
- * 1: the name of the uninitialized final variable
- */
+ /// Parameters:
+ /// 0: the name of the uninitialized final variable
+ /// 1: the name of the uninitialized final variable
static const CompileTimeErrorCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_2 =
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR',
@@ -5703,12 +1576,10 @@
uniqueName: 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_2',
);
- /**
- * Parameters:
- * 0: the name of the uninitialized final variable
- * 1: the name of the uninitialized final variable
- * 2: the number of additional not initialized variables that aren't listed
- */
+ /// Parameters:
+ /// 0: the name of the uninitialized final variable
+ /// 1: the name of the uninitialized final variable
+ /// 2: the number of additional not initialized variables that aren't listed
static const CompileTimeErrorCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS =
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR',
@@ -5719,55 +1590,10 @@
uniqueName: 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS',
);
- /**
- * Parameters:
- * 0: the type of the iterable expression.
- * 1: the sequence type -- Iterable for `for` or Stream for `await for`.
- * 2: the loop variable type.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the `Iterable` or `Stream` in a
- // for-in loop has an element type that can't be assigned to the loop
- // variable.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `<String>[]` has an
- // element type of `String`, and `String` can't be assigned to the type of `e`
- // (`int`):
- //
- // ```dart
- // void f() {
- // for (int e in [!<String>[]!]) {
- // print(e);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the loop variable is correct, then update the type of the
- // iterable:
- //
- // ```dart
- // void f() {
- // for (int e in <int>[]) {
- // print(e);
- // }
- // }
- // ```
- //
- // If the type of the iterable is correct, then update the type of the loop
- // variable:
- //
- // ```dart
- // void f() {
- // for (String e in <String>[]) {
- // print(e);
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the iterable expression.
+ /// 1: the sequence type -- Iterable for `for` or Stream for `await for`.
+ /// 2: the loop variable type.
static const CompileTimeErrorCode FOR_IN_OF_INVALID_ELEMENT_TYPE =
CompileTimeErrorCode(
'FOR_IN_OF_INVALID_ELEMENT_TYPE',
@@ -5776,40 +1602,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the iterable expression.
- * 1: the sequence type -- Iterable for `for` or Stream for `await for`.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the expression following `in` in
- // a for-in loop has a type that isn't a subclass of `Iterable`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `m` is a `Map`, and
- // `Map` isn't a subclass of `Iterable`:
- //
- // ```dart
- // void f(Map<String, String> m) {
- // for (String s in [!m!]) {
- // print(s);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the expression with one that produces an iterable value:
- //
- // ```dart
- // void f(Map<String, String> m) {
- // for (String s in m.values) {
- // print(s);
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the iterable expression.
+ /// 1: the sequence type -- Iterable for `for` or Stream for `await for`.
static const CompileTimeErrorCode FOR_IN_OF_INVALID_TYPE =
CompileTimeErrorCode(
'FOR_IN_OF_INVALID_TYPE',
@@ -5817,43 +1612,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the loop variable declared in a
- // for-in loop is declared to be a `const`. The variable can't be a `const`
- // because the value can't be computed at compile time.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the loop variable `x`
- // is declared to be a `const`:
- //
- // ```dart
- // void f() {
- // for ([!const!] x in [0, 1, 2]) {
- // print(x);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there's a type annotation, then remove the `const` modifier from the
- // declaration.
- //
- // If there's no type, then replace the `const` modifier with `final`, `var`,
- // or a type annotation:
- //
- // ```dart
- // void f() {
- // for (final x in [0, 1, 2]) {
- // print(x);
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode FOR_IN_WITH_CONST_VARIABLE =
CompileTimeErrorCode(
'FOR_IN_WITH_CONST_VARIABLE',
@@ -5864,10 +1623,8 @@
hasPublishedDocs: true,
);
- /**
- * It is a compile-time error if a generic function type is used as a bound
- * for a formal type parameter of a class or a function.
- */
+ /// It is a compile-time error if a generic function type is used as a bound
+ /// for a formal type parameter of a class or a function.
static const CompileTimeErrorCode GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND =
CompileTimeErrorCode(
'GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND',
@@ -5877,10 +1634,8 @@
"declaration signature",
);
- /**
- * It is a compile-time error if a generic function type is used as an actual
- * type argument.
- */
+ /// It is a compile-time error if a generic function type is used as an actual
+ /// type argument.
static const CompileTimeErrorCode
GENERIC_FUNCTION_TYPE_CANNOT_BE_TYPE_ARGUMENT = CompileTimeErrorCode(
'GENERIC_FUNCTION_TYPE_CANNOT_BE_TYPE_ARGUMENT',
@@ -5890,47 +1645,7 @@
"'dynamic' as the type argument here.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an instance method is being torn
- // off from a receiver whose type is `dynamic`, and the tear-off includes type
- // arguments. Because the analyzer can't know how many type parameters the
- // method has, or whether it has any type parameters, there's no way it can
- // validate that the type arguments are correct. As a result, the type
- // arguments aren't allowed.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of `p` is
- // `dynamic` and the tear-off of `m` has type arguments:
- //
- // ```dart
- // void f(dynamic list) {
- // [!list.fold!]<int>;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you can use a more specific type than `dynamic`, then change the type of
- // the receiver:
- //
- // ```dart
- // void f(List<Object> list) {
- // list.fold<int>;
- // }
- // ```
- //
- // If you can't use a more specific type, then remove the type arguments:
- //
- // ```dart
- // void f(dynamic list) {
- // list.cast;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC = CompileTimeErrorCode(
'GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC',
@@ -5942,13 +1657,11 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the getter
- * 1: the type of the getter
- * 2: the type of the setter
- * 3: the name of the setter
- */
+ /// Parameters:
+ /// 0: the name of the getter
+ /// 1: the type of the getter
+ /// 2: the type of the setter
+ /// 3: the name of the setter
static const CompileTimeErrorCode GETTER_NOT_ASSIGNABLE_SETTER_TYPES =
CompileTimeErrorCode(
'GETTER_NOT_ASSIGNABLE_SETTER_TYPES',
@@ -5957,57 +1670,11 @@
correctionMessage: "Try changing the types so that they are compatible.",
);
- /**
- * Parameters:
- * 0: the name of the getter
- * 1: the type of the getter
- * 2: the type of the setter
- * 3: the name of the setter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the return type of a getter
- // isn't a subtype of the type of the parameter of a setter with the same
- // name.
- //
- // The subtype relationship is a requirement whether the getter and setter are
- // in the same class or whether one of them is in a superclass of the other.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the return type of the
- // getter `x` is `num`, the parameter type of the setter `x` is `int`, and
- // `num` isn't a subtype of `int`:
- //
- // ```dart
- // class C {
- // num get [!x!] => 0;
- //
- // set x(int y) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the getter is correct, then change the type of the setter:
- //
- // ```dart
- // class C {
- // num get x => 0;
- //
- // set x(num y) {}
- // }
- // ```
- //
- // If the type of the setter is correct, then change the type of the getter:
- //
- // ```dart
- // class C {
- // int get x => 0;
- //
- // set x(int y) {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the getter
+ /// 1: the type of the getter
+ /// 2: the type of the setter
+ /// 3: the name of the setter
static const CompileTimeErrorCode GETTER_NOT_SUBTYPE_SETTER_TYPES =
CompileTimeErrorCode(
'GETTER_NOT_SUBTYPE_SETTER_TYPES',
@@ -6025,39 +1692,7 @@
correctionMessage: "Try making the deferred import non-deferred.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the body of a function has the
- // `async*` modifier even though the return type of the function isn't either
- // `Stream` or a supertype of `Stream`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of the
- // function `f` has the 'async*' modifier even though the return type `int`
- // isn't a supertype of `Stream`:
- //
- // ```dart
- // [!int!] f() async* {}
- // ```
- //
- // #### Common fixes
- //
- // If the function should be asynchronous, then change the return type to be
- // either `Stream` or a supertype of `Stream`:
- //
- // ```dart
- // Stream<int> f() async* {}
- // ```
- //
- // If the function should be synchronous, then remove the `async*` modifier:
- //
- // ```dart
- // int f() => 0;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE =
CompileTimeErrorCode(
'ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE',
@@ -6069,43 +1704,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the body of a function has the
- // `async` modifier even though the return type of the function isn't
- // assignable to `Future`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of the
- // function `f` has the `async` modifier even though the return type isn't
- // assignable to `Future`:
- //
- // ```dart
- // [!int!] f() async {
- // return 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the function should be asynchronous, then change the return type to be
- // assignable to `Future`:
- //
- // ```dart
- // Future<int> f() async {
- // return 0;
- // }
- // ```
- //
- // If the function should be synchronous, then remove the `async` modifier:
- //
- // ```dart
- // int f() => 0;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ILLEGAL_ASYNC_RETURN_TYPE =
CompileTimeErrorCode(
'ILLEGAL_ASYNC_RETURN_TYPE',
@@ -6116,71 +1715,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of member that cannot be declared
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when either an enum declaration, a
- // class that implements `Enum`, or a mixin with a superclass constraint of
- // `Enum`, declares or inherits a concrete instance member named either
- // `index`, `hashCode`, or `==`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the enum `E` declares
- // an instance getter named `index`:
- //
- // ```dart
- // enum E {
- // v;
- //
- // int get [!index!] => 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the class `C`, which
- // implements `Enum`, declares an instance field named `hashCode`:
- //
- // ```dart
- // abstract class C implements Enum {
- // int [!hashCode!] = 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the class `C`, which
- // indirectly implements `Enum` through the class `A`, declares an instance
- // getter named `hashCode`:
- //
- // ```dart
- // abstract class A implements Enum {}
- //
- // abstract class C implements A {
- // int get [!hashCode!] => 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the mixin `M`, which
- // has `Enum` in the `on` clause, declares an explicit operator named `==`:
- //
- // ```dart
- // mixin M on Enum {
- // bool operator [!==!](Object? other) => false;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rename the conflicting member:
- //
- // ```dart
- // enum E {
- // v;
- //
- // int get getIndex => 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of member that cannot be declared
static const CompileTimeErrorCode ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION =
CompileTimeErrorCode(
'ILLEGAL_CONCRETE_ENUM_MEMBER',
@@ -6191,11 +1727,9 @@
uniqueName: 'ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION',
);
- /**
- * Parameters:
- * 0: the name of member that cannot be inherited
- * 1: the name of the class that declares the member
- */
+ /// Parameters:
+ /// 0: the name of member that cannot be inherited
+ /// 1: the name of the class that declares the member
static const CompileTimeErrorCode ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE =
CompileTimeErrorCode(
'ILLEGAL_CONCRETE_ENUM_MEMBER',
@@ -6206,43 +1740,6 @@
uniqueName: 'ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE',
);
- // #### Description
- //
- // The analyzer produces this diagnostic when either a class that implements
- // `Enum` or a mixin with a superclass constraint of `Enum` has an instance
- // member named `values`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the class `C`, which
- // implements `Enum`, declares an instance field named `values`:
- //
- // ```dart
- // abstract class C implements Enum {
- // int get [!values!] => 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because the class `B`, which
- // implements `Enum`, inherits an instance method named `values` from `A`:
- //
- // ```dart
- // abstract class A {
- // int values() => 0;
- // }
- //
- // abstract class [!B!] extends A implements Enum {}
- // ```
- //
- // #### Common fixes
- //
- // Change the name of the conflicting member:
- //
- // ```dart
- // abstract class C implements Enum {
- // int get value => 0;
- // }
- // ```
static const CompileTimeErrorCode ILLEGAL_ENUM_VALUES_DECLARATION =
CompileTimeErrorCode(
'ILLEGAL_ENUM_VALUES',
@@ -6253,10 +1750,8 @@
uniqueName: 'ILLEGAL_ENUM_VALUES_DECLARATION',
);
- /**
- * Parameters:
- * 0: the name of the class that declares 'values'
- */
+ /// Parameters:
+ /// 0: the name of the class that declares 'values'
static const CompileTimeErrorCode ILLEGAL_ENUM_VALUES_INHERITANCE =
CompileTimeErrorCode(
'ILLEGAL_ENUM_VALUES',
@@ -6275,40 +1770,7 @@
"Try removing the language version override and migrating the code.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the body of a function has the
- // `sync*` modifier even though the return type of the function isn't either
- // `Iterable` or a supertype of `Iterable`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of the
- // function `f` has the 'sync*' modifier even though the return type `int`
- // isn't a supertype of `Iterable`:
- //
- // ```dart
- // [!int!] f() sync* {}
- // ```
- //
- // #### Common fixes
- //
- // If the function should return an iterable, then change the return type to
- // be either `Iterable` or a supertype of `Iterable`:
- //
- // ```dart
- // Iterable<int> f() sync* {}
- // ```
- //
- // If the function should return a single value, then remove the `sync*`
- // modifier:
- //
- // ```dart
- // int f() => 0;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode ILLEGAL_SYNC_GENERATOR_RETURN_TYPE =
CompileTimeErrorCode(
'ILLEGAL_SYNC_GENERATOR_RETURN_TYPE',
@@ -6320,9 +1782,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS =
CompileTimeErrorCode(
'SUBTYPE_OF_DEFERRED_CLASS',
@@ -6334,10 +1794,8 @@
uniqueName: 'IMPLEMENTS_DEFERRED_CLASS',
);
- /**
- * Parameters:
- * 0: the name of the disallowed type
- */
+ /// Parameters:
+ /// 0: the name of the disallowed type
static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS =
CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
@@ -6349,39 +1807,8 @@
uniqueName: 'IMPLEMENTS_DISALLOWED_CLASS',
);
- /**
- * Parameters:
- * 0: the name of the interface that was not found
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name used in the `implements`
- // clause of a class or mixin declaration is defined to be something other
- // than a class or mixin.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` is a variable
- // rather than a class or mixin:
- //
- // ```dart
- // var x;
- // class C implements [!x!] {}
- // ```
- //
- // #### Common fixes
- //
- // If the name is the name of an existing class or mixin that's already being
- // imported, then add a prefix to the import so that the local definition of
- // the name doesn't shadow the imported name.
- //
- // If the name is the name of an existing class or mixin that isn't being
- // imported, then add an import, with a prefix, for the library in which it’s
- // declared.
- //
- // Otherwise, either replace the name in the `implements` clause with the name
- // of an existing class or mixin, or remove the name from the `implements`
- // clause.
+ /// Parameters:
+ /// 0: the name of the interface that was not found
static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = CompileTimeErrorCode(
'IMPLEMENTS_NON_CLASS',
"Classes and mixins can only implement other classes and mixins.",
@@ -6390,33 +1817,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the interface that is implemented more than once
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a single class is specified more
- // than once in an `implements` clause.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A` is in the list
- // twice:
- //
- // ```dart
- // class A {}
- // class B implements A, [!A!] {}
- // ```
- //
- // #### Common fixes
- //
- // Remove all except one occurrence of the class name:
- //
- // ```dart
- // class A {}
- // class B implements A {}
- // ```
+ /// Parameters:
+ /// 0: the name of the interface that is implemented more than once
static const CompileTimeErrorCode IMPLEMENTS_REPEATED = CompileTimeErrorCode(
'IMPLEMENTS_REPEATED',
"'{0}' can only be implemented once.",
@@ -6424,46 +1826,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the class that appears in both "extends" and "implements"
- * clauses
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when one class is listed in both the
- // `extends` and `implements` clauses of another class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `A` is used
- // in both the `extends` and `implements` clauses for the class `B`:
- //
- // ```dart
- // class A {}
- //
- // class B extends A implements [!A!] {}
- // ```
- //
- // #### Common fixes
- //
- // If you want to inherit the implementation from the class, then remove the
- // class from the `implements` clause:
- //
- // ```dart
- // class A {}
- //
- // class B extends A {}
- // ```
- //
- // If you don't want to inherit the implementation from the class, then remove
- // the `extends` clause:
- //
- // ```dart
- // class A {}
- //
- // class B implements A {}
- // ```
+ /// Parameters:
+ /// 0: the name of the class that appears in both "extends" and "implements"
+ /// clauses
static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS =
CompileTimeErrorCode(
'IMPLEMENTS_SUPER_CLASS',
@@ -6472,9 +1837,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
IMPLEMENTS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
@@ -6484,89 +1847,8 @@
uniqueName: 'IMPLEMENTS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
);
- /**
- * Parameters:
- * 0: the name of the superclass
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor implicitly
- // invokes the unnamed constructor from the superclass, the unnamed
- // constructor of the superclass has a required parameter, and there's no
- // super parameter corresponding to the required parameter.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the unnamed
- // constructor in the class `B` implicitly invokes the unnamed constructor in
- // the class `A`, but the constructor in `A` has a required positional
- // parameter named `x`:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // [!B!]();
- // }
- // ```
- //
- // The following code produces this diagnostic because the unnamed
- // constructor in the class `B` implicitly invokes the unnamed constructor in
- // the class `A`, but the constructor in `A` has a required named parameter
- // named `x`:
- //
- // ```dart
- // class A {
- // A({required int x});
- // }
- //
- // class B extends A {
- // [!B!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you can add a parameter to the constructor in the subclass, then add a
- // super parameter corresponding to the required parameter in the superclass'
- // constructor. The new parameter can either be required:
- //
- // ```dart
- // class A {
- // A({required int x});
- // }
- //
- // class B extends A {
- // B({required super.x});
- // }
- // ```
- //
- // or it can be optional:
- //
- // ```dart
- // class A {
- // A({required int x});
- // }
- //
- // class B extends A {
- // B({super.x = 0});
- // }
- // ```
- //
- // If you can't add a parameter to the constructor in the subclass, then add
- // an explicit super constructor invocation with the required argument:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // B() : super(0);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the superclass
static const CompileTimeErrorCode
IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS = CompileTimeErrorCode(
'IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS',
@@ -6577,56 +1859,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the instance member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds a reference to an
- // instance member in a constructor's initializer list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `defaultX` is an
- // instance member:
- //
- // ```dart
- // class C {
- // int x;
- //
- // C() : x = [!defaultX!];
- //
- // int get defaultX => 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the member can be made static, then do so:
- //
- // ```dart
- // class C {
- // int x;
- //
- // C() : x = defaultX;
- //
- // static int get defaultX => 0;
- // }
- // ```
- //
- // If not, then replace the reference in the initializer with a different
- // expression that doesn't use an instance member:
- //
- // ```dart
- // class C {
- // int x;
- //
- // C() : x = 0;
- //
- // int get defaultX => 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the instance member
static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER =
CompileTimeErrorCode(
'IMPLICIT_THIS_REFERENCE_IN_INITIALIZER',
@@ -6637,27 +1871,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the uri pointing to a library
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds an import whose `dart:`
- // URI references an internal library.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `_interceptors` is an
- // internal library:
- //
- // ```dart
- // import [!'dart:_interceptors'!];
- // ```
- //
- // #### Common fixes
- //
- // Remove the import directive.
+ /// Parameters:
+ /// 0: the uri pointing to a library
static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY =
CompileTimeErrorCode(
'IMPORT_INTERNAL_LIBRARY',
@@ -6665,41 +1880,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the uri pointing to a non-library declaration
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a [part file][] is imported
- // into a library.
- //
- // #### Example
- //
- // Given a [part file][] named `part.dart` containing the following:
- //
- // ```dart
- // %uri="lib/part.dart"
- // part of lib;
- //
- // class C{}
- // ```
- //
- // The following code produces this diagnostic because imported files can't
- // have a part-of directive:
- //
- // ```dart
- // library lib;
- //
- // import [!'part.dart'!];
- //
- // C c = C();
- // ```
- //
- // #### Common fixes
- //
- // Import the library that contains the [part file][] rather than the
- // [part file][] itself.
+ /// Parameters:
+ /// 0: the uri pointing to a non-library declaration
static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY =
CompileTimeErrorCode(
'IMPORT_OF_NON_LIBRARY',
@@ -6708,71 +1890,22 @@
hasPublishedDocs: true,
);
- /**
- * 13.9 Switch: It is a compile-time error if values of the expressions
- * <i>e<sub>k</sub></i> are not instances of the same class <i>C</i>, for all
- * <i>1 <= k <= n</i>.
- *
- * Parameters:
- * 0: the expression source code that is the unexpected type
- * 1: the name of the expected type
- */
+ /// 13.9 Switch: It is a compile-time error if values of the expressions
+ /// <i>e<sub>k</sub></i> are not instances of the same class <i>C</i>, for all
+ /// <i>1 <= k <= n</i>.
+ ///
+ /// Parameters:
+ /// 0: the expression source code that is the unexpected type
+ /// 1: the name of the expected type
static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES =
CompileTimeErrorCode(
'INCONSISTENT_CASE_EXPRESSION_TYPES',
"Case expressions must have the same types, '{0}' isn't a '{1}'.",
);
- /**
- * Parameters:
- * 0: the name of the instance member with inconsistent inheritance.
- * 1: the list of all inherited signatures for this member.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class inherits two or more
- // conflicting signatures for a member and doesn't provide an implementation
- // that satisfies all the inherited signatures.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `C` is inheriting the
- // declaration of `m` from `A`, and that implementation isn't consistent with
- // the signature of `m` that's inherited from `B`:
- //
- // ```dart
- // %language=2.9
- // class A {
- // void m({int a}) {}
- // }
- //
- // class B {
- // void m({int b}) {}
- // }
- //
- // class [!C!] extends A implements B {
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add an implementation of the method that satisfies all the inherited
- // signatures:
- //
- // ```dart
- // %language=2.9
- // class A {
- // void m({int a}) {}
- // }
- //
- // class B {
- // void m({int b}) {}
- // }
- //
- // class C extends A implements B {
- // void m({int a, int b}) {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the instance member with inconsistent inheritance.
+ /// 1: the list of all inherited signatures for this member.
static const CompileTimeErrorCode INCONSISTENT_INHERITANCE =
CompileTimeErrorCode(
'INCONSISTENT_INHERITANCE',
@@ -6783,18 +1916,16 @@
hasPublishedDocs: true,
);
- /**
- * 11.1.1 Inheritance and Overriding. Let `I` be the implicit interface of a
- * class `C` declared in library `L`. `I` inherits all members of
- * `inherited(I, L)` and `I` overrides `m'` if `m' ∈ overrides(I, L)`. It is
- * a compile-time error if `m` is a method and `m'` is a getter, or if `m`
- * is a getter and `m'` is a method.
- *
- * Parameters:
- * 0: the name of the instance member with inconsistent inheritance.
- * 1: the name of the superinterface that declares the name as a getter.
- * 2: the name of the superinterface that declares the name as a method.
- */
+ /// 11.1.1 Inheritance and Overriding. Let `I` be the implicit interface of a
+ /// class `C` declared in library `L`. `I` inherits all members of
+ /// `inherited(I, L)` and `I` overrides `m'` if `m' ∈ overrides(I, L)`. It is
+ /// a compile-time error if `m` is a method and `m'` is a getter, or if `m`
+ /// is a getter and `m'` is a method.
+ ///
+ /// Parameters:
+ /// 0: the name of the instance member with inconsistent inheritance.
+ /// 1: the name of the superinterface that declares the name as a getter.
+ /// 2: the name of the superinterface that declares the name as a method.
static const CompileTimeErrorCode INCONSISTENT_INHERITANCE_GETTER_AND_METHOD =
CompileTimeErrorCode(
'INCONSISTENT_INHERITANCE_GETTER_AND_METHOD',
@@ -6805,46 +1936,7 @@
"inconsistency.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a [part file][] has a language
- // version override comment that specifies a different language version than
- // the one being used for the library to which the part belongs.
- //
- // #### Example
- //
- // Given a [part file][] named `part.dart` that contains the following:
- //
- // ```dart
- // %uri="lib/part.dart"
- // // @dart = 2.6
- // part of 'test.dart';
- // ```
- //
- // The following code produces this diagnostic because the parts of a library
- // must have the same language version as the defining compilation unit:
- //
- // ```dart
- // // @dart = 2.5
- // part [!'part.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // Remove the language version override from the [part file][], so that it
- // implicitly uses the same version as the defining compilation unit:
- //
- // ```dart
- // part of 'test.dart';
- // ```
- //
- // If necessary, either adjust the language version override in the defining
- // compilation unit to be appropriate for the code in the part, or migrate
- // the code in the [part file][] to be consistent with the new language
- // version.
+ /// No parameters.
static const CompileTimeErrorCode INCONSISTENT_LANGUAGE_VERSION_OVERRIDE =
CompileTimeErrorCode(
'INCONSISTENT_LANGUAGE_VERSION_OVERRIDE',
@@ -6853,57 +1945,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the initializing formal that is not an instance variable in
- * the immediately enclosing class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor initializes a
- // field that isn't declared in the class containing the constructor.
- // Constructors can't initialize fields that aren't declared and fields that
- // are inherited from superclasses.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the initializer is
- // initializing `x`, but `x` isn't a field in the class:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int y;
- //
- // C() : [!x = 0!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If a different field should be initialized, then change the name to the
- // name of the field:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int y;
- //
- // C() : y = 0;
- // }
- // ```
- //
- // If the field must be declared, then add a declaration:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int x;
- // int y;
- //
- // C() : x = 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the initializing formal that is not an instance variable in
+ /// the immediately enclosing class
static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTENT_FIELD =
CompileTimeErrorCode(
'INITIALIZER_FOR_NON_EXISTENT_FIELD',
@@ -6914,62 +1958,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the initializing formal that is a static variable in the
- * immediately enclosing class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a static field is initialized
- // in a constructor using either an initializing formal parameter or an
- // assignment in the initializer list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the static field `a`
- // is being initialized by the initializing formal parameter `this.a`:
- //
- // ```dart
- // class C {
- // static int? a;
- // C([!this.a!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field should be an instance field, then remove the keyword `static`:
- //
- // ```dart
- // class C {
- // int? a;
- // C(this.a);
- // }
- // ```
- //
- // If you intended to initialize an instance field and typed the wrong name,
- // then correct the name of the field being initialized:
- //
- // ```dart
- // class C {
- // static int? a;
- // int? b;
- // C(this.b);
- // }
- // ```
- //
- // If you really want to initialize the static field, then move the
- // initialization into the constructor body:
- //
- // ```dart
- // class C {
- // static int? a;
- // C(int? c) {
- // a = c;
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the initializing formal that is a static variable in the
+ /// immediately enclosing class
static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD =
CompileTimeErrorCode(
'INITIALIZER_FOR_STATIC_FIELD',
@@ -6979,81 +1970,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the initializing formal that is not an instance variable in
- * the immediately enclosing class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an initializing formal
- // parameter is found in a constructor in a class that doesn't declare the
- // field being initialized. Constructors can't initialize fields that aren't
- // declared and fields that are inherited from superclasses.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `x` isn't
- // defined:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int y;
- //
- // C([!this.x!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field name was wrong, then change it to the name of an existing
- // field:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int y;
- //
- // C(this.y);
- // }
- // ```
- //
- // If the field name is correct but hasn't yet been defined, then declare the
- // field:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int x;
- // int y;
- //
- // C(this.x);
- // }
- // ```
- //
- // If the parameter is needed but shouldn't initialize a field, then convert
- // it to a normal parameter and use it:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int y;
- //
- // C(int x) : y = x * 2;
- // }
- // ```
- //
- // If the parameter isn't needed, then remove it:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int y;
- //
- // C();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the initializing formal that is not an instance variable in
+ /// the immediately enclosing class
static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD =
CompileTimeErrorCode(
'INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD',
@@ -7064,46 +1983,11 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the static member
- * 1: the kind of the static member (field, getter, setter, or method)
- * 2: the name of the static member's enclosing element
- * 3: the kind of the static member's enclosing element (class, mixin, or extension)
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an access operator is used to
- // access a static member through an instance of the class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `zero` is a static
- // field, but it’s being accessed as if it were an instance field:
- //
- // ```dart
- // void f(C c) {
- // c.[!zero!];
- // }
- //
- // class C {
- // static int zero = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use the class to access the static member:
- //
- // ```dart
- // void f(C c) {
- // C.zero;
- // }
- //
- // class C {
- // static int zero = 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the static member
+ /// 1: the kind of the static member (field, getter, setter, or method)
+ /// 2: the name of the static member's enclosing element
+ /// 3: the kind of the static member's enclosing element (class, mixin, or extension)
static const CompileTimeErrorCode INSTANCE_ACCESS_TO_STATIC_MEMBER =
CompileTimeErrorCode(
'INSTANCE_ACCESS_TO_STATIC_MEMBER',
@@ -7112,11 +1996,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the static member
- * 1: the kind of the static member (field, getter, setter, or method)
- */
+ /// Parameters:
+ /// 0: the name of the static member
+ /// 1: the kind of the static member (field, getter, setter, or method)
static const CompileTimeErrorCode
INSTANCE_ACCESS_TO_STATIC_MEMBER_OF_UNNAMED_EXTENSION =
CompileTimeErrorCode(
@@ -7126,47 +2008,7 @@
uniqueName: 'INSTANCE_ACCESS_TO_STATIC_MEMBER_OF_UNNAMED_EXTENSION',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a factory constructor contains
- // an unqualified reference to an instance member. In a generative
- // constructor, the instance of the class is created and initialized before
- // the body of the constructor is executed, so the instance can be bound to
- // `this` and accessed just like it would be in an instance method. But, in a
- // factory constructor, the instance isn't created before executing the body,
- // so `this` can't be used to reference it.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` isn't in scope in
- // the factory constructor:
- //
- // ```dart
- // class C {
- // int x;
- // factory C() {
- // return C._([!x!]);
- // }
- // C._(this.x);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rewrite the code so that it doesn't reference the instance member:
- //
- // ```dart
- // class C {
- // int x;
- // factory C() {
- // return C._(0);
- // }
- // C._(this.x);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY =
CompileTimeErrorCode(
'INSTANCE_MEMBER_ACCESS_FROM_FACTORY',
@@ -7175,59 +2017,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a static method contains an
- // unqualified reference to an instance member.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the instance field `x`
- // is being referenced in a static method:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int x;
- //
- // static int m() {
- // return [!x!];
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the method must reference the instance member, then it can't be static,
- // so remove the keyword:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int x;
- //
- // int m() {
- // return x;
- // }
- // }
- // ```
- //
- // If the method can't be made an instance method, then add a parameter so
- // that an instance of the class can be passed in:
- //
- // ```dart
- // %language=2.9
- // class C {
- // int x;
- //
- // static int m(C c) {
- // return c.x;
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC =
CompileTimeErrorCode(
'INSTANCE_MEMBER_ACCESS_FROM_STATIC',
@@ -7238,31 +2028,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds a constructor
- // invocation and the constructor is declared in an abstract class. Even
- // though you can't create an instance of an abstract class, abstract classes
- // can declare constructors that can be invoked by subclasses.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `C` is an abstract
- // class:
- //
- // ```dart
- // abstract class C {}
- //
- // var c = new [!C!]();
- // ```
- //
- // #### Common fixes
- //
- // If there's a concrete subclass of the abstract class that can be used, then
- // create an instance of the concrete subclass.
+ /// No parameters.
static const CompileTimeErrorCode INSTANTIATE_ABSTRACT_CLASS =
CompileTimeErrorCode(
'INSTANTIATE_ABSTRACT_CLASS',
@@ -7271,40 +2037,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an enum is instantiated. It's
- // invalid to create an instance of an enum by invoking a constructor; only
- // the instances named in the declaration of the enum can exist.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the enum `E` is being
- // instantiated:
- //
- // ```dart
- // // @dart = 2.16
- // enum E {a}
- //
- // var e = [!E!]();
- // ```
- //
- // #### Common fixes
- //
- // If you intend to use an instance of the enum, then reference one of the
- // constants defined in the enum:
- //
- // ```dart
- // // @dart = 2.16
- // enum E {a}
- //
- // var e = E.a;
- // ```
- //
- // If you intend to use an instance of a class, then use the name of that class in place of the name of the enum.
+ /// No parameters.
static const CompileTimeErrorCode INSTANTIATE_ENUM = CompileTimeErrorCode(
'INSTANTIATE_ENUM',
"Enums can't be instantiated.",
@@ -7312,46 +2045,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor invocation is
- // found where the type being instantiated is a type alias for one of the type
- // parameters of the type alias. This isn’t allowed because the value of the
- // type parameter is a type rather than a class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because it creates an instance
- // of `A`, even though `A` is a type alias that is defined to be equivalent to
- // a type parameter:
- //
- // ```dart
- // typedef A<T> = T;
- //
- // void f() {
- // const [!A!]<int>();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use either a class name or a type alias defined to be a class, rather than
- // a type alias defined to be a type parameter:
- //
- // ```dart
- // typedef A<T> = C<T>;
- //
- // void f() {
- // const A<int>();
- // }
- //
- // class C<T> {
- // const C();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
INSTANTIATE_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'INSTANTIATE_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
@@ -7360,41 +2054,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the lexeme of the integer
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an integer literal is being
- // implicitly converted to a double, but can't be represented as a 64-bit
- // double without overflow or loss of precision. Integer literals are
- // implicitly converted to a double if the context requires the type `double`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the integer value
- // `9223372036854775807` can't be represented exactly as a double:
- //
- // ```dart
- // double x = [!9223372036854775807!];
- // ```
- //
- // #### Common fixes
- //
- // If you need to use the exact value, then use the class `BigInt` to
- // represent the value:
- //
- // ```dart
- // var x = BigInt.parse('9223372036854775807');
- // ```
- //
- // If you need to use a double, then change the value to one that can be
- // represented exactly:
- //
- // ```dart
- // double x = 9223372036854775808;
- // ```
+ /// Parameters:
+ /// 0: the lexeme of the integer
static const CompileTimeErrorCode INTEGER_LITERAL_IMPRECISE_AS_DOUBLE =
CompileTimeErrorCode(
'INTEGER_LITERAL_IMPRECISE_AS_DOUBLE',
@@ -7406,32 +2067,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an integer literal has a value
- // that is too large (positive) or too small (negative) to be represented in a
- // 64-bit word.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value can't be
- // represented in 64 bits:
- //
- // ```dart
- // var x = [!9223372036854775810!];
- // ```
- //
- // #### Common fixes
- //
- // If you need to represent the current value, then wrap it in an instance of
- // the class `BigInt`:
- //
- // ```dart
- // var x = BigInt.parse('9223372036854775810');
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INTEGER_LITERAL_OUT_OF_RANGE =
CompileTimeErrorCode(
'INTEGER_LITERAL_OUT_OF_RANGE',
@@ -7442,75 +2078,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an annotation is found that is
- // using something that is neither a variable marked as `const` or the
- // invocation of a `const` constructor.
- //
- // Getters can't be used as annotations.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the variable `v` isn't
- // a `const` variable:
- //
- // ```dart
- // var v = 0;
- //
- // [!@v!]
- // void f() {
- // }
- // ```
- //
- // The following code produces this diagnostic because `f` isn't a variable:
- //
- // ```dart
- // [!@f!]
- // void f() {
- // }
- // ```
- //
- // The following code produces this diagnostic because `f` isn't a
- // constructor:
- //
- // ```dart
- // [!@f()!]
- // void f() {
- // }
- // ```
- //
- // The following code produces this diagnostic because `g` is a getter:
- //
- // ```dart
- // [!@g!]
- // int get g => 0;
- // ```
- //
- // #### Common fixes
- //
- // If the annotation is referencing a variable that isn't a `const`
- // constructor, add the keyword `const` to the variable's declaration:
- //
- // ```dart
- // const v = 0;
- //
- // @v
- // void f() {
- // }
- // ```
- //
- // If the annotation isn't referencing a variable, then remove it:
- //
- // ```dart
- // int v = 0;
- //
- // void f() {
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVALID_ANNOTATION = CompileTimeErrorCode(
'INVALID_ANNOTATION',
"Annotation must be either a const variable reference or const constructor "
@@ -7518,55 +2086,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constant defined in a library
- // that is imported as a deferred library is referenced in the argument list
- // of an annotation. Annotations are evaluated at compile time, and values
- // from deferred libraries aren't available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constant `pi` is
- // being referenced in the argument list of an annotation, even though the
- // library that defines it is being imported as a deferred library:
- //
- // ```dart
- // import 'dart:math' deferred as math;
- //
- // class C {
- // const C(double d);
- // }
- //
- // @C([!math.pi!])
- // void f () {}
- // ```
- //
- // #### Common fixes
- //
- // If you need to reference the imported constant, then remove the `deferred`
- // keyword:
- //
- // ```dart
- // import 'dart:math' as math;
- //
- // class C {
- // const C(double d);
- // }
- //
- // @C(math.pi)
- // void f () {}
- // ```
- //
- // If the import is required to be deferred and there's another constant that
- // is appropriate, then use that constant in place of the constant from the
- // deferred library.
+ /// No parameters.
static const CompileTimeErrorCode
INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY =
CompileTimeErrorCode(
@@ -7578,51 +2098,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constant from a library that
- // is imported using a deferred import is used as an annotation. Annotations
- // are evaluated at compile time, and constants from deferred libraries aren't
- // available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constant `pi` is
- // being used as an annotation when the library `dart:math` is imported as
- // `deferred`:
- //
- // ```dart
- // import 'dart:math' deferred as math;
- //
- // @[!math.pi!]
- // void f() {}
- // ```
- //
- // #### Common fixes
- //
- // If you need to reference the constant as an annotation, then remove the
- // keyword `deferred` from the import:
- //
- // ```dart
- // import 'dart:math' as math;
- //
- // @math.pi
- // void f() {}
- // ```
- //
- // If you can use a different constant as an annotation, then replace the
- // annotation with a different constant:
- //
- // ```dart
- // @deprecated
- // void f() {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY =
CompileTimeErrorCode(
'INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY',
@@ -7633,48 +2109,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the right hand side type
- * 1: the name of the left hand side type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the static type of an expression
- // that is assigned to a variable isn't assignable to the type of the
- // variable.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of the
- // initializer (`int`) isn't assignable to the type of the variable
- // (`String`):
- //
- // ```dart
- // int i = 0;
- // String s = [!i!];
- // ```
- //
- // #### Common fixes
- //
- // If the value being assigned is always assignable at runtime, even though
- // the static types don't reflect that, then add an explicit cast.
- //
- // Otherwise, change the value being assigned so that it has the expected
- // type. In the previous example, this might look like:
- //
- // ```dart
- // int i = 0;
- // String s = i.toString();
- // ```
- //
- // If you can’t change the value, then change the type of the variable to be
- // compatible with the type of the value being assigned:
- //
- // ```dart
- // int i = 0;
- // int s = i;
- // ```
+ /// Parameters:
+ /// 0: the name of the right hand side type
+ /// 1: the name of the left hand side type
static const CompileTimeErrorCode INVALID_ASSIGNMENT = CompileTimeErrorCode(
'INVALID_ASSIGNMENT',
"A value of type '{0}' can't be assigned to a variable of type '{1}'.",
@@ -7684,13 +2121,11 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the function
- * 1: the expected function type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the function
+ /// 1: the expected function type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_FUNCTION =
CompileTimeErrorCode(
'INVALID_CAST_FUNCTION',
@@ -7698,13 +2133,11 @@
"means its parameter or return type doesn't match what is expected.",
);
- /**
- * Parameters:
- * 0: the type of the torn-off function expression
- * 1: the expected function type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the torn-off function expression
+ /// 1: the expected function type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_FUNCTION_EXPR =
CompileTimeErrorCode(
'INVALID_CAST_FUNCTION_EXPR',
@@ -7713,25 +2146,21 @@
"changing parameter type(s) or the returned type(s).",
);
- /**
- * Parameters:
- * 0: the type of the literal
- * 1: the expected type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the literal
+ /// 1: the expected type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_LITERAL = CompileTimeErrorCode(
'INVALID_CAST_LITERAL',
"The literal '{0}' with type '{1}' isn't of expected type '{2}'.",
);
- /**
- * Parameters:
- * 0: the type of the list literal
- * 1: the expected type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the list literal
+ /// 1: the expected type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_LITERAL_LIST =
CompileTimeErrorCode(
'INVALID_CAST_LITERAL_LIST',
@@ -7740,13 +2169,11 @@
"the element types.",
);
- /**
- * Parameters:
- * 0: the type of the map literal
- * 1: the expected type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the map literal
+ /// 1: the expected type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_LITERAL_MAP =
CompileTimeErrorCode(
'INVALID_CAST_LITERAL_MAP',
@@ -7755,13 +2182,11 @@
"the key and value types.",
);
- /**
- * Parameters:
- * 0: the type of the set literal
- * 1: the expected type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the set literal
+ /// 1: the expected type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_LITERAL_SET =
CompileTimeErrorCode(
'INVALID_CAST_LITERAL_SET',
@@ -7770,13 +2195,11 @@
"the element types.",
);
- /**
- * Parameters:
- * 0: the type of the torn-off method
- * 1: the expected function type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the torn-off method
+ /// 1: the expected function type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_METHOD = CompileTimeErrorCode(
'INVALID_CAST_METHOD',
"The method tear-off '{0}' has type '{1}' that isn't of expected type "
@@ -7784,81 +2207,28 @@
"expected.",
);
- /**
- * Parameters:
- * 0: the type of the instantiated object
- * 1: the expected type
- *
- * This error is only reported in libraries which are not null safe.
- */
+ /// Parameters:
+ /// 0: the type of the instantiated object
+ /// 1: the expected type
+ ///
+ /// This error is only reported in libraries which are not null safe.
static const CompileTimeErrorCode INVALID_CAST_NEW_EXPR =
CompileTimeErrorCode(
'INVALID_CAST_NEW_EXPR',
"The constructor returns type '{0}' that isn't of expected type '{1}'.",
);
- /**
- * TODO(brianwilkerson) Remove this when we have decided on how to report
- * errors in compile-time constants. Until then, this acts as a placeholder
- * for more informative errors.
- *
- * See TODOs in ConstantVisitor
- */
+ /// TODO(brianwilkerson) Remove this when we have decided on how to report
+ /// errors in compile-time constants. Until then, this acts as a placeholder
+ /// for more informative errors.
+ ///
+ /// See TODOs in ConstantVisitor
static const CompileTimeErrorCode INVALID_CONSTANT = CompileTimeErrorCode(
'INVALID_CONSTANT',
"Invalid constant value.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override doesn't
- // have exactly one argument. The argument is the expression used to compute
- // the value of `this` within the extension method, so there must be one
- // argument.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because there are no arguments:
- //
- // ```dart
- // extension E on String {
- // String join(String other) => '$this $other';
- // }
- //
- // void f() {
- // E[!()!].join('b');
- // }
- // ```
- //
- // And, the following code produces this diagnostic because there's more than
- // one argument:
- //
- // ```dart
- // extension E on String {
- // String join(String other) => '$this $other';
- // }
- //
- // void f() {
- // E[!('a', 'b')!].join('c');
- // }
- // ```
- //
- // #### Common fixes
- //
- // Provide one argument for the extension override:
- //
- // ```dart
- // extension E on String {
- // String join(String other) => '$this $other';
- // }
- //
- // void f() {
- // E('a').join('b');
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVALID_EXTENSION_ARGUMENT_COUNT =
CompileTimeErrorCode(
'INVALID_EXTENSION_ARGUMENT_COUNT',
@@ -7868,62 +2238,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name of a factory
- // constructor isn't the same as the name of the surrounding class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name of the factory
- // constructor (`A`) isn't the same as the surrounding class (`C`):
- //
- // ```dart
- // class A {}
- //
- // class C {
- // factory [!A!]() => throw 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the factory returns an instance of the surrounding class, then rename
- // the factory:
- //
- // ```dart
- // class A {}
- //
- // class C {
- // factory C() => throw 0;
- // }
- // ```
- //
- // If the factory returns an instance of a different class, then move the
- // factory to that class:
- //
- // ```dart
- // class A {
- // factory A() => throw 0;
- // }
- //
- // class C {}
- // ```
- //
- // If the factory returns an instance of a different class, but you can't
- // modify that class or don't want to move the factory, then convert it to be
- // a static method:
- //
- // ```dart
- // class A {}
- //
- // class C {
- // static A a() => throw 0;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS =
CompileTimeErrorCode(
'INVALID_FACTORY_NAME_NOT_A_CLASS',
@@ -7932,97 +2247,15 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the declared member that is not a valid override.
- * 1: the name of the interface that declares the member.
- * 2: the type of the declared member in the interface.
- * 3. the name of the interface with the overridden member.
- * 4. the type of the overridden member.
- *
- * These parameters must be kept in sync with those of
- * [CompileTimeErrorCode.INVALID_OVERRIDE].
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when all of the following are true:
- //
- // - A class defines an abstract member.
- // - There is a concrete implementation of that member in a superclass.
- // - The concrete implementation isn't a valid implementation of the abstract
- // method.
- //
- // The concrete implementation can be invalid because of incompatibilities in
- // either the return type, the types of parameters, or the type variables.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the method `A.add` has
- // a parameter of type `int`, and the overriding method `B.add` has a
- // corresponding parameter of type `num`:
- //
- // ```dart
- // class A {
- // int add(int a) => a;
- // }
- // class [!B!] extends A {
- // int add(num a);
- // }
- // ```
- //
- // This is a problem because in an invocation of `B.add` like the following:
- //
- // ```dart
- // void f(B b) {
- // b.add(3.4);
- // }
- // ```
- //
- // `B.add` is expecting to be able to take, for example, a `double`, but when
- // the method `A.add` is executed (because it's the only concrete
- // implementation of `add`), a runtime exception will be thrown because a
- // `double` can't be assigned to a parameter of type `int`.
- //
- // #### Common fixes
- //
- // If the method in the subclass can conform to the implementation in the
- // superclass, then change the declaration in the subclass (or remove it if
- // it's the same):
- //
- // ```dart
- // class A {
- // int add(int a) => a;
- // }
- // class B extends A {
- // int add(int a);
- // }
- // ```
- //
- // If the method in the superclass can be generalized to be a valid
- // implementation of the method in the subclass, then change the superclass
- // method:
- //
- // ```dart
- // class A {
- // int add(num a) => a.floor();
- // }
- // class B extends A {
- // int add(num a);
- // }
- // ```
- //
- // If neither the method in the superclass nor the method in the subclass can
- // be changed, then provide a concrete implementation of the method in the
- // subclass:
- //
- // ```dart
- // class A {
- // int add(int a) => a;
- // }
- // class B extends A {
- // int add(num a) => a.floor();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the declared member that is not a valid override.
+ /// 1: the name of the interface that declares the member.
+ /// 2: the type of the declared member in the interface.
+ /// 3. the name of the interface with the overridden member.
+ /// 4. the type of the overridden member.
+ ///
+ /// These parameters must be kept in sync with those of
+ /// [CompileTimeErrorCode.INVALID_OVERRIDE].
static const CompileTimeErrorCode INVALID_IMPLEMENTATION_OVERRIDE =
CompileTimeErrorCode(
'INVALID_IMPLEMENTATION_OVERRIDE',
@@ -8031,32 +2264,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a generic function type has a
- // function-valued parameter that is written using the older inline function
- // type syntax.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the parameter `f`, in
- // the generic function type used to define `F`, uses the inline function
- // type syntax:
- //
- // ```dart
- // typedef F = int Function(int f[!(!]String s));
- // ```
- //
- // #### Common fixes
- //
- // Use the generic function syntax for the parameter's type:
- //
- // ```dart
- // typedef F = int Function(int Function(String));
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVALID_INLINE_FUNCTION_TYPE =
CompileTimeErrorCode(
'INVALID_INLINE_FUNCTION_TYPE',
@@ -8068,48 +2276,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the invalid modifier
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the body of a constructor is
- // prefixed by one of the following modifiers: `async`, `async*`, or `sync*`.
- // Constructor bodies must be synchronous.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of the
- // constructor for `C` is marked as being `async`:
- //
- // ```dart
- // class C {
- // C() [!async!] {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the constructor can be synchronous, then remove the modifier:
- //
- // ```dart
- // class C {
- // C();
- // }
- // ```
- //
- // If the constructor can't be synchronous, then use a static method to create
- // the instance instead:
- //
- // ```dart
- // class C {
- // C();
- // static Future<C> c() async {
- // return C();
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the invalid modifier
static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR =
CompileTimeErrorCode(
'INVALID_MODIFIER_ON_CONSTRUCTOR',
@@ -8118,45 +2286,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the invalid modifier
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the body of a setter is prefixed
- // by one of the following modifiers: `async`, `async*`, or `sync*`. Setter
- // bodies must be synchronous.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of the setter
- // `x` is marked as being `async`:
- //
- // ```dart
- // class C {
- // set x(int i) [!async!] {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the setter can be synchronous, then remove the modifier:
- //
- // ```dart
- // class C {
- // set x(int i) {}
- // }
- // ```
- //
- // If the setter can't be synchronous, then use a method to set the value
- // instead:
- //
- // ```dart
- // class C {
- // void x(int i) async {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the invalid modifier
static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER =
CompileTimeErrorCode(
'INVALID_MODIFIER_ON_SETTER',
@@ -8165,127 +2296,18 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the declared member that is not a valid override.
- * 1: the name of the interface that declares the member.
- * 2: the type of the declared member in the interface.
- * 3. the name of the interface with the overridden member.
- * 4. the type of the overridden member.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a member of a class is found
- // that overrides a member from a supertype and the override isn't valid. An
- // override is valid if all of these are true:
- // * It allows all of the arguments allowed by the overridden member.
- // * It doesn't require any arguments that aren't required by the overridden
- // member.
- // * The type of every parameter of the overridden member is assignable to the
- // corresponding parameter of the override.
- // * The return type of the override is assignable to the return type of the
- // overridden member.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of the
- // parameter `s` (`String`) isn't assignable to the type of the parameter `i`
- // (`int`):
- //
- // ```dart
- // class A {
- // void m(int i) {}
- // }
- //
- // class B extends A {
- // void [!m!](String s) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the invalid method is intended to override the method from the
- // superclass, then change it to conform:
- //
- // ```dart
- // class A {
- // void m(int i) {}
- // }
- //
- // class B extends A {
- // void m(int i) {}
- // }
- // ```
- //
- // If it isn't intended to override the method from the superclass, then
- // rename it:
- //
- // ```dart
- // class A {
- // void m(int i) {}
- // }
- //
- // class B extends A {
- // void m2(String s) {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the declared member that is not a valid override.
+ /// 1: the name of the interface that declares the member.
+ /// 2: the type of the declared member in the interface.
+ /// 3. the name of the interface with the overridden member.
+ /// 4. the type of the overridden member.
static const CompileTimeErrorCode INVALID_OVERRIDE = CompileTimeErrorCode(
'INVALID_OVERRIDE',
"'{1}.{0}' ('{2}') isn't a valid override of '{3}.{0}' ('{4}').",
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when a generative constructor
- // defined on an enum is used anywhere other than to create one of the enum
- // constants or as the target of a redirection from another constructor in
- // the same enum.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor for
- // `E` is being used to create an instance in the function `f`:
- //
- // ```dart
- // enum E {
- // a(0);
- //
- // const E(int x);
- // }
- //
- // E f() => const [!E!](2);
- // ```
- //
- // #### Common fixes
- //
- // If there's an enum constant with the same value, or if you add such a
- // constant, then reference the constant directly:
- //
- // ```dart
- // enum E {
- // a(0), b(2);
- //
- // const E(int x);
- // }
- //
- // E f() => E.b;
- // ```
- //
- // If you need to use a constructor invocation, then use a factory
- // constructor:
- //
- // ```dart
- // enum E {
- // a(0);
- //
- // const E(int x);
- //
- // factory E.c(int x) => a;
- // }
- //
- // E f() => E.c(2);
- // ```
static const CompileTimeErrorCode
INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR = CompileTimeErrorCode(
'INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR',
@@ -8294,37 +2316,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when `this` is used outside of an
- // instance method or a generative constructor. The reserved word `this` is
- // only defined in the context of an instance method or a generative
- // constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `v` is a top-level
- // variable:
- //
- // ```dart
- // C f() => [!this!];
- //
- // class C {}
- // ```
- //
- // #### Common fixes
- //
- // Use a variable of the appropriate type in place of `this`, declaring it if
- // necessary:
- //
- // ```dart
- // C f(C c) => c;
- //
- // class C {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS =
CompileTimeErrorCode(
'INVALID_REFERENCE_TO_THIS',
@@ -8332,89 +2324,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the super modifier
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a super parameter is used
- // anywhere other than a non-redirecting generative constructor.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the super parameter
- // `x` is in a redirecting generative constructor:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // B.b([!super!].x) : this._();
- // B._() : super(0);
- // }
- // ```
- //
- // The following code produces this diagnostic because the super parameter
- // `x` isn't in a generative constructor:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class C extends A {
- // factory C.c([!super!].x) => C._();
- // C._() : super(0);
- // }
- // ```
- //
- // The following code produces this diagnostic because the super parameter
- // `x` is in a method:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class D extends A {
- // D() : super(0);
- //
- // void m([!super!].x) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the function containing the super parameter can be changed to be a
- // non-redirecting generative constructor, then do so:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // B.b(super.x);
- // }
- // ```
- //
- // If the function containing the super parameter can't be changed to be a
- // non-redirecting generative constructor, then remove the `super`:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class D extends A {
- // D() : super(0);
- //
- // void m(int x) {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the super modifier
static const CompileTimeErrorCode INVALID_SUPER_FORMAL_PARAMETER_LOCATION =
CompileTimeErrorCode(
'INVALID_SUPER_FORMAL_PARAMETER_LOCATION',
@@ -8426,55 +2337,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type parameter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type parameter is used as a
- // type argument in a list, map, or set literal that is prefixed by `const`.
- // This isn't allowed because the value of the type parameter (the actual type
- // that will be used at runtime) can't be known at compile time.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the type parameter `T`
- // is being used as a type argument when creating a constant list:
- //
- // ```dart
- // List<T> newList<T>() => const <[!T!]>[];
- // ```
- //
- // The following code produces this diagnostic because the type parameter `T`
- // is being used as a type argument when creating a constant map:
- //
- // ```dart
- // Map<String, T> newSet<T>() => const <String, [!T!]>{};
- // ```
- //
- // The following code produces this diagnostic because the type parameter `T`
- // is being used as a type argument when creating a constant set:
- //
- // ```dart
- // Set<T> newSet<T>() => const <[!T!]>{};
- // ```
- //
- // #### Common fixes
- //
- // If the type that will be used for the type parameter can be known at
- // compile time, then remove the type parameter:
- //
- // ```dart
- // List<int> newList() => const <int>[];
- // ```
- //
- // If the type that will be used for the type parameter can't be known until
- // runtime, then remove the keyword `const`:
- //
- // ```dart
- // List<T> newList<T>() => <T>[];
- // ```
+ /// Parameters:
+ /// 0: the name of the type parameter
static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST =
CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL',
@@ -8486,10 +2350,8 @@
uniqueName: 'INVALID_TYPE_ARGUMENT_IN_CONST_LIST',
);
- /**
- * Parameters:
- * 0: the name of the type parameter
- */
+ /// Parameters:
+ /// 0: the name of the type parameter
static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP =
CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL',
@@ -8501,10 +2363,8 @@
uniqueName: 'INVALID_TYPE_ARGUMENT_IN_CONST_MAP',
);
- /**
- * Parameters:
- * 0: the name of the type parameter
- */
+ /// Parameters:
+ /// 0: the name of the type parameter
static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_SET =
CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL',
@@ -8516,36 +2376,15 @@
uniqueName: 'INVALID_TYPE_ARGUMENT_IN_CONST_SET',
);
- /**
- * Parameters:
- * 0: the URI that is invalid
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a URI in a directive doesn't
- // conform to the syntax of a valid URI.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `'#'` isn't a valid
- // URI:
- //
- // ```dart
- // import [!'#'!];
- // ```
- //
- // #### Common fixes
- //
- // Replace the invalid URI with a valid URI.
+ /// Parameters:
+ /// 0: the URI that is invalid
static const CompileTimeErrorCode INVALID_URI = CompileTimeErrorCode(
'INVALID_URI',
"Invalid URI syntax: '{0}'.",
hasPublishedDocs: true,
);
- /**
- * The 'covariant' keyword was found in an inappropriate location.
- */
+ /// The 'covariant' keyword was found in an inappropriate location.
static const CompileTimeErrorCode INVALID_USE_OF_COVARIANT =
CompileTimeErrorCode(
'INVALID_USE_OF_COVARIANT',
@@ -8554,35 +2393,7 @@
correctionMessage: "Try removing the 'covariant' keyword.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an expression whose value will
- // always be `null` is dereferenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` will always be
- // `null`:
- //
- // ```dart
- // int f(Null x) {
- // return [!x!].length;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the value is allowed to be something other than `null`, then change the
- // type of the expression:
- //
- // ```dart
- // int f(String? x) {
- // return x!.length;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVALID_USE_OF_NULL_VALUE =
CompileTimeErrorCode(
'INVALID_USE_OF_NULL_VALUE',
@@ -8591,47 +2402,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the extension
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override is used to
- // invoke a function but the extension doesn't declare a `call` method.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't define a `call` method:
- //
- // ```dart
- // extension E on String {}
- //
- // void f() {
- // [!E('')!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the extension is intended to define a `call` method, then declare it:
- //
- // ```dart
- // extension E on String {
- // int call() => 0;
- // }
- //
- // void f() {
- // E('')();
- // }
- // ```
- //
- // If the extended type defines a `call` method, then remove the extension
- // override.
- //
- // If the `call` method isn't defined, then rewrite the code so that it
- // doesn't invoke the `call` method.
+ /// Parameters:
+ /// 0: the name of the extension
static const CompileTimeErrorCode INVOCATION_OF_EXTENSION_WITHOUT_CALL =
CompileTimeErrorCode(
'INVOCATION_OF_EXTENSION_WITHOUT_CALL',
@@ -8640,32 +2412,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the identifier that is not a function type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds a function invocation,
- // but the name of the function being invoked is defined to be something other
- // than a function.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `Binary` is the name of
- // a function type, not a function:
- //
- // ```dart
- // typedef Binary = int Function(int, int);
- //
- // int f() {
- // return [!Binary!](1, 2);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the name with the name of a function.
+ /// Parameters:
+ /// 0: the name of the identifier that is not a function type
static const CompileTimeErrorCode INVOCATION_OF_NON_FUNCTION =
CompileTimeErrorCode(
'INVOCATION_OF_NON_FUNCTION',
@@ -8676,51 +2424,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a function invocation is found,
- // but the name being referenced isn't the name of a function, or when the
- // expression computing the function doesn't compute a function.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` isn't a function:
- //
- // ```dart
- // int x = 0;
- //
- // int f() => x;
- //
- // var y = [!x!]();
- // ```
- //
- // The following code produces this diagnostic because `f()` doesn't return a
- // function:
- //
- // ```dart
- // int x = 0;
- //
- // int f() => x;
- //
- // var y = [!f()!]();
- // ```
- //
- // #### Common fixes
- //
- // If you need to invoke a function, then replace the code before the argument
- // list with the name of a function or with an expression that computes a
- // function:
- //
- // ```dart
- // int x = 0;
- //
- // int f() => x;
- //
- // var y = f();
- // ```
+ /// No parameters.
static const CompileTimeErrorCode INVOCATION_OF_NON_FUNCTION_EXPRESSION =
CompileTimeErrorCode(
'INVOCATION_OF_NON_FUNCTION_EXPRESSION',
@@ -8728,125 +2432,16 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the unresolvable label
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `break` or `continue`
- // statement references a label that is declared in a method or function
- // containing the function in which the `break` or `continue` statement
- // appears. The `break` and `continue` statements can't be used to transfer
- // control outside the function that contains them.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the label `loop` is
- // declared outside the local function `g`:
- //
- // ```dart
- // void f() {
- // loop:
- // while (true) {
- // void g() {
- // break [!loop!];
- // }
- //
- // g();
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Try rewriting the code so that it isn't necessary to transfer control
- // outside the local function, possibly by inlining the local function:
- //
- // ```dart
- // void f() {
- // loop:
- // while (true) {
- // break loop;
- // }
- // }
- // ```
- //
- // If that isn't possible, then try rewriting the local function so that a
- // value returned by the function can be used to determine whether control is
- // transferred:
- //
- // ```dart
- // void f() {
- // loop:
- // while (true) {
- // bool g() {
- // return true;
- // }
- //
- // if (g()) {
- // break loop;
- // }
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the unresolvable label
static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = CompileTimeErrorCode(
'LABEL_IN_OUTER_SCOPE',
"Can't reference label '{0}' declared in an outer method.",
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the unresolvable label
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds a reference to a label
- // that isn't defined in the scope of the `break` or `continue` statement that
- // is referencing it.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the label `loop` isn't
- // defined anywhere:
- //
- // ```dart
- // void f() {
- // for (int i = 0; i < 10; i++) {
- // for (int j = 0; j < 10; j++) {
- // break [!loop!];
- // }
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the label should be on the innermost enclosing `do`, `for`, `switch`, or
- // `while` statement, then remove the label:
- //
- // ```dart
- // void f() {
- // for (int i = 0; i < 10; i++) {
- // for (int j = 0; j < 10; j++) {
- // break;
- // }
- // }
- // }
- // ```
- //
- // If the label should be on some other statement, then add the label:
- //
- // ```dart
- // void f() {
- // loop: for (int i = 0; i < 10; i++) {
- // for (int j = 0; j < 10; j++) {
- // break loop;
- // }
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the unresolvable label
static const CompileTimeErrorCode LABEL_UNDEFINED = CompileTimeErrorCode(
'LABEL_UNDEFINED',
"Can't reference an undefined label '{0}'.",
@@ -8856,50 +2451,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class that has at least one
- // `const` constructor also has a field marked both `late` and `final`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `A` has a
- // `const` constructor and the `final` field `f` is marked as `late`:
- //
- // ```dart
- // class A {
- // [!late!] final int f;
- //
- // const A();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field doesn't need to be marked `late`, then remove the `late`
- // modifier from the field:
- //
- // ```dart
- // class A {
- // final int f = 0;
- //
- // const A();
- // }
- // ```
- //
- // If the field must be marked `late`, then remove the `const` modifier from
- // the constructors:
- //
- // ```dart
- // class A {
- // late final int f;
- //
- // A();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR =
CompileTimeErrorCode(
'LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR',
@@ -8911,56 +2463,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the analyzer can prove that a
- // local variable marked as both `late` and `final` was already assigned a
- // value at the point where another assignment occurs.
- //
- // Because `final` variables can only be assigned once, subsequent assignments
- // are guaranteed to fail, so they're flagged.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the `final` variable
- // `v` is assigned a value in two places:
- //
- // ```dart
- // int f() {
- // late final int v;
- // v = 0;
- // [!v!] += 1;
- // return v;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you need to be able to reassign the variable, then remove the `final`
- // keyword:
- //
- // ```dart
- // int f() {
- // late int v;
- // v = 0;
- // v += 1;
- // return v;
- // }
- // ```
- //
- // If you don't need to reassign the variable, then remove all except the
- // first of the assignments:
- //
- // ```dart
- // int f() {
- // late final int v;
- // v = 0;
- // return v;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode LATE_FINAL_LOCAL_ALREADY_ASSIGNED =
CompileTimeErrorCode(
'LATE_FINAL_LOCAL_ALREADY_ASSIGNED',
@@ -8970,46 +2473,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the actual type of the list element
- * 1: the expected type of the list element
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type of an element in a list
- // literal isn't assignable to the element type of the list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `2.5` is a double, and
- // the list can hold only integers:
- //
- // ```dart
- // List<int> x = [1, [!2.5!], 3];
- // ```
- //
- // #### Common fixes
- //
- // If you intended to add a different object to the list, then replace the
- // element with an expression that computes the intended object:
- //
- // ```dart
- // List<int> x = [1, 2, 3];
- // ```
- //
- // If the object shouldn't be in the list, then remove the element:
- //
- // ```dart
- // List<int> x = [1, 3];
- // ```
- //
- // If the object being computed is correct, then widen the element type of the
- // list to allow all of the different types of objects it needs to contain:
- //
- // ```dart
- // List<num> x = [1, 2.5, 3];
- // ```
+ /// Parameters:
+ /// 0: the actual type of the list element
+ /// 1: the expected type of the list element
static const CompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE',
@@ -9017,11 +2483,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the message of the exception
- * 1: the stack trace
- */
+ /// Parameters:
+ /// 0: the message of the exception
+ /// 1: the stack trace
static const CompileTimeErrorCode MACRO_EXECUTION_EXCEPTION =
CompileTimeErrorCode(
'MACRO_EXECUTION_EXCEPTION',
@@ -9029,37 +2493,7 @@
correctionMessage: "Re-install the Dart or Flutter SDK.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the first positional parameter
- // of a function named `main` isn't a supertype of `List<String>`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `List<int>` isn't a
- // supertype of `List<String>`:
- //
- // ```dart
- // void main([!List<int>!] args) {}
- // ```
- //
- // #### Common fixes
- //
- // If the function is an entry point, then change the type of the first
- // positional parameter to be a supertype of `List<String>`:
- //
- // ```dart
- // void main(List<String> args) {}
- // ```
- //
- // If the function isn't an entry point, then change the name of the function:
- //
- // ```dart
- // void f(List<int> args) {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode MAIN_FIRST_POSITIONAL_PARAMETER_TYPE =
CompileTimeErrorCode(
'MAIN_FIRST_POSITIONAL_PARAMETER_TYPE',
@@ -9069,36 +2503,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a function named `main` has one
- // or more required named parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function named
- // `main` has a required named parameter (`x`):
- //
- // ```dart
- // void [!main!]({required int x}) {}
- // ```
- //
- // #### Common fixes
- //
- // If the function is an entry point, then remove the `required` keyword:
- //
- // ```dart
- // void main({int? x}) {}
- // ```
- //
- // If the function isn't an entry point, then change the name of the function:
- //
- // ```dart
- // void f({required int x}) {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode MAIN_HAS_REQUIRED_NAMED_PARAMETERS =
CompileTimeErrorCode(
'MAIN_HAS_REQUIRED_NAMED_PARAMETERS',
@@ -9109,45 +2514,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a function named `main` has more
- // than two required positional parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `main` has
- // three required positional parameters:
- //
- // ```dart
- // void [!main!](List<String> args, int x, int y) {}
- // ```
- //
- // #### Common fixes
- //
- // If the function is an entry point and the extra parameters aren't used,
- // then remove them:
- //
- // ```dart
- // void main(List<String> args, int x) {}
- // ```
- //
- // If the function is an entry point, but the extra parameters used are for
- // when the function isn't being used as an entry point, then make the extra
- // parameters optional:
- //
- // ```dart
- // void main(List<String> args, int x, [int y = 0]) {}
- // ```
- //
- // If the function isn't an entry point, then change the name of the function:
- //
- // ```dart
- // void f(List<String> args, int x, int y) {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS = CompileTimeErrorCode(
'MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS',
@@ -9159,30 +2526,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library contains a declaration
- // of the name `main` that isn't the declaration of a top-level function.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `main` is
- // being used to declare a top-level variable:
- //
- // ```dart
- // var [!main!] = 3;
- // ```
- //
- // #### Common fixes
- //
- // Use a different name for the declaration:
- //
- // ```dart
- // var mainIndex = 3;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode MAIN_IS_NOT_FUNCTION = CompileTimeErrorCode(
'MAIN_IS_NOT_FUNCTION',
"The declaration named 'main' must be a function.",
@@ -9190,43 +2534,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a map entry (a key/value pair)
- // is found in a set literal.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the literal has a map
- // entry even though it's a set literal:
- //
- // ```dart
- // const collection = <String>{[!'a' : 'b'!]};
- // ```
- //
- // #### Common fixes
- //
- // If you intended for the collection to be a map, then change the code so
- // that it is a map. In the previous example, you could do this by adding
- // another type argument:
- //
- // ```dart
- // const collection = <String, String>{'a' : 'b'};
- // ```
- //
- // In other cases, you might need to change the explicit type from `Set` to
- // `Map`.
- //
- // If you intended for the collection to be a set, then remove the map entry,
- // possibly by replacing the colon with a comma if both values should be
- // included in the set:
- //
- // ```dart
- // const collection = <String>{'a', 'b'};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode MAP_ENTRY_NOT_IN_MAP = CompileTimeErrorCode(
'MAP_ENTRY_NOT_IN_MAP',
"Map entries can only be used in a map literal.",
@@ -9235,39 +2543,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the expression being used as a key
- * 1: the type of keys declared for the map
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a key of a key-value pair in a
- // map literal has a type that isn't assignable to the key type of the map.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `2` is an `int`, but
- // the keys of the map are required to be `String`s:
- //
- // ```dart
- // var m = <String, String>{[!2!] : 'a'};
- // ```
- //
- // #### Common fixes
- //
- // If the type of the map is correct, then change the key to have the correct
- // type:
- //
- // ```dart
- // var m = <String, String>{'2' : 'a'};
- // ```
- //
- // If the type of the key is correct, then change the key type of the map:
- //
- // ```dart
- // var m = <int, String>{2 : 'a'};
- // ```
+ /// Parameters:
+ /// 0: the type of the expression being used as a key
+ /// 1: the type of keys declared for the map
static const CompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'MAP_KEY_TYPE_NOT_ASSIGNABLE',
@@ -9275,40 +2553,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the expression being used as a value
- * 1: the type of values declared for the map
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a value of a key-value pair in a
- // map literal has a type that isn't assignable to the value type of the
- // map.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `2` is an `int`, but/
- // the values of the map are required to be `String`s:
- //
- // ```dart
- // var m = <String, String>{'a' : [!2!]};
- // ```
- //
- // #### Common fixes
- //
- // If the type of the map is correct, then change the value to have the
- // correct type:
- //
- // ```dart
- // var m = <String, String>{'a' : '2'};
- // ```
- //
- // If the type of the value is correct, then change the value type of the map:
- //
- // ```dart
- // var m = <String, int>{'a' : 2};
- // ```
+ /// Parameters:
+ /// 0: the type of the expression being used as a value
+ /// 1: the type of values declared for the map
static const CompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'MAP_VALUE_TYPE_NOT_ASSIGNABLE',
@@ -9316,54 +2563,37 @@
hasPublishedDocs: true,
);
- /**
- * 12.1 Constants: A constant expression is ... a constant list literal.
- *
- * Note: This diagnostic is never displayed to the user, so it doesn't need
- * to be documented.
- */
+ /// 12.1 Constants: A constant expression is ... a constant list literal.
+ ///
+ /// Note: This diagnostic is never displayed to the user, so it doesn't need
+ /// to be documented.
static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL =
CompileTimeErrorCode(
'MISSING_CONST_IN_LIST_LITERAL',
"Seeing this message constitutes a bug. Please report it.",
);
- /**
- * 12.1 Constants: A constant expression is ... a constant map literal.
- *
- * Note: This diagnostic is never displayed to the user, so it doesn't need
- * to be documented.
- */
+ /// 12.1 Constants: A constant expression is ... a constant map literal.
+ ///
+ /// Note: This diagnostic is never displayed to the user, so it doesn't need
+ /// to be documented.
static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL =
CompileTimeErrorCode(
'MISSING_CONST_IN_MAP_LITERAL',
"Seeing this message constitutes a bug. Please report it.",
);
- /**
- * 12.1 Constants: A constant expression is ... a constant set literal.
- *
- * Note: This diagnostic is never displayed to the user, so it doesn't need
- * to be documented.
- */
+ /// 12.1 Constants: A constant expression is ... a constant set literal.
+ ///
+ /// Note: This diagnostic is never displayed to the user, so it doesn't need
+ /// to be documented.
static const CompileTimeErrorCode MISSING_CONST_IN_SET_LITERAL =
CompileTimeErrorCode(
'MISSING_CONST_IN_SET_LITERAL',
"Seeing this message constitutes a bug. Please report it.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when either the Dart or Flutter SDK
- // isn’t installed correctly, and, as a result, one of the `dart:` libraries
- // can't be found.
- //
- // #### Common fixes
- //
- // Reinstall the Dart or Flutter SDK.
+ /// No parameters.
static const CompileTimeErrorCode MISSING_DART_LIBRARY = CompileTimeErrorCode(
'MISSING_DART_LIBRARY',
"Required library '{0}' is missing.",
@@ -9371,56 +2601,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an optional parameter, whether
- // positional or named, has a [potentially non-nullable][] type and doesn't
- // specify a default value. Optional parameters that have no explicit default
- // value have an implicit default value of `null`. If the type of the
- // parameter doesn't allow the parameter to have a value of `null`, then the
- // implicit default value isn't valid.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` can't be `null`,
- // and no non-`null` default value is specified:
- //
- // ```dart
- // void f([int [!x!]]) {}
- // ```
- //
- // As does this:
- //
- // ```dart
- // void g({int [!x!]}) {}
- // ```
- //
- // #### Common fixes
- //
- // If you want to use `null` to indicate that no value was provided, then you
- // need to make the type nullable:
- //
- // ```dart
- // void f([int? x]) {}
- // void g({int? x}) {}
- // ```
- //
- // If the parameter can't be null, then either provide a default value:
- //
- // ```dart
- // void f([int x = 1]) {}
- // void g({int x = 2}) {}
- // ```
- //
- // or make the parameter a required parameter:
- //
- // ```dart
- // void f(int x) {}
- // void g({required int x}) {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode MISSING_DEFAULT_VALUE_FOR_PARAMETER =
CompileTimeErrorCode(
'MISSING_DEFAULT_VALUE_FOR_PARAMETER',
@@ -9432,9 +2613,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
MISSING_DEFAULT_VALUE_FOR_PARAMETER_WITH_ANNOTATION =
CompileTimeErrorCode(
@@ -9446,37 +2625,8 @@
uniqueName: 'MISSING_DEFAULT_VALUE_FOR_PARAMETER_WITH_ANNOTATION',
);
- /**
- * Parameters:
- * 0: the name of the parameter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an invocation of a function is
- // missing a required named parameter.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the invocation of `f`
- // doesn't include a value for the required named parameter `end`:
- //
- // ```dart
- // void f(int start, {required int end}) {}
- // void g() {
- // [!f!](3);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add a named argument corresponding to the missing required parameter:
- //
- // ```dart
- // void f(int start, {required int end}) {}
- // void g() {
- // f(3, end: 5);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the parameter
static const CompileTimeErrorCode MISSING_REQUIRED_ARGUMENT =
CompileTimeErrorCode(
'MISSING_REQUIRED_ARGUMENT',
@@ -9486,10 +2636,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the class that appears in both "extends" and "with" clauses
- */
+ /// Parameters:
+ /// 0: the name of the class that appears in both "extends" and "with" clauses
static const CompileTimeErrorCode MIXINS_SUPER_CLASS = CompileTimeErrorCode(
'IMPLEMENTS_SUPER_CLASS',
"'{0}' can't be used in both 'extends' and 'with' clauses.",
@@ -9498,107 +2646,10 @@
uniqueName: 'MIXINS_SUPER_CLASS',
);
- /**
- * Parameters:
- * 0: the name of the super-invoked member
- * 1: the display name of the type of the super-invoked member in the mixin
- * 2: the display name of the type of the concrete member in the class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a mixin that invokes a method
- // using `super` is used in a class where the concrete implementation of that
- // method has a different signature than the signature defined for that method
- // by the mixin's `on` type. The reason this is an error is because the
- // invocation in the mixin might invoke the method in a way that's
- // incompatible with the method that will actually be executed.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C` uses the
- // mixin `M`, the mixin `M` invokes `foo` using `super`, and the abstract
- // version of `foo` declared in `I` (the mixin's `on` type) doesn't have the
- // same signature as the concrete version of `foo` declared in `A`:
- //
- // ```dart
- // class I {
- // void foo([int? p]) {}
- // }
- //
- // class A {
- // void foo(int p) {}
- // }
- //
- // abstract class B extends A implements I {
- // @override
- // void foo([int? p]);
- // }
- //
- // mixin M on I {
- // void bar() {
- // super.foo(42);
- // }
- // }
- //
- // abstract class C extends B with [!M!] {}
- // ```
- //
- // #### Common fixes
- //
- // If the class doesn't need to use the mixin, then remove it from the `with`
- // clause:
- //
- // ```dart
- // class I {
- // void foo([int? p]) {}
- // }
- //
- // class A {
- // void foo(int? p) {}
- // }
- //
- // abstract class B extends A implements I {
- // @override
- // void foo([int? p]);
- // }
- //
- // mixin M on I {
- // void bar() {
- // super.foo(42);
- // }
- // }
- //
- // abstract class C extends B {}
- // ```
- //
- // If the class needs to use the mixin, then ensure that there's a concrete
- // implementation of the method that conforms to the signature expected by the
- // mixin:
- //
- // ```dart
- // class I {
- // void foo([int? p]) {}
- // }
- //
- // class A {
- // void foo(int? p) {}
- // }
- //
- // abstract class B extends A implements I {
- // @override
- // void foo([int? p]) {
- // super.foo(p);
- // }
- // }
- //
- // mixin M on I {
- // void bar() {
- // super.foo(42);
- // }
- // }
- //
- // abstract class C extends B with M {}
- // ```
+ /// Parameters:
+ /// 0: the name of the super-invoked member
+ /// 1: the display name of the type of the super-invoked member in the mixin
+ /// 2: the display name of the type of the concrete member in the class
static const CompileTimeErrorCode
MIXIN_APPLICATION_CONCRETE_SUPER_INVOKED_MEMBER_TYPE =
CompileTimeErrorCode(
@@ -9608,44 +2659,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the display name of the mixin
- * 1: the display name of the superclass
- * 2: the display name of the type that is not implemented
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a mixin that has a superclass
- // constraint is used in a [mixin application][] with a superclass that
- // doesn't implement the required constraint.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the mixin `M` requires
- // that the class to which it's applied be a subclass of `A`, but `Object`
- // isn't a subclass of `A`:
- //
- // ```dart
- // class A {}
- //
- // mixin M on A {}
- //
- // class X = Object with [!M!];
- // ```
- //
- // #### Common fixes
- //
- // If you need to use the mixin, then change the superclass to be either the
- // same as or a subclass of the superclass constraint:
- //
- // ```dart
- // class A {}
- //
- // mixin M on A {}
- //
- // class X = A with M;
- // ```
+ /// Parameters:
+ /// 0: the display name of the mixin
+ /// 1: the display name of the superclass
+ /// 2: the display name of the type that is not implemented
static const CompileTimeErrorCode
MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE = CompileTimeErrorCode(
'MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE',
@@ -9654,77 +2671,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the display name of the member without a concrete implementation
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a [mixin application][] contains
- // an invocation of a member from its superclass, and there's no concrete
- // member of that name in the mixin application's superclass.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the mixin `M` contains
- // the invocation `super.m()`, and the class `A`, which is the superclass of
- // the [mixin application][] `A+M`, doesn't define a concrete implementation
- // of `m`:
- //
- // ```dart
- // abstract class A {
- // void m();
- // }
- //
- // mixin M on A {
- // void bar() {
- // super.m();
- // }
- // }
- //
- // abstract class B extends A with [!M!] {}
- // ```
- //
- // #### Common fixes
- //
- // If you intended to apply the mixin `M` to a different class, one that has a
- // concrete implementation of `m`, then change the superclass of `B` to that
- // class:
- //
- // ```dart
- // abstract class A {
- // void m();
- // }
- //
- // mixin M on A {
- // void bar() {
- // super.m();
- // }
- // }
- //
- // class C implements A {
- // void m() {}
- // }
- //
- // abstract class B extends C with M {}
- // ```
- //
- // If you need to make `B` a subclass of `A`, then add a concrete
- // implementation of `m` in `A`:
- //
- // ```dart
- // abstract class A {
- // void m() {}
- // }
- //
- // mixin M on A {
- // void bar() {
- // super.m();
- // }
- // }
- //
- // abstract class B extends A with M {}
- // ```
+ /// Parameters:
+ /// 0: the display name of the member without a concrete implementation
static const CompileTimeErrorCode
MIXIN_APPLICATION_NO_CONCRETE_SUPER_INVOKED_MEMBER = CompileTimeErrorCode(
'MIXIN_APPLICATION_NO_CONCRETE_SUPER_INVOKED_MEMBER',
@@ -9733,59 +2681,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the mixin that is invalid
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class is used as a mixin and
- // the mixed-in class defines a constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `A`, which
- // defines a constructor, is being used as a mixin:
- //
- // ```dart
- // class A {
- // A();
- // }
- //
- // class B with [!A!] {}
- // ```
- //
- // #### Common fixes
- //
- // If it's possible to convert the class to a mixin, then do so:
- //
- // ```dart
- // mixin A {
- // }
- //
- // class B with A {}
- // ```
- //
- // If the class can't be a mixin and it's possible to remove the constructor,
- // then do so:
- //
- // ```dart
- // class A {
- // }
- //
- // class B with A {}
- // ```
- //
- // If the class can't be a mixin and you can't remove the constructor, then
- // try extending or implementing the class rather than mixing it in:
- //
- // ```dart
- // class A {
- // A();
- // }
- //
- // class B extends A {}
- // ```
+ /// Parameters:
+ /// 0: the name of the mixin that is invalid
static const CompileTimeErrorCode MIXIN_CLASS_DECLARES_CONSTRUCTOR =
CompileTimeErrorCode(
'MIXIN_CLASS_DECLARES_CONSTRUCTOR',
@@ -9794,9 +2691,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = CompileTimeErrorCode(
'SUBTYPE_OF_DEFERRED_CLASS',
"Classes can't mixin deferred classes.",
@@ -9805,64 +2700,8 @@
uniqueName: 'MIXIN_DEFERRED_CLASS',
);
- /**
- * Parameters:
- * 0: the name of the mixin that is invalid
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class that extends a class
- // other than `Object` is used as a mixin.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `B`, which
- // extends `A`, is being used as a mixin by `C`:
- //
- // ```dart
- // class A {}
- //
- // class B extends A {}
- //
- // class C with [!B!] {}
- // ```
- //
- // #### Common fixes
- //
- // If the class being used as a mixin can be changed to extend `Object`, then
- // change it:
- //
- // ```dart
- // class A {}
- //
- // class B {}
- //
- // class C with B {}
- // ```
- //
- // If the class being used as a mixin can't be changed and the class that's
- // using it extends `Object`, then extend the class being used as a mixin:
- //
- // ```dart
- // class A {}
- //
- // class B extends A {}
- //
- // class C extends B {}
- // ```
- //
- // If the class doesn't extend `Object` or if you want to be able to mix in
- // the behavior from `B` in other places, then create a real mixin:
- //
- // ```dart
- // class A {}
- //
- // mixin M on A {}
- //
- // class B extends A with M {}
- //
- // class C extends A with M {}
- // ```
+ /// Parameters:
+ /// 0: the name of the mixin that is invalid
static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT =
CompileTimeErrorCode(
'MIXIN_INHERITS_FROM_NOT_OBJECT',
@@ -9871,38 +2710,15 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a mixin is instantiated.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the mixin `M` is being
- // instantiated:
- //
- // ```dart
- // mixin M {}
- //
- // var m = [!M!]();
- // ```
- //
- // #### Common fixes
- //
- // If you intend to use an instance of a class, then use the name of that
- // class in place of the name of the mixin.
+ /// No parameters.
static const CompileTimeErrorCode MIXIN_INSTANTIATE = CompileTimeErrorCode(
'MIXIN_INSTANTIATE',
"Mixins can't be instantiated.",
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the disallowed type
- */
+ /// Parameters:
+ /// 0: the name of the disallowed type
static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS =
CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
@@ -9914,44 +2730,14 @@
uniqueName: 'MIXIN_OF_DISALLOWED_CLASS',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name in a `with` clause is
- // defined to be something other than a mixin or a class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `F` is defined to be a
- // function type:
- //
- // ```dart
- // typedef F = int Function(String);
- //
- // class C with [!F!] {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the invalid name from the list, possibly replacing it with the name
- // of the intended mixin or class:
- //
- // ```dart
- // typedef F = int Function(String);
- //
- // class C {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = CompileTimeErrorCode(
'MIXIN_OF_NON_CLASS',
"Classes can only mix in mixins and classes.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
MIXIN_OF_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
@@ -9960,9 +2746,7 @@
uniqueName: 'MIXIN_OF_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
MIXIN_ON_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
@@ -9972,9 +2756,7 @@
uniqueName: 'MIXIN_ON_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
MIXIN_SUPER_CLASS_CONSTRAINT_DEFERRED_CLASS = CompileTimeErrorCode(
'MIXIN_SUPER_CLASS_CONSTRAINT_DEFERRED_CLASS',
@@ -9982,10 +2764,8 @@
correctionMessage: "Try changing the import to not be deferred.",
);
- /**
- * Parameters:
- * 0: the name of the disallowed type
- */
+ /// Parameters:
+ /// 0: the name of the disallowed type
static const CompileTimeErrorCode
MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS = CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
@@ -9997,31 +2777,7 @@
uniqueName: 'MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type following the `on`
- // keyword in a mixin declaration is neither a class nor a mixin.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `F` is neither a class
- // nor a mixin:
- //
- // ```dart
- // typedef F = void Function();
- //
- // mixin M on [!F!] {}
- // ```
- //
- // #### Common fixes
- //
- // If the type was intended to be a class but was mistyped, then replace the
- // name.
- //
- // Otherwise, remove the type from the `on` clause.
+ /// No parameters.
static const CompileTimeErrorCode MIXIN_SUPER_CLASS_CONSTRAINT_NON_INTERFACE =
CompileTimeErrorCode(
'MIXIN_SUPER_CLASS_CONSTRAINT_NON_INTERFACE',
@@ -10029,48 +2785,15 @@
hasPublishedDocs: true,
);
- /**
- * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not
- * denote a class available in the immediately enclosing scope.
- */
+ /// 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not
+ /// denote a class available in the immediately enclosing scope.
static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS =
CompileTimeErrorCode(
'MIXIN_WITH_NON_CLASS_SUPERCLASS',
"Mixin can only be applied to class.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor redirects to more
- // than one other constructor in the same class (using `this`).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the unnamed
- // constructor in `C` is redirecting to both `this.a` and `this.b`:
- //
- // ```dart
- // class C {
- // C() : this.a(), [!this.b()!];
- // C.a();
- // C.b();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove all but one of the redirections:
- //
- // ```dart
- // class C {
- // C() : this.a();
- // C.a();
- // C.b();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = CompileTimeErrorCode(
'MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS',
@@ -10079,90 +2802,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the initializer list of a
- // constructor contains more than one invocation of a constructor from the
- // superclass. The initializer list is required to have exactly one such call,
- // which can either be explicit or implicit.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the initializer list
- // for `B`’s constructor invokes both the constructor `one` and the
- // constructor `two` from the superclass `A`:
- //
- // ```dart
- // class A {
- // int? x;
- // String? s;
- // A.one(this.x);
- // A.two(this.s);
- // }
- //
- // class B extends A {
- // B() : super.one(0), [!super.two('')!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If one of the super constructors will initialize the instance fully, then
- // remove the other:
- //
- // ```dart
- // class A {
- // int? x;
- // String? s;
- // A.one(this.x);
- // A.two(this.s);
- // }
- //
- // class B extends A {
- // B() : super.one(0);
- // }
- // ```
- //
- // If the initialization achieved by one of the super constructors can be
- // performed in the body of the constructor, then remove its super invocation
- // and perform the initialization in the body:
- //
- // ```dart
- // class A {
- // int? x;
- // String? s;
- // A.one(this.x);
- // A.two(this.s);
- // }
- //
- // class B extends A {
- // B() : super.one(0) {
- // s = '';
- // }
- // }
- // ```
- //
- // If the initialization can only be performed in a constructor in the
- // superclass, then either add a new constructor or modify one of the existing
- // constructors so there's a constructor that allows all the required
- // initialization to occur in a single call:
- //
- // ```dart
- // class A {
- // int? x;
- // String? s;
- // A.one(this.x);
- // A.two(this.s);
- // A.three(this.x, this.s);
- // }
- //
- // class B extends A {
- // B() : super.three(0, '');
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS =
CompileTimeErrorCode(
'MULTIPLE_SUPER_INITIALIZERS',
@@ -10171,51 +2811,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the non-type element
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an instance creation using
- // either `new` or `const` specifies a name that isn't defined as a class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is a function
- // rather than a class:
- //
- // ```dart
- // int f() => 0;
- //
- // void g() {
- // new [!f!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If a class should be created, then replace the invalid name with the name
- // of a valid class:
- //
- // ```dart
- // int f() => 0;
- //
- // void g() {
- // new Object();
- // }
- // ```
- //
- // If the name is the name of a function and you want that function to be
- // invoked, then remove the `new` or `const` keyword:
- //
- // ```dart
- // int f() => 0;
- //
- // void g() {
- // f();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the non-type element
static const CompileTimeErrorCode NEW_WITH_NON_TYPE = CompileTimeErrorCode(
'CREATION_WITH_NON_TYPE',
"The name '{0}' isn't a class.",
@@ -10225,19 +2822,17 @@
uniqueName: 'NEW_WITH_NON_TYPE',
);
- /**
- * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
- * current scope then:
- * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …,
- * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …,
- * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a static warning if
- * <i>T.id</i> is not the name of a constructor declared by the type
- * <i>T</i>.
- * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>,
- * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>:
- * a<sub>n+kM/sub>)</i> it is a static warning if the type <i>T</i> does not
- * declare a constructor with the same name as the declaration of <i>T</i>.
- */
+ /// 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
+ /// current scope then:
+ /// 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …,
+ /// a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …,
+ /// x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a static warning if
+ /// <i>T.id</i> is not the name of a constructor declared by the type
+ /// <i>T</i>.
+ /// If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>,
+ /// x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>:
+ /// a<sub>n+kM/sub>)</i> it is a static warning if the type <i>T</i> does not
+ /// declare a constructor with the same name as the declaration of <i>T</i>.
static const CompileTimeErrorCode NEW_WITH_UNDEFINED_CONSTRUCTOR =
CompileTimeErrorCode(
'NEW_WITH_UNDEFINED_CONSTRUCTOR',
@@ -10247,52 +2842,8 @@
"'{1}'.",
);
- /**
- * Parameters:
- * 0: the name of the class being instantiated
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an unnamed constructor is
- // invoked on a class that defines named constructors but the class doesn’t
- // have an unnamed constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A` doesn't define an
- // unnamed constructor:
- //
- // ```dart
- // class A {
- // A.a();
- // }
- //
- // A f() => [!A!]();
- // ```
- //
- // #### Common fixes
- //
- // If one of the named constructors does what you need, then use it:
- //
- // ```dart
- // class A {
- // A.a();
- // }
- //
- // A f() => A.a();
- // ```
- //
- // If none of the named constructors does what you need, and you're able to
- // add an unnamed constructor, then add the constructor:
- //
- // ```dart
- // class A {
- // A();
- // A.a();
- // }
- //
- // A f() => A();
- // ```
+ /// Parameters:
+ /// 0: the name of the class being instantiated
static const CompileTimeErrorCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT =
CompileTimeErrorCode(
'NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
@@ -10302,14 +2853,12 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the first member
- * 1: the name of the second member
- * 2: the name of the third member
- * 3: the name of the fourth member
- * 4: the number of additional missing members that aren't listed
- */
+ /// Parameters:
+ /// 0: the name of the first member
+ /// 1: the name of the second member
+ /// 2: the name of the third member
+ /// 3: the name of the fourth member
+ /// 4: the number of additional missing members that aren't listed
static const CompileTimeErrorCode
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS =
CompileTimeErrorCode(
@@ -10322,13 +2871,11 @@
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS',
);
- /**
- * Parameters:
- * 0: the name of the first member
- * 1: the name of the second member
- * 2: the name of the third member
- * 3: the name of the fourth member
- */
+ /// Parameters:
+ /// 0: the name of the first member
+ /// 1: the name of the second member
+ /// 2: the name of the third member
+ /// 3: the name of the fourth member
static const CompileTimeErrorCode
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
@@ -10339,69 +2886,8 @@
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR',
);
- /**
- * Parameters:
- * 0: the name of the member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a concrete class inherits one or
- // more abstract members, and doesn't provide or inherit an implementation for
- // at least one of those abstract members.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `B` doesn't
- // have a concrete implementation of `m`:
- //
- // ```dart
- // abstract class A {
- // void m();
- // }
- //
- // class [!B!] extends A {}
- // ```
- //
- // #### Common fixes
- //
- // If the subclass can provide a concrete implementation for some or all of
- // the abstract inherited members, then add the concrete implementations:
- //
- // ```dart
- // abstract class A {
- // void m();
- // }
- //
- // class B extends A {
- // void m() {}
- // }
- // ```
- //
- // If there is a mixin that provides an implementation of the inherited
- // methods, then apply the mixin to the subclass:
- //
- // ```dart
- // abstract class A {
- // void m();
- // }
- //
- // class B extends A with M {}
- //
- // mixin M {
- // void m() {}
- // }
- // ```
- //
- // If the subclass can't provide a concrete implementation for all of the
- // abstract inherited members, then mark the subclass as being abstract:
- //
- // ```dart
- // abstract class A {
- // void m();
- // }
- //
- // abstract class B extends A {}
- // ```
+ /// Parameters:
+ /// 0: the name of the member
static const CompileTimeErrorCode
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
@@ -10412,12 +2898,10 @@
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE',
);
- /**
- * Parameters:
- * 0: the name of the first member
- * 1: the name of the second member
- * 2: the name of the third member
- */
+ /// Parameters:
+ /// 0: the name of the first member
+ /// 1: the name of the second member
+ /// 2: the name of the third member
static const CompileTimeErrorCode
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
@@ -10428,11 +2912,9 @@
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE',
);
- /**
- * Parameters:
- * 0: the name of the first member
- * 1: the name of the second member
- */
+ /// Parameters:
+ /// 0: the name of the first member
+ /// 1: the name of the second member
static const CompileTimeErrorCode
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
@@ -10443,38 +2925,7 @@
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a condition, such as an `if` or
- // `while` loop, doesn't have the static type `bool`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` has the static type
- // `int`:
- //
- // ```dart
- // void f(int x) {
- // if ([!x!]) {
- // // ...
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the condition so that it produces a Boolean value:
- //
- // ```dart
- // void f(int x) {
- // if (x == 0) {
- // // ...
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_BOOL_CONDITION = CompileTimeErrorCode(
'NON_BOOL_CONDITION',
"Conditions must have a static type of 'bool'.",
@@ -10482,34 +2933,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the first expression in an
- // assert has a type other than `bool`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of `p` is
- // `int`, but a `bool` is required:
- //
- // ```dart
- // void f(int p) {
- // assert([!p!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the expression so that it has the type `bool`:
- //
- // ```dart
- // void f(int p) {
- // assert(p > 0);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_BOOL_EXPRESSION = CompileTimeErrorCode(
'NON_BOOL_EXPRESSION',
"The expression in an assert must be of type 'bool'.",
@@ -10517,32 +2941,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the operand of the unary
- // negation operator (`!`) doesn't have the type `bool`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` is an `int` when it
- // must be a `bool`:
- //
- // ```dart
- // int x = 0;
- // bool y = ![!x!];
- // ```
- //
- // #### Common fixes
- //
- // Replace the operand with an expression that has the type `bool`:
- //
- // ```dart
- // int x = 0;
- // bool y = !(x > 0);
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_BOOL_NEGATION_EXPRESSION =
CompileTimeErrorCode(
'NON_BOOL_NEGATION_EXPRESSION',
@@ -10551,80 +2950,15 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the lexeme of the logical operator
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when one of the operands of either
- // the `&&` or `||` operator doesn't have the type `bool`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `a` isn't a Boolean
- // value:
- //
- // ```dart
- // int a = 3;
- // bool b = [!a!] || a > 1;
- // ```
- //
- // #### Common fixes
- //
- // Change the operand to a Boolean value:
- //
- // ```dart
- // int a = 3;
- // bool b = a == 0 || a > 1;
- // ```
+ /// Parameters:
+ /// 0: the lexeme of the logical operator
static const CompileTimeErrorCode NON_BOOL_OPERAND = CompileTimeErrorCode(
'NON_BOOL_OPERAND',
"The operands of the operator '{0}' must be assignable to 'bool'.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an annotation is the invocation
- // of an existing constructor even though the invoked constructor isn't a
- // const constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor for `C`
- // isn't a const constructor:
- //
- // ```dart
- // [!@C()!]
- // void f() {
- // }
- //
- // class C {
- // C();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If it's valid for the class to have a const constructor, then create a
- // const constructor that can be used for the annotation:
- //
- // ```dart
- // @C()
- // void f() {
- // }
- //
- // class C {
- // const C();
- // }
- // ```
- //
- // If it isn't valid for the class to have a const constructor, then either
- // remove the annotation or use a different class for the annotation.
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR =
CompileTimeErrorCode(
'NON_CONSTANT_ANNOTATION_CONSTRUCTOR',
@@ -10632,40 +2966,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the expression in a `case`
- // clause isn't a constant expression.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `j` isn't a constant:
- //
- // ```dart
- // void f(int i, int j) {
- // switch (i) {
- // case [!j!]:
- // // ...
- // break;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Either make the expression a constant expression, or rewrite the `switch`
- // statement as a sequence of `if` statements:
- //
- // ```dart
- // void f(int i, int j) {
- // if (i == j) {
- // // ...
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION =
CompileTimeErrorCode(
'NON_CONSTANT_CASE_EXPRESSION',
@@ -10673,88 +2974,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the expression in a case clause
- // references a constant from a library that is imported using a deferred
- // import. In order for switch statements to be compiled efficiently, the
- // constants referenced in case clauses need to be available at compile time,
- // and constants from deferred libraries aren't available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // Given a file (`a.dart`) that defines the constant `zero`:
- //
- // ```dart
- // %uri="lib/a.dart"
- // const zero = 0;
- // ```
- //
- // The following code produces this diagnostic because the library `a.dart` is
- // imported using a `deferred` import, and the constant `a.zero`, declared in
- // the imported library, is used in a case clause:
- //
- // ```dart
- // import 'a.dart' deferred as a;
- //
- // void f(int x) {
- // switch (x) {
- // case [!a.zero!]:
- // // ...
- // break;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you need to reference the constant from the imported library, then
- // remove the `deferred` keyword:
- //
- // ```dart
- // import 'a.dart' as a;
- //
- // void f(int x) {
- // switch (x) {
- // case a.zero:
- // // ...
- // break;
- // }
- // }
- // ```
- //
- // If you need to reference the constant from the imported library and also
- // need the imported library to be deferred, then rewrite the switch statement
- // as a sequence of `if` statements:
- //
- // ```dart
- // import 'a.dart' deferred as a;
- //
- // void f(int x) {
- // if (x == a.zero) {
- // // ...
- // }
- // }
- // ```
- //
- // If you don't need to reference the constant, then replace the case
- // expression:
- //
- // ```dart
- // void f(int x) {
- // switch (x) {
- // case 0:
- // // ...
- // break;
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY',
@@ -10766,48 +2986,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an optional parameter, either
- // named or positional, has a default value that isn't a compile-time
- // constant.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // %language=2.9
- // var defaultValue = 3;
- //
- // void f([int value = [!defaultValue!]]) {}
- // ```
- //
- // #### Common fixes
- //
- // If the default value can be converted to be a constant, then convert it:
- //
- // ```dart
- // %language=2.9
- // const defaultValue = 3;
- //
- // void f([int value = defaultValue]) {}
- // ```
- //
- // If the default value needs to change over time, then apply the default
- // value inside the function:
- //
- // ```dart
- // %language=2.9
- // var defaultValue = 3;
- //
- // void f([int value]) {
- // value ??= defaultValue;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE =
CompileTimeErrorCode(
'NON_CONSTANT_DEFAULT_VALUE',
@@ -10815,54 +2994,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the default value of an optional
- // parameter uses a constant from a library imported using a deferred import.
- // Default values need to be available at compile time, and constants from
- // deferred libraries aren't available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // Given a file (`a.dart`) that defines the constant `zero`:
- //
- // ```dart
- // %uri="lib/a.dart"
- // const zero = 0;
- // ```
- //
- // The following code produces this diagnostic because `zero` is declared in a
- // library imported using a deferred import:
- //
- // ```dart
- // import 'a.dart' deferred as a;
- //
- // void f({int x = [!a.zero!]}) {}
- // ```
- //
- // #### Common fixes
- //
- // If you need to reference the constant from the imported library, then
- // remove the `deferred` keyword:
- //
- // ```dart
- // import 'a.dart' as a;
- //
- // void f({int x = a.zero}) {}
- // ```
- //
- // If you don't need to reference the constant, then replace the default
- // value:
- //
- // ```dart
- // void f({int x = 0}) {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY',
@@ -10874,46 +3006,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an element in a constant list
- // literal isn't a constant value. The list literal can be constant either
- // explicitly (because it's prefixed by the `const` keyword) or implicitly
- // (because it appears in a [constant context][]).
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` isn't a constant,
- // even though it appears in an implicitly constant list literal:
- //
- // ```dart
- // var x = 2;
- // var y = const <int>[0, 1, [!x!]];
- // ```
- //
- // #### Common fixes
- //
- // If the list needs to be a constant list, then convert the element to be a
- // constant. In the example above, you might add the `const` keyword to the
- // declaration of `x`:
- //
- // ```dart
- // const x = 2;
- // var y = const <int>[0, 1, x];
- // ```
- //
- // If the expression can't be made a constant, then the list can't be a
- // constant either, so you must change the code so that the list isn't a
- // constant. In the example above this means removing the `const` keyword
- // before the list literal:
- //
- // ```dart
- // var x = 2;
- // var y = <int>[0, 1, x];
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT =
CompileTimeErrorCode(
'NON_CONSTANT_LIST_ELEMENT',
@@ -10923,65 +3016,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a collection literal that is
- // either explicitly (because it's prefixed by the `const` keyword) or
- // implicitly (because it appears in a [constant context][]) a constant
- // contains a value that is declared in a library that is imported using a
- // deferred import. Constants are evaluated at compile time, and values from
- // deferred libraries aren't available at compile time.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // Given a file (`a.dart`) that defines the constant `zero`:
- //
- // ```dart
- // %uri="lib/a.dart"
- // const zero = 0;
- // ```
- //
- // The following code produces this diagnostic because the constant list
- // literal contains `a.zero`, which is imported using a `deferred` import:
- //
- // ```dart
- // import 'a.dart' deferred as a;
- //
- // var l = const [[!a.zero!]];
- // ```
- //
- // #### Common fixes
- //
- // If the collection literal isn't required to be constant, then remove the
- // `const` keyword:
- //
- // ```dart
- // import 'a.dart' deferred as a;
- //
- // var l = [a.zero];
- // ```
- //
- // If the collection is required to be constant and the imported constant must
- // be referenced, then remove the keyword `deferred` from the import:
- //
- // ```dart
- // import 'a.dart' as a;
- //
- // var l = const [a.zero];
- // ```
- //
- // If you don't need to reference the constant, then replace it with a
- // suitable value:
- //
- // ```dart
- // var l = const [0];
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
@@ -10994,50 +3029,7 @@
uniqueName: 'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an `if` element or a spread
- // element in a constant map isn't a constant element.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because it's attempting to
- // spread a non-constant map:
- //
- // ```dart
- // var notConst = <int, int>{};
- // var map = const <int, int>{...[!notConst!]};
- // ```
- //
- // Similarly, the following code produces this diagnostic because the
- // condition in the `if` element isn't a constant expression:
- //
- // ```dart
- // bool notConst = true;
- // var map = const <int, int>{if ([!notConst!]) 1 : 2};
- // ```
- //
- // #### Common fixes
- //
- // If the map needs to be a constant map, then make the elements constants.
- // In the spread example, you might do that by making the collection being
- // spread a constant:
- //
- // ```dart
- // const notConst = <int, int>{};
- // var map = const <int, int>{...notConst};
- // ```
- //
- // If the map doesn't need to be a constant map, then remove the `const`
- // keyword:
- //
- // ```dart
- // bool notConst = true;
- // var map = <int, int>{if (notConst) 1 : 2};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_MAP_ELEMENT =
CompileTimeErrorCode(
'NON_CONSTANT_MAP_ELEMENT',
@@ -11046,39 +3038,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a key in a constant map literal
- // isn't a constant value.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `a` isn't a constant:
- //
- // ```dart
- // var a = 'a';
- // var m = const {[!a!]: 0};
- // ```
- //
- // #### Common fixes
- //
- // If the map needs to be a constant map, then make the key a constant:
- //
- // ```dart
- // const a = 'a';
- // var m = const {a: 0};
- // ```
- //
- // If the map doesn't need to be a constant map, then remove the `const`
- // keyword:
- //
- // ```dart
- // var a = 'a';
- // var m = {a: 0};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = CompileTimeErrorCode(
'NON_CONSTANT_MAP_KEY',
"The keys in a const map literal must be constant.",
@@ -11086,9 +3046,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY =
CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
@@ -11101,39 +3059,7 @@
uniqueName: 'NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a value in a constant map
- // literal isn't a constant value.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `a` isn't a constant:
- //
- // ```dart
- // var a = 'a';
- // var m = const {0: [!a!]};
- // ```
- //
- // #### Common fixes
- //
- // If the map needs to be a constant map, then make the key a constant:
- //
- // ```dart
- // const a = 'a';
- // var m = const {0: a};
- // ```
- //
- // If the map doesn't need to be a constant map, then remove the `const`
- // keyword:
- //
- // ```dart
- // var a = 'a';
- // var m = {0: a};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE =
CompileTimeErrorCode(
'NON_CONSTANT_MAP_VALUE',
@@ -11142,9 +3068,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode
NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
@@ -11157,41 +3081,7 @@
uniqueName: 'NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constant set literal contains
- // an element that isn't a compile-time constant.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `i` isn't a constant:
- //
- // ```dart
- // var i = 0;
- //
- // var s = const {[!i!]};
- // ```
- //
- // #### Common fixes
- //
- // If the element can be changed to be a constant, then change it:
- //
- // ```dart
- // const i = 0;
- //
- // var s = const {i};
- // ```
- //
- // If the element can't be a constant, then remove the keyword `const`:
- //
- // ```dart
- // var i = 0;
- //
- // var s = {i};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_CONSTANT_SET_ELEMENT =
CompileTimeErrorCode(
'NON_CONSTANT_SET_ELEMENT',
@@ -11200,35 +3090,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when an enum declaration contains a
- // generative constructor that isn't marked as `const`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor in `E`
- // isn't marked as being `const`:
- //
- // ```dart
- // enum E {
- // e;
- //
- // [!E!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add the `const` keyword before the constructor:
- //
- // ```dart
- // enum E {
- // e;
- //
- // const E();
- // }
- // ```
static const CompileTimeErrorCode NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR =
CompileTimeErrorCode(
'NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR',
@@ -11237,11 +3098,9 @@
hasPublishedDocs: true,
);
- /**
- * 13.2 Expression Statements: It is a compile-time error if a non-constant
- * map literal that has no explicit type arguments appears in a place where a
- * statement is expected.
- */
+ /// 13.2 Expression Statements: It is a compile-time error if a non-constant
+ /// map literal that has no explicit type arguments appears in a place where a
+ /// statement is expected.
static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT =
CompileTimeErrorCode(
'NON_CONST_MAP_AS_EXPRESSION_STATEMENT',
@@ -11249,47 +3108,7 @@
"an expression statement.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an instance field in an enum
- // isn't marked as `final`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the field `f` isn't a
- // final field:
- //
- // ```dart
- // enum E {
- // c;
- //
- // int [!f!] = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the field must be defined for the enum, then mark the field as being
- // `final`:
- //
- // ```dart
- // enum E {
- // c;
- //
- // final int f = 0;
- // }
- // ```
- //
- // If the field can be removed, then remove it:
- //
- // ```dart
- // enum E {
- // c
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_FINAL_FIELD_IN_ENUM =
CompileTimeErrorCode(
'NON_FINAL_FIELD_IN_ENUM',
@@ -11298,50 +3117,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the non-generative constructor
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the initializer list of a
- // constructor invokes a constructor from the superclass, and the invoked
- // constructor is a factory constructor. Only a generative constructor can be
- // invoked in the initializer list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the invocation of the
- // constructor `super.one()` is invoking a factory constructor:
- //
- // ```dart
- // class A {
- // factory A.one() = B;
- // A.two();
- // }
- //
- // class B extends A {
- // B() : [!super.one()!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the super invocation to invoke a generative constructor:
- //
- // ```dart
- // class A {
- // factory A.one() = B;
- // A.two();
- // }
- //
- // class B extends A {
- // B() : super.two();
- // }
- // ```
- //
- // If the generative constructor is the unnamed constructor, and if there are
- // no arguments being passed to it, then you can remove the super invocation.
+ /// Parameters:
+ /// 0: the non-generative constructor
static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR =
CompileTimeErrorCode(
'NON_GENERATIVE_CONSTRUCTOR',
@@ -11352,76 +3129,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the superclass
- * 1: the name of the current class
- * 2: the implicitly called factory constructor of the superclass
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class has an implicit
- // generative constructor and the superclass has an explicit unnamed factory
- // constructor. The implicit constructor in the subclass implicitly invokes
- // the unnamed constructor in the superclass, but generative constructors can
- // only invoke another generative constructor, not a factory constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the implicit
- // constructor in `B` invokes the unnamed constructor in `A`, but the
- // constructor in `A` is a factory constructor, when a generative constructor
- // is required:
- //
- // ```dart
- // class A {
- // factory A() => throw 0;
- // A.named();
- // }
- //
- // class [!B!] extends A {}
- // ```
- //
- // #### Common fixes
- //
- // If the unnamed constructor in the superclass can be a generative
- // constructor, then change it to be a generative constructor:
- //
- // ```dart
- // class A {
- // A();
- // A.named();
- // }
- //
- // class B extends A { }
- // ```
- //
- // If the unnamed constructor can't be a generative constructor and there are
- // other generative constructors in the superclass, then explicitly invoke
- // one of them:
- //
- // ```dart
- // class A {
- // factory A() => throw 0;
- // A.named();
- // }
- //
- // class B extends A {
- // B() : super.named();
- // }
- // ```
- //
- // If there are no generative constructors that can be used and none can be
- // added, then implement the superclass rather than extending it:
- //
- // ```dart
- // class A {
- // factory A() => throw 0;
- // A.named();
- // }
- //
- // class B implements A {}
- // ```
+ /// Parameters:
+ /// 0: the name of the superclass
+ /// 1: the name of the current class
+ /// 2: the implicitly called factory constructor of the superclass
static const CompileTimeErrorCode NON_GENERATIVE_IMPLICIT_CONSTRUCTOR =
CompileTimeErrorCode(
'NON_GENERATIVE_IMPLICIT_CONSTRUCTOR',
@@ -11435,88 +3146,15 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the body of a factory
- // constructor is marked with `async`, `async*`, or `sync*`. All constructors,
- // including factory constructors, are required to return an instance of the
- // class in which they're declared, not a `Future`, `Stream`, or `Iterator`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of the factory
- // constructor is marked with `async`:
- //
- // ```dart
- // class C {
- // factory C() [!async!] {
- // return C._();
- // }
- // C._();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the member must be declared as a factory constructor, then remove the
- // keyword appearing before the body:
- //
- // ```dart
- // class C {
- // factory C() {
- // return C._();
- // }
- // C._();
- // }
- // ```
- //
- // If the member must return something other than an instance of the enclosing
- // class, then make the member a static method:
- //
- // ```dart
- // class C {
- // static Future<C> m() async {
- // return C._();
- // }
- // C._();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_SYNC_FACTORY = CompileTimeErrorCode(
'NON_SYNC_FACTORY',
"Factory bodies can't use 'async', 'async*', or 'sync*'.",
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name appearing where a type is expected
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an identifier that isn't a type
- // is used as a type argument.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` is a variable, not
- // a type:
- //
- // ```dart
- // var x = 0;
- // List<[!x!]> xList = [];
- // ```
- //
- // #### Common fixes
- //
- // Change the type argument to be a type:
- //
- // ```dart
- // var x = 0;
- // List<int> xList = [];
- // ```
+ /// Parameters:
+ /// 0: the name appearing where a type is expected
static const CompileTimeErrorCode NON_TYPE_AS_TYPE_ARGUMENT =
CompileTimeErrorCode(
'NON_TYPE_AS_TYPE_ARGUMENT',
@@ -11528,45 +3166,8 @@
isUnresolvedIdentifier: true,
);
- /**
- * Parameters:
- * 0: the name of the non-type element
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the identifier following the
- // `on` in a `catch` clause is defined to be something other than a type.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is a function, not
- // a type:
- //
- // ```dart
- // %language=2.9
- // void f() {
- // try {
- // // ...
- // } on [!f!] {
- // // ...
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the name to the type of object that should be caught:
- //
- // ```dart
- // %language=2.9
- // void f() {
- // try {
- // // ...
- // } on FormatException {
- // // ...
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the non-type element
static const CompileTimeErrorCode NON_TYPE_IN_CATCH_CLAUSE =
CompileTimeErrorCode(
'NON_TYPE_IN_CATCH_CLAUSE',
@@ -11575,34 +3176,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a declaration of the operator
- // `[]=` has a return type other than `void`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the declaration of the
- // operator `[]=` has a return type of `int`:
- //
- // ```dart
- // class C {
- // [!int!] operator []=(int index, int value) => 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the return type to `void`:
- //
- // ```dart
- // class C {
- // void operator []=(int index, int value) => 0;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_VOID_RETURN_FOR_OPERATOR =
CompileTimeErrorCode(
'NON_VOID_RETURN_FOR_OPERATOR',
@@ -11611,34 +3185,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a setter is defined with a
- // return type other than `void`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the setter `p` has a
- // return type of `int`:
- //
- // ```dart
- // class C {
- // [!int!] set p(int i) => 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the return type to `void` or omit the return type:
- //
- // ```dart
- // class C {
- // set p(int i) => 0;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NON_VOID_RETURN_FOR_SETTER =
CompileTimeErrorCode(
'NON_VOID_RETURN_FOR_SETTER',
@@ -11649,119 +3196,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the variable that is invalid
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a local variable is referenced
- // and has all these characteristics:
- // - Has a type that's [potentially non-nullable][].
- // - Doesn't have an initializer.
- // - Isn't marked as `late`.
- // - The analyzer can't prove that the local variable will be assigned before
- // the reference based on the specification of [definite assignment][].
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` can't have a value
- // of `null`, but is referenced before a value was assigned to it:
- //
- // ```dart
- // String f() {
- // int x;
- // return [!x!].toString();
- // }
- // ```
- //
- // The following code produces this diagnostic because the assignment to `x`
- // might not be executed, so it might have a value of `null`:
- //
- // ```dart
- // int g(bool b) {
- // int x;
- // if (b) {
- // x = 1;
- // }
- // return [!x!] * 2;
- // }
- // ```
- //
- // The following code produces this diagnostic because the analyzer can't
- // prove, based on definite assignment analysis, that `x` won't be referenced
- // without having a value assigned to it:
- //
- // ```dart
- // int h(bool b) {
- // int x;
- // if (b) {
- // x = 1;
- // }
- // if (b) {
- // return [!x!] * 2;
- // }
- // return 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If `null` is a valid value, then make the variable nullable:
- //
- // ```dart
- // String f() {
- // int? x;
- // return x!.toString();
- // }
- // ```
- //
- // If `null` isn’t a valid value, and there's a reasonable default value, then
- // add an initializer:
- //
- // ```dart
- // int g(bool b) {
- // int x = 2;
- // if (b) {
- // x = 1;
- // }
- // return x * 2;
- // }
- // ```
- //
- // Otherwise, ensure that a value was assigned on every possible code path
- // before the value is accessed:
- //
- // ```dart
- // int g(bool b) {
- // int x;
- // if (b) {
- // x = 1;
- // } else {
- // x = 2;
- // }
- // return x * 2;
- // }
- // ```
- //
- // You can also mark the variable as `late`, which removes the diagnostic, but
- // if the variable isn't assigned a value before it's accessed, then it
- // results in an exception being thrown at runtime. This approach should only
- // be used if you're sure that the variable will always be assigned, even
- // though the analyzer can't prove it based on definite assignment analysis.
- //
- // ```dart
- // int h(bool b) {
- // late int x;
- // if (b) {
- // x = 1;
- // }
- // if (b) {
- // return x * 2;
- // }
- // return 0;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the variable that is invalid
static const CompileTimeErrorCode
NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE =
CompileTimeErrorCode(
@@ -11774,27 +3210,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name that is not a type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name is used as a type but
- // declared to be something other than a type.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is a function:
- //
- // ```dart
- // f() {}
- // g([!f!] v) {}
- // ```
- //
- // #### Common fixes
- //
- // Replace the name with the name of a type.
+ /// Parameters:
+ /// 0: the name that is not a type
static const CompileTimeErrorCode NOT_A_TYPE = CompileTimeErrorCode(
'NOT_A_TYPE',
"{0} isn't a type.",
@@ -11802,70 +3219,17 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the operator that is not a binary operator.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an operator that can only be
- // used as a unary operator is used as a binary operator.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the operator `~` can
- // only be used as a unary operator:
- //
- // ```dart
- // var a = 5 [!~!] 3;
- // ```
- //
- // #### Common fixes
- //
- // Replace the operator with the correct binary operator:
- //
- // ```dart
- // var a = 5 - 3;
- // ```
+ /// Parameters:
+ /// 0: the name of the operator that is not a binary operator.
static const CompileTimeErrorCode NOT_BINARY_OPERATOR = CompileTimeErrorCode(
'NOT_BINARY_OPERATOR',
"'{0}' isn't a binary operator.",
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the expected number of required arguments
- * 1: the actual number of positional arguments given
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function invocation
- // has fewer positional arguments than the number of required positional
- // parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` declares two
- // required parameters, but only one argument is provided:
- //
- // ```dart
- // void f(int a, int b) {}
- // void g() {
- // f[!(0)!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add arguments corresponding to the remaining parameters:
- //
- // ```dart
- // void f(int a, int b) {}
- // void g() {
- // f(0, 1);
- // }
- // ```
+ /// Parameters:
+ /// 0: the expected number of required arguments
+ /// 1: the actual number of positional arguments given
static const CompileTimeErrorCode NOT_ENOUGH_POSITIONAL_ARGUMENTS =
CompileTimeErrorCode(
'NOT_ENOUGH_POSITIONAL_ARGUMENTS',
@@ -11874,77 +3238,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the field that is not initialized
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a field is declared and has all
- // these characteristics:
- // - Has a type that's [potentially non-nullable][]
- // - Doesn't have an initializer
- // - Isn't marked as `late`
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` is implicitly
- // initialized to `null` when it isn't allowed to be `null`:
- //
- // ```dart
- // class C {
- // int [!x!];
- // }
- // ```
- //
- // Similarly, the following code produces this diagnostic because `x` is
- // implicitly initialized to `null`, when it isn't allowed to be `null`, by
- // one of the constructors, even though it's initialized by other
- // constructors:
- //
- // ```dart
- // class C {
- // int x;
- //
- // C(this.x);
- //
- // [!C!].n();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there's a reasonable default value for the field that’s the same for all
- // instances, then add an initializer expression:
- //
- // ```dart
- // class C {
- // int x = 0;
- // }
- // ```
- //
- // If the value of the field should be provided when an instance is created,
- // then add a constructor that sets the value of the field or update an
- // existing constructor:
- //
- // ```dart
- // class C {
- // int x;
- //
- // C(this.x);
- // }
- // ```
- //
- // You can also mark the field as `late`, which removes the diagnostic, but if
- // the field isn't assigned a value before it's accessed, then it results in
- // an exception being thrown at runtime. This approach should only be used if
- // you're sure that the field will always be assigned before it's referenced.
- //
- // ```dart
- // class C {
- // late int x;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the field that is not initialized
static const CompileTimeErrorCode
NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD = CompileTimeErrorCode(
'NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD',
@@ -11955,10 +3250,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the field that is not initialized
- */
+ /// Parameters:
+ /// 0: the name of the field that is not initialized
static const CompileTimeErrorCode
NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD_CONSTRUCTOR =
CompileTimeErrorCode(
@@ -11971,62 +3264,8 @@
uniqueName: 'NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD_CONSTRUCTOR',
);
- /**
- * Parameters:
- * 0: the name of the variable that is invalid
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a static field or top-level
- // variable has a type that's non-nullable and doesn't have an initializer.
- // Fields and variables that don't have an initializer are normally
- // initialized to `null`, but the type of the field or variable doesn't allow
- // it to be set to `null`, so an explicit initializer must be provided.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the field `f` can't be
- // initialized to `null`:
- //
- // ```dart
- // class C {
- // static int [!f!];
- // }
- // ```
- //
- // Similarly, the following code produces this diagnostic because the
- // top-level variable `v` can't be initialized to `null`:
- //
- // ```dart
- // int [!v!];
- // ```
- //
- // #### Common fixes
- //
- // If the field or variable can't be initialized to `null`, then add an
- // initializer that sets it to a non-null value:
- //
- // ```dart
- // class C {
- // static int f = 0;
- // }
- // ```
- //
- // If the field or variable should be initialized to `null`, then change the
- // type to be nullable:
- //
- // ```dart
- // int? v;
- // ```
- //
- // If the field or variable can't be initialized in the declaration but will
- // always be initialized before it's referenced, then mark it as being `late`:
- //
- // ```dart
- // class C {
- // static late int f;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the variable that is invalid
static const CompileTimeErrorCode NOT_INITIALIZED_NON_NULLABLE_VARIABLE =
CompileTimeErrorCode(
'NOT_INITIALIZED_NON_NULLABLE_VARIABLE',
@@ -12035,9 +3274,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode NOT_INSTANTIATED_BOUND =
CompileTimeErrorCode(
'NOT_INSTANTIATED_BOUND',
@@ -12045,118 +3282,28 @@
correctionMessage: "Try adding type arguments to the type parameter bound.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the static type of the
- // expression of a spread element that appears in either a list literal or a
- // set literal doesn't implement the type `Iterable`.
- //
- // #### Example
- //
- // The following code produces this diagnostic:
- //
- // ```dart
- // var m = <String, int>{'a': 0, 'b': 1};
- // var s = <String>{...[!m!]};
- // ```
- //
- // #### Common fixes
- //
- // The most common fix is to replace the expression with one that produces an
- // iterable object:
- //
- // ```dart
- // var m = <String, int>{'a': 0, 'b': 1};
- // var s = <String>{...m.keys};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NOT_ITERABLE_SPREAD = CompileTimeErrorCode(
'NOT_ITERABLE_SPREAD',
"Spread elements in list or set literals must implement 'Iterable'.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the static type of the
- // expression of a spread element that appears in a map literal doesn't
- // implement the type `Map`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `l` isn't a `Map`:
- //
- // ```dart
- // var l = <String>['a', 'b'];
- // var m = <int, String>{...[!l!]};
- // ```
- //
- // #### Common fixes
- //
- // The most common fix is to replace the expression with one that produces a
- // map:
- //
- // ```dart
- // var l = <String>['a', 'b'];
- // var m = <int, String>{...l.asMap()};
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NOT_MAP_SPREAD = CompileTimeErrorCode(
'NOT_MAP_SPREAD',
"Spread elements in map literals must implement 'Map'.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode NOT_NULL_AWARE_NULL_SPREAD =
CompileTimeErrorCode(
'NOT_NULL_AWARE_NULL_SPREAD',
"The Null typed expression can't be used with a non-null-aware spread.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an annotation consists of a
- // single identifier, but that identifier is the name of a class rather than a
- // variable. To create an instance of the class, the identifier must be
- // followed by an argument list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `C` is a class, and a
- // class can't be used as an annotation without invoking a `const` constructor
- // from the class:
- //
- // ```dart
- // class C {
- // const C();
- // }
- //
- // [!@C!]
- // var x;
- // ```
- //
- // #### Common fixes
- //
- // Add the missing argument list:
- //
- // ```dart
- // class C {
- // const C();
- // }
- //
- // @C()
- // var x;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS =
CompileTimeErrorCode(
'NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS',
@@ -12165,62 +3312,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the class where override error was detected
- * 1: the list of candidate signatures which cannot be combined
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there is a method declaration
- // for which one or more types needs to be inferred, and those types can't be
- // inferred because none of the overridden methods has a function type that is
- // a supertype of all the other overridden methods, as specified by
- // [override inference][].
- //
- // #### Example
- //
- // The following code produces this diagnostic because the method `m` declared
- // in the class `C` is missing both the return type and the type of the
- // parameter `a`, and neither of the missing types can be inferred for it:
- //
- // ```dart
- // abstract class A {
- // A m(String a);
- // }
- //
- // abstract class B {
- // B m(int a);
- // }
- //
- // abstract class C implements A, B {
- // [!m!](a);
- // }
- // ```
- //
- // In this example, override inference can't be performed because the
- // overridden methods are incompatible in these ways:
- // - Neither parameter type (`String` and `int`) is a supertype of the other.
- // - Neither return type is a subtype of the other.
- //
- // #### Common fixes
- //
- // If possible, add types to the method in the subclass that are consistent
- // with the types from all the overridden methods:
- //
- // ```dart
- // abstract class A {
- // A m(String a);
- // }
- //
- // abstract class B {
- // B m(int a);
- // }
- //
- // abstract class C implements A, B {
- // C m(Object a);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the class where override error was detected
+ /// 1: the list of candidate signatures which cannot be combined
static const CompileTimeErrorCode NO_COMBINED_SUPER_SIGNATURE =
CompileTimeErrorCode(
'NO_COMBINED_SUPER_SIGNATURE',
@@ -12231,11 +3325,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the superclass that does not define an implicitly invoked
- * constructor
- */
+ /// Parameters:
+ /// 0: the name of the superclass that does not define an implicitly invoked
+ /// constructor
static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT =
CompileTimeErrorCode(
'NO_DEFAULT_SUPER_CONSTRUCTOR',
@@ -12246,12 +3338,10 @@
uniqueName: 'NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT',
);
- /**
- * Parameters:
- * 0: the name of the superclass that does not define an implicitly invoked
- * constructor
- * 1: the name of the subclass that does not contain any explicit constructors
- */
+ /// Parameters:
+ /// 0: the name of the superclass that does not define an implicitly invoked
+ /// constructor
+ /// 1: the name of the subclass that does not contain any explicit constructors
static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT =
CompileTimeErrorCode(
'NO_DEFAULT_SUPER_CONSTRUCTOR',
@@ -12262,70 +3352,9 @@
uniqueName: 'NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT',
);
- /**
- * Parameters:
- * 0: the name of the subclass
- * 1: the name of the superclass
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class that has at least one
- // generative constructor (whether explicit or implicit) has a superclass
- // that doesn't have any generative constructors. Every generative
- // constructor, except the one defined in `Object`, invokes, either
- // explicitly or implicitly, one of the generative constructors from its
- // superclass.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `B` has an
- // implicit generative constructor that can't invoke a generative constructor
- // from `A` because `A` doesn't have any generative constructors:
- //
- // ```dart
- // class A {
- // factory A.none() => throw '';
- // }
- //
- // class B extends [!A!] {}
- // ```
- //
- // #### Common fixes
- //
- // If the superclass should have a generative constructor, then add one:
- //
- // ```dart
- // class A {
- // A();
- // factory A.none() => throw '';
- // }
- //
- // class B extends A {}
- // ```
- //
- // If the subclass shouldn't have a generative constructor, then remove it by
- // adding a factory constructor:
- //
- // ```dart
- // class A {
- // factory A.none() => throw '';
- // }
- //
- // class B extends A {
- // factory B.none() => throw '';
- // }
- // ```
- //
- // If the subclass must have a generative constructor but the superclass
- // can't have one, then implement the superclass instead:
- //
- // ```dart
- // class A {
- // factory A.none() => throw '';
- // }
- //
- // class B implements A {}
- // ```
+ /// Parameters:
+ /// 0: the name of the subclass
+ /// 1: the name of the superclass
static const CompileTimeErrorCode NO_GENERATIVE_CONSTRUCTORS_IN_SUPERCLASS =
CompileTimeErrorCode(
'NO_GENERATIVE_CONSTRUCTORS_IN_SUPERCLASS',
@@ -12339,40 +3368,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class declaration uses an
- // `extends` clause to specify a superclass, and the superclass is followed by
- // a `?`.
- //
- // It isn't valid to specify a nullable superclass because doing so would have
- // no meaning; it wouldn't change either the interface or implementation being
- // inherited by the class containing the `extends` clause.
- //
- // Note, however, that it _is_ valid to use a nullable type as a type argument
- // to the superclass, such as `class A extends B<C?> {}`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A?` is a nullable
- // type, and nullable types can't be used in an `extends` clause:
- //
- // ```dart
- // class A {}
- // class B extends [!A?!] {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the question mark from the type:
- //
- // ```dart
- // class A {}
- // class B extends A {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NULLABLE_TYPE_IN_EXTENDS_CLAUSE =
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_EXTENDS_CLAUSE',
@@ -12381,40 +3377,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class or mixin declaration has
- // an `implements` clause, and an interface is followed by a `?`.
- //
- // It isn't valid to specify a nullable interface because doing so would have
- // no meaning; it wouldn't change the interface being inherited by the class
- // containing the `implements` clause.
- //
- // Note, however, that it _is_ valid to use a nullable type as a type argument
- // to the interface, such as `class A implements B<C?> {}`.
- //
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A?` is a nullable
- // type, and nullable types can't be used in an `implements` clause:
- //
- // ```dart
- // class A {}
- // class B implements [!A?!] {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the question mark from the type:
- //
- // ```dart
- // class A {}
- // class B implements A {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE =
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE',
@@ -12423,41 +3386,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a mixin declaration uses an `on`
- // clause to specify a superclass constraint, and the class that's specified
- // is followed by a `?`.
- //
- // It isn't valid to specify a nullable superclass constraint because doing so
- // would have no meaning; it wouldn't change the interface being depended on
- // by the mixin containing the `on` clause.
- //
- // Note, however, that it _is_ valid to use a nullable type as a type argument
- // to the superclass constraint, such as `mixin A on B<C?> {}`.
- //
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A?` is a nullable type
- // and nullable types can't be used in an `on` clause:
- //
- // ```dart
- // class C {}
- // mixin M on [!C?!] {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the question mark from the type:
- //
- // ```dart
- // class C {}
- // mixin M on C {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NULLABLE_TYPE_IN_ON_CLAUSE =
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_ON_CLAUSE',
@@ -12466,39 +3395,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class or mixin declaration has
- // a `with` clause, and a mixin is followed by a `?`.
- //
- // It isn't valid to specify a nullable mixin because doing so would have no
- // meaning; it wouldn't change either the interface or implementation being
- // inherited by the class containing the `with` clause.
- //
- // Note, however, that it _is_ valid to use a nullable type as a type argument
- // to the mixin, such as `class A with B<C?> {}`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A?` is a nullable
- // type, and nullable types can't be used in a `with` clause:
- //
- // ```dart
- // mixin M {}
- // class C with [!M?!] {}
- // ```
- //
- // #### Common fixes
- //
- // Remove the question mark from the type:
- //
- // ```dart
- // mixin M {}
- // class C with M {}
- // ```
+ /// No parameters.
static const CompileTimeErrorCode NULLABLE_TYPE_IN_WITH_CLAUSE =
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_WITH_CLAUSE',
@@ -12507,60 +3404,16 @@
hasPublishedDocs: true,
);
- /**
- * 7.9 Superclasses: It is a compile-time error to specify an extends clause
- * for class Object.
- */
+ /// 7.9 Superclasses: It is a compile-time error to specify an extends clause
+ /// for class Object.
static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS =
CompileTimeErrorCode(
'OBJECT_CANNOT_EXTEND_ANOTHER_CLASS',
"The class 'Object' can't extend any other class.",
);
- /**
- * Parameters:
- * 0: the name of the interface that is implemented more than once
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the same type is listed in the
- // superclass constraints of a mixin multiple times.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A` is included twice
- // in the superclass constraints for `M`:
- //
- // ```dart
- // mixin M on A, [!A!] {
- // }
- //
- // class A {}
- // class B {}
- // ```
- //
- // #### Common fixes
- //
- // If a different type should be included in the superclass constraints, then
- // replace one of the occurrences with the other type:
- //
- // ```dart
- // mixin M on A, B {
- // }
- //
- // class A {}
- // class B {}
- // ```
- //
- // If no other type was intended, then remove the repeated type name:
- //
- // ```dart
- // mixin M on A {
- // }
- //
- // class A {}
- // class B {}
- // ```
+ /// Parameters:
+ /// 0: the name of the interface that is implemented more than once
static const CompileTimeErrorCode ON_REPEATED = CompileTimeErrorCode(
'ON_REPEATED',
"The type '{0}' can be included in the superclass constraints only once.",
@@ -12569,34 +3422,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when one or more of the parameters in
- // an operator declaration are optional.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the parameter `other`
- // is an optional parameter:
- //
- // ```dart
- // class C {
- // C operator +([[!C? other!]]) => this;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Make all of the parameters be required parameters:
- //
- // ```dart
- // class C {
- // C operator +(C other) => this;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR =
CompileTimeErrorCode(
'OPTIONAL_PARAMETER_IN_OPERATOR',
@@ -12605,42 +3431,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of expected library name
- * 1: the non-matching actual library name from the "part of" declaration
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library attempts to include a
- // file as a part of itself when the other file is a part of a different
- // library.
- //
- // #### Example
- //
- // Given a file named `part.dart` containing
- //
- // ```dart
- // %uri="package:a/part.dart"
- // part of 'library.dart';
- // ```
- //
- // The following code, in any file other than `library.dart`, produces this
- // diagnostic because it attempts to include `part.dart` as a part of itself
- // when `part.dart` is a part of a different library:
- //
- // ```dart
- // part [!'package:a/part.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // If the library should be using a different file as a part, then change the
- // URI in the part directive to be the URI of the other file.
- //
- // If the [part file][] should be a part of this library, then update the URI
- // (or library name) in the part-of directive to be the URI (or name) of the
- // correct library.
+ /// Parameters:
+ /// 0: the name of expected library name
+ /// 1: the non-matching actual library name from the "part of" declaration
static const CompileTimeErrorCode PART_OF_DIFFERENT_LIBRARY =
CompileTimeErrorCode(
'PART_OF_DIFFERENT_LIBRARY',
@@ -12651,48 +3444,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the uri pointing to a non-library declaration
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a part directive is found and
- // the referenced file doesn't have a part-of directive.
- //
- // #### Example
- //
- // Given a file (`a.dart`) containing:
- //
- // ```dart
- // %uri="lib/a.dart"
- // class A {}
- // ```
- //
- // The following code produces this diagnostic because `a.dart` doesn't
- // contain a part-of directive:
- //
- // ```dart
- // part [!'a.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // If the referenced file is intended to be a part of another library, then
- // add a part-of directive to the file:
- //
- // ```dart
- // part of 'test.dart';
- //
- // class A {}
- // ```
- //
- // If the referenced file is intended to be a library, then replace the part
- // directive with an import directive:
- //
- // ```dart
- // import 'a.dart';
- // ```
+ /// Parameters:
+ /// 0: the uri pointing to a non-library declaration
static const CompileTimeErrorCode PART_OF_NON_PART = CompileTimeErrorCode(
'PART_OF_NON_PART',
"The included part '{0}' must have a part-of directive.",
@@ -12700,44 +3453,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the URI of the expected library
- * 1: the non-matching actual library name from the "part of" declaration
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library that doesn't have a
- // `library` directive (and hence has no name) contains a `part` directive
- // and the `part of` directive in the [part file][] uses a name to specify
- // the library that it's a part of.
- //
- // #### Example
- //
- // Given a [part file][] named `part_file.dart` containing the following
- // code:
- //
- // ```dart
- // %uri="lib/part_file.dart"
- // part of lib;
- // ```
- //
- // The following code produces this diagnostic because the library including
- // the [part file][] doesn't have a name even though the [part file][] uses a
- // name to specify which library it's a part of:
- //
- // ```dart
- // part [!'part_file.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // Change the `part of` directive in the [part file][] to specify its library
- // by URI:
- //
- // ```dart
- // part of 'test.dart';
- // ```
+ /// Parameters:
+ /// 0: the URI of the expected library
+ /// 1: the non-matching actual library name from the "part of" declaration
static const CompileTimeErrorCode PART_OF_UNNAMED_LIBRARY =
CompileTimeErrorCode(
'PART_OF_UNNAMED_LIBRARY',
@@ -12749,67 +3467,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when some, but not all, of the
- // positional parameters provided to the constructor of the superclass are
- // using a super parameter.
- //
- // Positional super parameters are associated with positional parameters in
- // the super constructor by their index. That is, the first super parameter
- // is associated with the first positional parameter in the super
- // constructor, the second with the second, and so on. The same is true for
- // positional arguments. Having both positional super parameters and
- // positional arguments means that there are two values associated with the
- // same parameter in the superclass's constructor, and hence isn't allowed.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor
- // `B.new` is using a super parameter to pass one of the required positional
- // parameters to the super constructor in `A`, but is explicitly passing the
- // other in the super constructor invocation:
- //
- // ```dart
- // class A {
- // A(int x, int y);
- // }
- //
- // class B extends A {
- // B(int x, super.[!y!]) : super(x);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If all the positional parameters can be super parameters, then convert the
- // normal positional parameters to be super parameters:
- //
- // ```dart
- // class A {
- // A(int x, int y);
- // }
- //
- // class B extends A {
- // B(super.x, super.y);
- // }
- // ```
- //
- // If some positional parameters can't be super parameters, then convert the
- // super parameters to be normal parameters:
- //
- // ```dart
- // class A {
- // A(int x, int y);
- // }
- //
- // class B extends A {
- // B(int x, int y) : super(x, y);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
POSITIONAL_SUPER_FORMAL_PARAMETER_WITH_POSITIONAL_ARGUMENT =
CompileTimeErrorCode(
@@ -12822,45 +3480,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the prefix
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name is used as both an import
- // prefix and the name of a top-level declaration in the same library.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is used as both an
- // import prefix and the name of a function:
- //
- // ```dart
- // import 'dart:math' as f;
- //
- // int [!f!]() => f.min(0, 1);
- // ```
- //
- // #### Common fixes
- //
- // If you want to use the name for the import prefix, then rename the
- // top-level declaration:
- //
- // ```dart
- // import 'dart:math' as f;
- //
- // int g() => f.min(0, 1);
- // ```
- //
- // If you want to use the name for the top-level declaration, then rename the
- // import prefix:
- //
- // ```dart
- // import 'dart:math' as math;
- //
- // int f() => math.min(0, 1);
- // ```
+ /// Parameters:
+ /// 0: the name of the prefix
static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER =
CompileTimeErrorCode(
'PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER',
@@ -12871,44 +3492,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the prefix
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an import prefix is used by
- // itself, without accessing any of the names declared in the libraries
- // associated with the prefix. Prefixes aren't variables, and therefore can't
- // be used as a value.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the prefix `math` is
- // being used as if it were a variable:
- //
- // ```dart
- // import 'dart:math' as math;
- //
- // void f() {
- // print([!math!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the code is incomplete, then reference something in one of the libraries
- // associated with the prefix:
- //
- // ```dart
- // import 'dart:math' as math;
- //
- // void f() {
- // print(math.pi);
- // }
- // ```
- //
- // If the name is wrong, then correct the name.
+ /// Parameters:
+ /// 0: the name of the prefix
static const CompileTimeErrorCode PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT =
CompileTimeErrorCode(
'PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT',
@@ -12919,54 +3504,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the prefix being shadowed
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an import prefix is used in a
- // context where it isn't visible because it was shadowed by a local
- // declaration.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the prefix `a` is
- // being used to access the class `Future`, but isn't visible because it's
- // shadowed by the parameter `a`:
- //
- // ```dart
- // import 'dart:async' as a;
- //
- // a.Future? f(int a) {
- // [!a!].Future? x;
- // return x;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rename either the prefix:
- //
- // ```dart
- // import 'dart:async' as p;
- //
- // p.Future? f(int a) {
- // p.Future? x;
- // return x;
- // }
- // ```
- //
- // Or rename the local variable:
- //
- // ```dart
- // import 'dart:async' as a;
- //
- // a.Future? f(int p) {
- // a.Future? x;
- // return x;
- // }
- // ```
+ /// Parameters:
+ /// 0: the prefix being shadowed
static const CompileTimeErrorCode PREFIX_SHADOWED_BY_LOCAL_DECLARATION =
CompileTimeErrorCode(
'PREFIX_SHADOWED_BY_LOCAL_DECLARATION',
@@ -12977,55 +3516,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the private name that collides
- * 1: the name of the first mixin
- * 2: the name of the second mixin
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when two mixins that define the same
- // private member are used together in a single class in a library other than
- // the one that defines the mixins.
- //
- // #### Example
- //
- // Given a file named `a.dart` containing the following code:
- //
- // ```dart
- // %uri="lib/a.dart"
- // class A {
- // void _foo() {}
- // }
- //
- // class B {
- // void _foo() {}
- // }
- // ```
- //
- // The following code produces this diagnostic because the classes `A` and `B`
- // both define the method `_foo`:
- //
- // ```dart
- // import 'a.dart';
- //
- // class C extends Object with A, [!B!] {}
- // ```
- //
- // #### Common fixes
- //
- // If you don't need both of the mixins, then remove one of them from the
- // `with` clause:
- //
- // ```dart
- // import 'a.dart';
- //
- // class C extends Object with A, [!B!] {}
- // ```
- //
- // If you need both of the mixins, then rename the conflicting member in one
- // of the two mixins.
+ /// Parameters:
+ /// 0: the private name that collides
+ /// 1: the name of the first mixin
+ /// 2: the name of the second mixin
static const CompileTimeErrorCode PRIVATE_COLLISION_IN_MIXIN_APPLICATION =
CompileTimeErrorCode(
'PRIVATE_COLLISION_IN_MIXIN_APPLICATION',
@@ -13035,34 +3529,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name of a named parameter
- // starts with an underscore.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the named parameter
- // `_x` starts with an underscore:
- //
- // ```dart
- // class C {
- // void m({int [!_x!] = 0}) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rename the parameter so that it doesn't start with an underscore:
- //
- // ```dart
- // class C {
- // void m({int x = 0}) {}
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER =
CompileTimeErrorCode(
'PRIVATE_OPTIONAL_PARAMETER',
@@ -13070,46 +3537,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when a private setter is used in a
- // library where it isn't visible.
- //
- // #### Example
- //
- // Given a file named `a.dart` that contains the following:
- //
- // ```dart
- // %uri="lib/a.dart"
- // class A {
- // static int _f = 0;
- // }
- // ```
- //
- // The following code produces this diagnostic because it references the
- // private setter `_f` even though the setter isn't visible:
- //
- // ```dart
- // import 'a.dart';
- //
- // void f() {
- // A.[!_f!] = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you're able to make the setter public, then do so:
- //
- // ```dart
- // %uri="lib/a.dart"
- // class A {
- // static int f = 0;
- // }
- // ```
- //
- // If you aren't able to make the setter public, then find a different way to
- // implement the code.
static const CompileTimeErrorCode PRIVATE_SETTER = CompileTimeErrorCode(
'PRIVATE_SETTER',
"The setter '{0}' is private and can't be accessed outside the library "
@@ -13118,41 +3545,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when a final local variable that
- // isn't initialized at the declaration site is read at a point where the
- // compiler can't prove that the variable is always initialized before it's
- // referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the final local
- // variable `x` is read (on line 3) when it's possible that it hasn't yet
- // been initialized:
- //
- // ```dart
- // int f() {
- // final int x;
- // return [!x!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Ensure that the variable has been initialized before it's read:
- //
- // ```dart
- // int f(bool b) {
- // final int x;
- // if (b) {
- // x = 0;
- // } else {
- // x = 1;
- // }
- // return x;
- // }
- // ```
static const CompileTimeErrorCode READ_POTENTIALLY_UNASSIGNED_FINAL =
CompileTimeErrorCode(
'READ_POTENTIALLY_UNASSIGNED_FINAL',
@@ -13163,34 +3555,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of a compile-time
- // constant is defined in terms of itself, either directly or indirectly,
- // creating an infinite loop.
- //
- // #### Example
- //
- // The following code produces this diagnostic twice because both of the
- // constants are defined in terms of the other:
- //
- // ```dart
- // const [!secondsPerHour!] = minutesPerHour * 60;
- // const [!minutesPerHour!] = secondsPerHour / 60;
- // ```
- //
- // #### Common fixes
- //
- // Break the cycle by finding an alternative way of defining at least one of
- // the constants:
- //
- // ```dart
- // const secondsPerHour = minutesPerHour * 60;
- // const minutesPerHour = 60;
- // ```
+ /// No parameters.
static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT =
CompileTimeErrorCode(
'RECURSIVE_COMPILE_TIME_CONSTANT',
@@ -13198,98 +3563,13 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- *
- * TODO(scheglov) review this later, there are no explicit "it is a
- * compile-time error" in specification. But it was added to the co19 and
- * there is same error for factories.
- *
- * https://code.google.com/p/dart/issues/detail?id=954
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor redirects to
- // itself, either directly or indirectly, creating an infinite loop.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the generative
- // constructors `C.a` and `C.b` each redirect to the other:
- //
- // ```dart
- // class C {
- // C.a() : [!this.b()!];
- // C.b() : [!this.a()!];
- // }
- // ```
- //
- // The following code produces this diagnostic because the factory
- // constructors `A` and `B` each redirect to the other:
- //
- // ```dart
- // abstract class A {
- // factory A() = [!B!];
- // }
- // class B implements A {
- // factory B() = [!A!];
- // B.named();
- // }
- // ```
- //
- // #### Common fixes
- //
- // In the case of generative constructors, break the cycle by finding defining
- // at least one of the constructors to not redirect to another constructor:
- //
- // ```dart
- // class C {
- // C.a() : this.b();
- // C.b();
- // }
- // ```
- //
- // In the case of factory constructors, break the cycle by defining at least
- // one of the factory constructors to do one of the following:
- //
- // - Redirect to a generative constructor:
- //
- // ```dart
- // abstract class A {
- // factory A() = B;
- // }
- // class B implements A {
- // factory B() = B.named;
- // B.named();
- // }
- // ```
- //
- // - Not redirect to another constructor:
- //
- // ```dart
- // abstract class A {
- // factory A() = B;
- // }
- // class B implements A {
- // factory B() {
- // return B.named();
- // }
- //
- // B.named();
- // }
- // ```
- //
- // - Not be a factory constructor:
- //
- // ```dart
- // abstract class A {
- // factory A() = B;
- // }
- // class B implements A {
- // B();
- // B.named();
- // }
- // ```
+ /// No parameters.
+ ///
+ /// TODO(scheglov) review this later, there are no explicit "it is a
+ /// compile-time error" in specification. But it was added to the co19 and
+ /// there is same error for factories.
+ ///
+ /// https://code.google.com/p/dart/issues/detail?id=954
static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT =
CompileTimeErrorCode(
'RECURSIVE_CONSTRUCTOR_REDIRECT',
@@ -13299,9 +3579,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT =
CompileTimeErrorCode(
'RECURSIVE_CONSTRUCTOR_REDIRECT',
@@ -13312,30 +3590,9 @@
uniqueName: 'RECURSIVE_FACTORY_REDIRECT',
);
- /**
- * Parameters:
- * 0: the name of the class that implements itself recursively
- * 1: a string representation of the implements loop
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's a circularity in the
- // type hierarchy. This happens when a type, either directly or indirectly,
- // is declared to be a subtype of itself.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `A` is
- // declared to be a subtype of `B`, and `B` is a subtype of `A`:
- //
- // ```dart
- // class [!A!] extends B {}
- // class B implements A {}
- // ```
- //
- // #### Common fixes
- //
- // Change the type hierarchy so that there's no circularity.
+ /// Parameters:
+ /// 0: the name of the class that implements itself recursively
+ /// 1: a string representation of the implements loop
static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE =
CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE',
@@ -13343,19 +3600,17 @@
hasPublishedDocs: true,
);
- /**
- * 7.10 Superinterfaces: It is a compile-time error if the interface of a
- * class <i>C</i> is a superinterface of itself.
- *
- * 8.1 Superinterfaces: It is a compile-time error if an interface is a
- * superinterface of itself.
- *
- * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a
- * superclass of itself.
- *
- * Parameters:
- * 0: the name of the class that implements itself recursively
- */
+ /// 7.10 Superinterfaces: It is a compile-time error if the interface of a
+ /// class <i>C</i> is a superinterface of itself.
+ ///
+ /// 8.1 Superinterfaces: It is a compile-time error if an interface is a
+ /// superinterface of itself.
+ ///
+ /// 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a
+ /// superclass of itself.
+ ///
+ /// Parameters:
+ /// 0: the name of the class that implements itself recursively
static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_EXTENDS =
CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE',
@@ -13364,19 +3619,17 @@
uniqueName: 'RECURSIVE_INTERFACE_INHERITANCE_EXTENDS',
);
- /**
- * 7.10 Superinterfaces: It is a compile-time error if the interface of a
- * class <i>C</i> is a superinterface of itself.
- *
- * 8.1 Superinterfaces: It is a compile-time error if an interface is a
- * superinterface of itself.
- *
- * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a
- * superclass of itself.
- *
- * Parameters:
- * 0: the name of the class that implements itself recursively
- */
+ /// 7.10 Superinterfaces: It is a compile-time error if the interface of a
+ /// class <i>C</i> is a superinterface of itself.
+ ///
+ /// 8.1 Superinterfaces: It is a compile-time error if an interface is a
+ /// superinterface of itself.
+ ///
+ /// 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a
+ /// superclass of itself.
+ ///
+ /// Parameters:
+ /// 0: the name of the class that implements itself recursively
static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_IMPLEMENTS =
CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE',
@@ -13385,10 +3638,8 @@
uniqueName: 'RECURSIVE_INTERFACE_INHERITANCE_IMPLEMENTS',
);
- /**
- * Parameters:
- * 0: the name of the mixin that constraints itself recursively
- */
+ /// Parameters:
+ /// 0: the name of the mixin that constraints itself recursively
static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_ON =
CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE',
@@ -13397,19 +3648,17 @@
uniqueName: 'RECURSIVE_INTERFACE_INHERITANCE_ON',
);
- /**
- * 7.10 Superinterfaces: It is a compile-time error if the interface of a
- * class <i>C</i> is a superinterface of itself.
- *
- * 8.1 Superinterfaces: It is a compile-time error if an interface is a
- * superinterface of itself.
- *
- * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a
- * superclass of itself.
- *
- * Parameters:
- * 0: the name of the class that implements itself recursively
- */
+ /// 7.10 Superinterfaces: It is a compile-time error if the interface of a
+ /// class <i>C</i> is a superinterface of itself.
+ ///
+ /// 8.1 Superinterfaces: It is a compile-time error if an interface is a
+ /// superinterface of itself.
+ ///
+ /// 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a
+ /// superclass of itself.
+ ///
+ /// Parameters:
+ /// 0: the name of the class that implements itself recursively
static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_WITH =
CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE',
@@ -13418,44 +3667,7 @@
uniqueName: 'RECURSIVE_INTERFACE_INHERITANCE_WITH',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a generative constructor
- // redirects to a constructor that isn't defined.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor `C.a`
- // redirects to the constructor `C.b`, but `C.b` isn't defined:
- //
- // ```dart
- // class C {
- // C.a() : [!this.b()!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the missing constructor must be called, then define it:
- //
- // ```dart
- // class C {
- // C.a() : this.b();
- // C.b();
- // }
- // ```
- //
- // If the missing constructor doesn't need to be called, then remove the
- // redirect:
- //
- // ```dart
- // class C {
- // C.a();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR =
CompileTimeErrorCode(
'REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR',
@@ -13466,47 +3678,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a generative constructor
- // redirects to a factory constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the generative
- // constructor `C.a` redirects to the factory constructor `C.b`:
- //
- // ```dart
- // class C {
- // C.a() : [!this.b()!];
- // factory C.b() => C.a();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the generative constructor doesn't need to redirect to another
- // constructor, then remove the redirect.
- //
- // ```dart
- // class C {
- // C.a();
- // factory C.b() => C.a();
- // }
- // ```
- //
- // If the generative constructor must redirect to another constructor, then
- // make the other constructor be a generative (non-factory) constructor:
- //
- // ```dart
- // class C {
- // C.a() : this.b();
- // C.b();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR = CompileTimeErrorCode(
'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR',
@@ -13515,45 +3687,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the redirecting constructor
- * 1: the name of the abstract class defining the constructor being redirected to
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor redirects to a
- // constructor in an abstract class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the factory
- // constructor in `A` redirects to a constructor in `B`, but `B` is an
- // abstract class:
- //
- // ```dart
- // class A {
- // factory A() = [!B!];
- // }
- //
- // abstract class B implements A {}
- // ```
- //
- // #### Common fixes
- //
- // If the code redirects to the correct constructor, then change the class so
- // that it isn't abstract:
- //
- // ```dart
- // class A {
- // factory A() = B;
- // }
- //
- // class B implements A {}
- // ```
- //
- // Otherwise, change the factory constructor so that it either redirects to a
- // constructor in a concrete class, or has a concrete implementation.
+ /// Parameters:
+ /// 0: the name of the redirecting constructor
+ /// 1: the name of the abstract class defining the constructor being redirected to
static const CompileTimeErrorCode REDIRECT_TO_ABSTRACT_CLASS_CONSTRUCTOR =
CompileTimeErrorCode(
'REDIRECT_TO_ABSTRACT_CLASS_CONSTRUCTOR',
@@ -13563,77 +3699,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the redirected constructor
- * 1: the name of the redirecting constructor
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a factory constructor attempts
- // to redirect to another constructor, but the two have incompatible
- // parameters. The parameters are compatible if all of the parameters of the
- // redirecting constructor can be passed to the other constructor and if the
- // other constructor doesn't require any parameters that aren't declared by
- // the redirecting constructor.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the constructor for `A`
- // doesn't declare a parameter that the constructor for `B` requires:
- //
- // ```dart
- // abstract class A {
- // factory A() = [!B!];
- // }
- //
- // class B implements A {
- // B(int x);
- // B.zero();
- // }
- // ```
- //
- // The following code produces this diagnostic because the constructor for `A`
- // declares a named parameter (`y`) that the constructor for `B` doesn't
- // allow:
- //
- // ```dart
- // abstract class A {
- // factory A(int x, {int y}) = [!B!];
- // }
- //
- // class B implements A {
- // B(int x);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there's a different constructor that is compatible with the redirecting
- // constructor, then redirect to that constructor:
- //
- // ```dart
- // abstract class A {
- // factory A() = B.zero;
- // }
- //
- // class B implements A {
- // B(int x);
- // B.zero();
- // }
- // ```
- //
- // Otherwise, update the redirecting constructor to be compatible:
- //
- // ```dart
- // abstract class A {
- // factory A(int x) = B;
- // }
- //
- // class B implements A {
- // B(int x);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the redirected constructor
+ /// 1: the name of the redirecting constructor
static const CompileTimeErrorCode REDIRECT_TO_INVALID_FUNCTION_TYPE =
CompileTimeErrorCode(
'REDIRECT_TO_INVALID_FUNCTION_TYPE',
@@ -13642,61 +3710,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the redirected constructor's return type
- * 1: the name of the redirecting constructor's return type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a factory constructor redirects
- // to a constructor whose return type isn't a subtype of the type that the
- // factory constructor is declared to produce.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `A` isn't a subclass
- // of `C`, which means that the value returned by the constructor `A()`
- // couldn't be returned from the constructor `C()`:
- //
- // ```dart
- // class A {}
- //
- // class B implements C {}
- //
- // class C {
- // factory C() = [!A!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the factory constructor is redirecting to a constructor in the wrong
- // class, then update the factory constructor to redirect to the correct
- // constructor:
- //
- // ```dart
- // class A {}
- //
- // class B implements C {}
- //
- // class C {
- // factory C() = B;
- // }
- // ```
- //
- // If the class defining the constructor being redirected to is the class that
- // should be returned, then make it a subtype of the factory's return type:
- //
- // ```dart
- // class A implements C {}
- //
- // class B implements C {}
- //
- // class C {
- // factory C() = A;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the redirected constructor's return type
+ /// 1: the name of the redirecting constructor's return type
static const CompileTimeErrorCode REDIRECT_TO_INVALID_RETURN_TYPE =
CompileTimeErrorCode(
'REDIRECT_TO_INVALID_RETURN_TYPE',
@@ -13706,58 +3722,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the constructor
- * 1: the name of the class containing the constructor
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor redirects to a
- // constructor that doesn't exist.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the factory
- // constructor in `A` redirects to a constructor in `B` that doesn't exist:
- //
- // ```dart
- // class A {
- // factory A() = [!B.name!];
- // }
- //
- // class B implements A {
- // B();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the constructor being redirected to is correct, then define the
- // constructor:
- //
- // ```dart
- // class A {
- // factory A() = B.name;
- // }
- //
- // class B implements A {
- // B();
- // B.name();
- // }
- // ```
- //
- // If a different constructor should be invoked, then update the redirect:
- //
- // ```dart
- // class A {
- // factory A() = B;
- // }
- //
- // class B implements A {
- // B();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the constructor
+ /// 1: the name of the class containing the constructor
static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR =
CompileTimeErrorCode(
'REDIRECT_TO_MISSING_CONSTRUCTOR',
@@ -13768,47 +3735,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the non-type referenced in the redirect
- */
- // #### Description
- //
- // One way to implement a factory constructor is to redirect to another
- // constructor by referencing the name of the constructor. The analyzer
- // produces this diagnostic when the redirect is to something other than a
- // constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is a function:
- //
- // ```dart
- // C f() => throw 0;
- //
- // class C {
- // factory C() = [!f!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the constructor isn't defined, then either define it or replace it with
- // a constructor that is defined.
- //
- // If the constructor is defined but the class that defines it isn't visible,
- // then you probably need to add an import.
- //
- // If you're trying to return the value returned by a function, then rewrite
- // the constructor to return the value from the constructor's body:
- //
- // ```dart
- // C f() => throw 0;
- //
- // class C {
- // factory C() => f();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the non-type referenced in the redirect
static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS =
CompileTimeErrorCode(
'REDIRECT_TO_NON_CLASS',
@@ -13818,47 +3746,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor marked as `const`
- // redirects to a constructor that isn't marked as `const`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor `C.a`
- // is marked as `const` but redirects to the constructor `C.b`, which isn't:
- //
- // ```dart
- // class C {
- // const C.a() : this.[!b!]();
- // C.b();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the non-constant constructor can be marked as `const`, then mark it as
- // `const`:
- //
- // ```dart
- // class C {
- // const C.a() : this.b();
- // const C.b();
- // }
- // ```
- //
- // If the non-constant constructor can't be marked as `const`, then either
- // remove the redirect or remove `const` from the redirecting constructor:
- //
- // ```dart
- // class C {
- // C.a() : this.b();
- // C.b();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR =
CompileTimeErrorCode(
'REDIRECT_TO_NON_CONST_CONSTRUCTOR',
@@ -13868,44 +3756,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a redirecting factory
- // constructor redirects to a type alias, and the type alias expands to one of
- // the type parameters of the type alias. This isn’t allowed because the value
- // of the type parameter is a type rather than a class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the redirect to `B<A>`
- // is to a type alias whose value is `T`, even though it looks like the value
- // should be `A`:
- //
- // ```dart
- // class A implements C {}
- //
- // typedef B<T> = T;
- //
- // abstract class C {
- // factory C() = [!B!]<A>;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use either a class name or a type alias that is defined to be a class
- // rather than a type alias defined to be a type parameter:
- //
- // ```dart
- // class A implements C {}
- //
- // abstract class C {
- // factory C() = A;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
REDIRECT_TO_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'REDIRECT_TO_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
@@ -13915,57 +3766,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a variable is referenced before
- // it’s declared. In Dart, variables are visible everywhere in the block in
- // which they are declared, but can only be referenced after they are
- // declared.
- //
- // The analyzer also produces a context message that indicates where the
- // declaration is located.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `i` is used before it
- // is declared:
- //
- // ```dart
- // %language=2.9
- // void f() {
- // print([!i!]);
- // int i = 5;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you intended to reference the local variable, move the declaration
- // before the first reference:
- //
- // ```dart
- // %language=2.9
- // void f() {
- // int i = 5;
- // print(i);
- // }
- // ```
- //
- // If you intended to reference a name from an outer scope, such as a
- // parameter, instance field or top-level variable, then rename the local
- // declaration so that it doesn't hide the outer variable.
- //
- // ```dart
- // %language=2.9
- // void f(int i) {
- // print(i);
- // int x = 5;
- // print(x);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION =
CompileTimeErrorCode(
'REFERENCED_BEFORE_DECLARATION',
@@ -13977,50 +3778,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `rethrow` statement is outside
- // a `catch` clause. The `rethrow` statement is used to throw a caught
- // exception again, but there's no caught exception outside of a `catch`
- // clause.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the`rethrow` statement
- // is outside of a `catch` clause:
- //
- // ```dart
- // void f() {
- // [!rethrow!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you're trying to rethrow an exception, then wrap the `rethrow` statement
- // in a `catch` clause:
- //
- // ```dart
- // void f() {
- // try {
- // // ...
- // } catch (exception) {
- // rethrow;
- // }
- // }
- // ```
- //
- // If you're trying to throw a new exception, then replace the `rethrow`
- // statement with a `throw` expression:
- //
- // ```dart
- // void f() {
- // throw UnsupportedError('Not yet implemented');
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH =
CompileTimeErrorCode(
'RETHROW_OUTSIDE_CATCH',
@@ -14031,54 +3789,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a generative constructor
- // contains a `return` statement that specifies a value to be returned.
- // Generative constructors always return the object that was created, and
- // therefore can't return a different object.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the `return` statement
- // has an expression:
- //
- // ```dart
- // class C {
- // C() {
- // return [!this!];
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the constructor should create a new instance, then remove either the
- // `return` statement or the expression:
- //
- // ```dart
- // class C {
- // C();
- // }
- // ```
- //
- // If the constructor shouldn't create a new instance, then convert it to be a
- // factory constructor:
- //
- // ```dart
- // class C {
- // factory C() {
- // return _instance;
- // }
- //
- // static C _instance = C._();
- //
- // C._();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR =
CompileTimeErrorCode(
'RETURN_IN_GENERATIVE_CONSTRUCTOR',
@@ -14088,62 +3799,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a generator function (one whose
- // body is marked with either `async*` or `sync*`) uses either a `return`
- // statement to return a value or implicitly returns a value because of using
- // `=>`. In any of these cases, they should use `yield` instead of `return`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the method `f` is a
- // generator and is using `return` to return a value:
- //
- // ```dart
- // Iterable<int> f() sync* {
- // [!return 3!];
- // }
- // ```
- //
- // The following code produces this diagnostic because the function `f` is a
- // generator and is implicitly returning a value:
- //
- // ```dart
- // Stream<int> f() async* [!=>!] 3;
- // ```
- //
- // #### Common fixes
- //
- // If the function is using `=>` for the body of the function, then convert it
- // to a block function body, and use `yield` to return a value:
- //
- // ```dart
- // Stream<int> f() async* {
- // yield 3;
- // }
- // ```
- //
- // If the method is intended to be a generator, then use `yield` to return a
- // value:
- //
- // ```dart
- // Iterable<int> f() sync* {
- // yield 3;
- // }
- // ```
- //
- // If the method isn't intended to be a generator, then remove the modifier
- // from the body (or use `async` if you're returning a future):
- //
- // ```dart
- // int f() {
- // return 3;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode RETURN_IN_GENERATOR = CompileTimeErrorCode(
'RETURN_IN_GENERATOR',
"Can't return a value from a generator function that uses the 'async*' or "
@@ -14154,35 +3810,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the static type of a returned
- // expression isn't assignable to the return type that the closure is required
- // to have.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` is defined to be a
- // function that returns a `String`, but the closure assigned to it returns an
- // `int`:
- //
- // ```dart
- // String Function(String) f = (s) => [!3!];
- // ```
- //
- // #### Common fixes
- //
- // If the return type is correct, then replace the returned value with a value
- // of the correct type, possibly by converting the existing value:
- //
- // ```dart
- // String Function(String) f = (s) => 3.toString();
- // ```
+ /// Parameters:
+ /// 0: the return type as declared in the return statement
+ /// 1: the expected return type as defined by the method
static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_CLOSURE =
CompileTimeErrorCode(
'RETURN_OF_INVALID_TYPE_FROM_CLOSURE',
@@ -14191,12 +3821,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the enclosing class
- * 2: the name of the constructor
- */
+ /// Parameters:
+ /// 0: the return type as declared in the return statement
+ /// 1: the expected return type as defined by the enclosing class
+ /// 2: the name of the constructor
static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR =
CompileTimeErrorCode(
'RETURN_OF_INVALID_TYPE',
@@ -14206,40 +3834,10 @@
uniqueName: 'RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR',
);
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the method
- * 2: the name of the method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function returns a
- // value whose type isn't assignable to the declared return type.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` has a return type
- // of `String` but is returning an `int`:
- //
- // ```dart
- // String f() => [!3!];
- // ```
- //
- // #### Common fixes
- //
- // If the return type is correct, then replace the value being returned with a
- // value of the correct type, possibly by converting the existing value:
- //
- // ```dart
- // String f() => 3.toString();
- // ```
- //
- // If the value is correct, then change the return type to match:
- //
- // ```dart
- // int f() => 3;
- // ```
+ /// Parameters:
+ /// 0: the return type as declared in the return statement
+ /// 1: the expected return type as defined by the method
+ /// 2: the name of the method
static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_FUNCTION =
CompileTimeErrorCode(
'RETURN_OF_INVALID_TYPE',
@@ -14249,12 +3847,10 @@
uniqueName: 'RETURN_OF_INVALID_TYPE_FROM_FUNCTION',
);
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the method
- * 2: the name of the method
- */
+ /// Parameters:
+ /// 0: the return type as declared in the return statement
+ /// 1: the expected return type as defined by the method
+ /// 2: the name of the method
static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_METHOD =
CompileTimeErrorCode(
'RETURN_OF_INVALID_TYPE',
@@ -14264,43 +3860,14 @@
uniqueName: 'RETURN_OF_INVALID_TYPE_FROM_METHOD',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds a `return` statement
- // without an expression in a function that declares a return type.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the function `f` is
- // expected to return an `int`, but no value is being returned:
- //
- // ```dart
- // int f() {
- // [!return!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add an expression that computes the value to be returned:
- //
- // ```dart
- // int f() {
- // return 0;
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode RETURN_WITHOUT_VALUE = CompileTimeErrorCode(
'RETURN_WITHOUT_VALUE',
"The return value is missing after 'return'.",
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
+ /// No parameters.
static const CompileTimeErrorCode SET_ELEMENT_FROM_DEFERRED_LIBRARY =
CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
@@ -14313,40 +3880,9 @@
uniqueName: 'SET_ELEMENT_FROM_DEFERRED_LIBRARY',
);
- /**
- * Parameters:
- * 0: the actual type of the set element
- * 1: the expected type of the set element
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an element in a set literal has
- // a type that isn't assignable to the element type of the set.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of the string
- // literal `'0'` is `String`, which isn't assignable to `int`, the element
- // type of the set:
- //
- // ```dart
- // var s = <int>{[!'0'!]};
- // ```
- //
- // #### Common fixes
- //
- // If the element type of the set literal is wrong, then change the element
- // type of the set:
- //
- // ```dart
- // var s = <String>{'0'};
- // ```
- //
- // If the type of the element is wrong, then change the element:
- //
- // ```dart
- // var s = <int>{'0'.length};
- // ```
+ /// Parameters:
+ /// 0: the actual type of the set element
+ /// 1: the expected type of the set element
static const CompileTimeErrorCode SET_ELEMENT_TYPE_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'SET_ELEMENT_TYPE_NOT_ASSIGNABLE',
@@ -14354,47 +3890,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a prefix in a deferred import is
- // also used as a prefix in other imports (whether deferred or not). The
- // prefix in a deferred import can't be shared with other imports because the
- // prefix is used to load the imported library.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the prefix `x` is used
- // as the prefix for a deferred import and is also used for one other import:
- //
- // ```dart
- // import 'dart:math' [!deferred!] as x;
- // import 'dart:convert' as x;
- //
- // var y = x.json.encode(x.min(0, 1));
- // ```
- //
- // #### Common fixes
- //
- // If you can use a different name for the deferred import, then do so:
- //
- // ```dart
- // import 'dart:math' deferred as math;
- // import 'dart:convert' as x;
- //
- // var y = x.json.encode(math.min(0, 1));
- // ```
- //
- // If you can use a different name for the other imports, then do so:
- //
- // ```dart
- // import 'dart:math' deferred as x;
- // import 'dart:convert' as convert;
- //
- // var y = convert.json.encode(x.min(0, 1));
- // ```
+ /// No parameters.
static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX =
CompileTimeErrorCode(
'SHARED_DEFERRED_PREFIX',
@@ -14411,61 +3907,8 @@
correctionMessage: "Try making the deferred import non-deferred.",
);
- /**
- * Parameters:
- * 0: the name of the instance member
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a class name is used to access
- // an instance field. Instance fields don't exist on a class; they exist only
- // on an instance of the class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` is an instance
- // field:
- //
- // ```dart
- // %language=2.9
- // class C {
- // static int a;
- //
- // int b;
- // }
- //
- // int f() => C.[!b!];
- // ```
- //
- // #### Common fixes
- //
- // If you intend to access a static field, then change the name of the field
- // to an existing static field:
- //
- // ```dart
- // %language=2.9
- // class C {
- // static int a;
- //
- // int b;
- // }
- //
- // int f() => C.a;
- // ```
- //
- // If you intend to access the instance field, then use an instance of the
- // class to access the field:
- //
- // ```dart
- // %language=2.9
- // class C {
- // static int a;
- //
- // int b;
- // }
- //
- // int f(C c) => c.b;
- // ```
+ /// Parameters:
+ /// 0: the name of the instance member
static const CompileTimeErrorCode STATIC_ACCESS_TO_INSTANCE_MEMBER =
CompileTimeErrorCode(
'STATIC_ACCESS_TO_INSTANCE_MEMBER',
@@ -14473,74 +3916,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of super-parameter
- * 1: the type of associated super-constructor parameter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type of a super parameter
- // isn't a subtype of the corresponding parameter from the super constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of the super
- // parameter `x` in the constructor for `B` isn't a subtype of the parameter
- // `x` in the constructor for `A`:
- //
- // ```dart
- // class A {
- // A(num x);
- // }
- //
- // class B extends A {
- // B(String super.[!x!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the super parameter can be the same as the parameter from
- // the super constructor, then remove the type annotation from the super
- // parameter (if the type is implicit, it is inferred from the type in the
- // super constructor):
- //
- // ```dart
- // class A {
- // A(num x);
- // }
- //
- // class B extends A {
- // B(super.x);
- // }
- // ```
- //
- // If the type of the super parameter can be a subtype of the corresponding
- // parameter's type, then change the type of the super parameter:
- //
- // ```dart
- // class A {
- // A(num x);
- // }
- //
- // class B extends A {
- // B(int super.x);
- // }
- // ```
- //
- // If the type of the super parameter can't be changed, then use a normal
- // parameter instead of a super parameter:
- //
- // ```dart
- // class A {
- // A(num x);
- // }
- //
- // class B extends A {
- // B(String x) : super(x.length);
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of super-parameter
+ /// 1: the type of associated super-constructor parameter
static const CompileTimeErrorCode
SUPER_FORMAL_PARAMETER_TYPE_IS_NOT_SUBTYPE_OF_ASSOCIATED =
CompileTimeErrorCode(
@@ -14552,74 +3930,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's a named super parameter
- // in a constructor and the implicitly or explicitly invoked super
- // constructor doesn't have a named parameter with the same name.
- //
- // Named super parameters are associated by name with named parameters in the
- // super constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor in `A`
- // doesn't have a parameter named `y`:
- //
- // ```dart
- // class A {
- // A({int? x});
- // }
- //
- // class B extends A {
- // B({super.[!y!]});
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the super parameter should be associated with an existing parameter
- // from the super constructor, then change the name to match the name of the
- // corresponding parameter:
- //
- // ```dart
- // class A {
- // A({int? x});
- // }
- //
- // class B extends A {
- // B({super.x});
- // }
- // ```
- //
- // If the super parameter should be associated with a parameter that hasn't
- // yet been added to the super constructor, then add it:
- //
- // ```dart
- // class A {
- // A({int? x, int? y});
- // }
- //
- // class B extends A {
- // B({super.y});
- // }
- // ```
- //
- // If the super parameter doesn't correspond to a named parameter from the
- // super constructor, then change it to be a normal parameter:
- //
- // ```dart
- // class A {
- // A({int? x});
- // }
- //
- // class B extends A {
- // B({int? y});
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_NAMED = CompileTimeErrorCode(
'SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_NAMED',
@@ -14630,79 +3941,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's a positional super
- // parameter in a constructor and the implicitly or explicitly invoked super
- // constructor doesn't have a positional parameter at the corresponding
- // index.
- //
- // Positional super parameters are associated with positional parameters in
- // the super constructor by their index. That is, the first super parameter
- // is associated with the first positional parameter in the super
- // constructor, the second with the second, and so on.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the constructor in `B`
- // has a positional super parameter, but there's no positional parameter in
- // the super constructor in `A`:
- //
- // ```dart
- // class A {
- // A({int? x});
- // }
- //
- // class B extends A {
- // B(super.[!x!]);
- // }
- // ```
- //
- // The following code produces this diagnostic because the constructor in `B`
- // has two positional super parameters, but there's only one positional
- // parameter in the super constructor in `A`, which means that there's no
- // corresponding parameter for `y`:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // B(super.x, super.[!y!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the super constructor should have a positional parameter corresponding
- // to the super parameter, then update the super constructor appropriately:
- //
- // ```dart
- // class A {
- // A(int x, int y);
- // }
- //
- // class B extends A {
- // B(super.x, super.y);
- // }
- // ```
- //
- // If the super constructor is correct, or can't be changed, then convert the
- // super parameter into a normal parameter:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // B(super.x, int y);
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode
SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_POSITIONAL =
CompileTimeErrorCode(
@@ -14714,56 +3953,17 @@
hasPublishedDocs: true,
);
- /**
- * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
- * is a compile-time error if a generative constructor of class Object
- * includes a superinitializer.
- */
+ /// 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
+ /// is a compile-time error if a generative constructor of class Object
+ /// includes a superinitializer.
static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT =
CompileTimeErrorCode(
'SUPER_INITIALIZER_IN_OBJECT',
"The class 'Object' can't invoke a constructor from a superclass.",
);
- /**
- * Parameters:
- * 0: the superinitializer
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the initializer list of a
- // constructor contains an invocation of a constructor in the superclass, but
- // the invocation isn't the last item in the initializer list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the invocation of the
- // superclass' constructor isn't the last item in the initializer list:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // B(int x) : [!super!](x), assert(x >= 0);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Move the invocation of the superclass' constructor to the end of the
- // initializer list:
- //
- // ```dart
- // class A {
- // A(int x);
- // }
- //
- // class B extends A {
- // B(int x) : assert(x >= 0), super(x);
- // }
- // ```
+ /// Parameters:
+ /// 0: the superinitializer
static const CompileTimeErrorCode SUPER_INVOCATION_NOT_LAST =
CompileTimeErrorCode(
'SUPER_INVOCATION_NOT_LAST',
@@ -14771,38 +3971,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the initializer list in a
- // constructor in an enum contains an invocation of a super constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor in
- // the enum `E` has a super constructor invocation in the initializer list:
- //
- // ```dart
- // enum E {
- // e;
- //
- // const E() : [!super!]();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the super constructor invocation:
- //
- // ```dart
- // enum E {
- // e;
- //
- // const E();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode SUPER_IN_ENUM_CONSTRUCTOR =
CompileTimeErrorCode(
'SUPER_IN_ENUM_CONSTRUCTOR',
@@ -14811,35 +3980,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a member declared inside an
- // extension uses the `super` keyword . Extensions aren't classes and don't
- // have superclasses, so the `super` keyword serves no purpose.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `super` can't be used
- // in an extension:
- //
- // ```dart
- // extension E on Object {
- // String get displayString => [!super!].toString();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the `super` keyword :
- //
- // ```dart
- // extension E on Object {
- // String get displayString => toString();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode SUPER_IN_EXTENSION = CompileTimeErrorCode(
'SUPER_IN_EXTENSION',
"The 'super' keyword can't be used in an extension because an extension "
@@ -14847,28 +3988,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the keyword `super` is used
- // outside of a instance method.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `super` is used in a
- // top-level function:
- //
- // ```dart
- // void f() {
- // [!super!].f();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Rewrite the code to not use `super`.
+ /// No parameters.
static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT =
CompileTimeErrorCode(
'SUPER_IN_INVALID_CONTEXT',
@@ -14876,38 +3996,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a constructor that redirects to
- // another constructor also attempts to invoke a constructor from the
- // superclass. The superclass constructor will be invoked when the constructor
- // that the redirecting constructor is redirected to is invoked.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor `C.a`
- // both redirects to `C.b` and invokes a constructor from the superclass:
- //
- // ```dart
- // class C {
- // C.a() : this.b(), [!super()!];
- // C.b();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the invocation of the `super` constructor:
- //
- // ```dart
- // class C {
- // C.a() : this.b();
- // C.b();
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR =
CompileTimeErrorCode(
'SUPER_IN_REDIRECTING_CONSTRUCTOR',
@@ -14915,41 +4004,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the statements following a
- // `case` label in a `switch` statement could fall through to the next `case`
- // or `default` label.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the `case` label with
- // a value of zero (`0`) falls through to the `default` statements:
- //
- // ```dart
- // void f(int a) {
- // switch (a) {
- // [!case!] 0:
- // print(0);
- // default:
- // return;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the flow of control so that the `case` won't fall through. There
- // are several ways that this can be done, including adding one of the
- // following at the end of the current list of statements:
- // - a `return` statement,
- // - a `throw` expression,
- // - a `break` statement,
- // - a `continue`, or
- // - an invocation of a function or method whose return type is `Never`.
+ /// No parameters.
static const CompileTimeErrorCode SWITCH_CASE_COMPLETES_NORMALLY =
CompileTimeErrorCode(
'SWITCH_CASE_COMPLETES_NORMALLY',
@@ -14958,59 +4013,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the static type of the switch expression
- * 1: the static type of the case expressions
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type of the expression in a
- // `switch` statement isn't assignable to the type of the expressions in the
- // `case` clauses.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of `s`
- // (`String`) isn't assignable to the type of `0` (`int`):
- //
- // ```dart
- // %language=2.9
- // void f(String s) {
- // switch ([!s!]) {
- // case 0:
- // break;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the type of the `case` expressions is correct, then change the
- // expression in the `switch` statement to have the correct type:
- //
- // ```dart
- // %language=2.9
- // void f(String s) {
- // switch (int.parse(s)) {
- // case 0:
- // break;
- // }
- // }
- // ```
- //
- // If the type of the `switch` expression is correct, then change the `case`
- // expressions to have the correct type:
- //
- // ```dart
- // %language=2.9
- // void f(String s) {
- // switch (s) {
- // case '0':
- // break;
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the static type of the switch expression
+ /// 1: the static type of the case expressions
static const CompileTimeErrorCode SWITCH_EXPRESSION_NOT_ASSIGNABLE =
CompileTimeErrorCode(
'SWITCH_EXPRESSION_NOT_ASSIGNABLE',
@@ -15019,34 +4024,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a generative constructor from an
- // abstract class is being torn off. This isn't allowed because it isn't valid
- // to create an instance of an abstract class, which means that there isn't
- // any valid use for the torn off constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the constructor `C.new`
- // is being torn off and the class `C` is an abstract class:
- //
- // ```dart
- // abstract class C {
- // C();
- // }
- //
- // void f() {
- // [!C.new!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Tear off the constructor of a concrete class.
+ /// No parameters.
static const CompileTimeErrorCode
TEAROFF_OF_GENERATIVE_CONSTRUCTOR_OF_ABSTRACT_CLASS =
CompileTimeErrorCode(
@@ -15058,36 +4036,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type that can't be thrown
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type of the expression in a
- // throw expression isn't assignable to `Object`. It isn't valid to throw
- // `null`, so it isn't valid to use an expression that might evaluate to
- // `null`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `s` might be `null`:
- //
- // ```dart
- // void f(String? s) {
- // throw [!s!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add an explicit null check to the expression:
- //
- // ```dart
- // void f(String? s) {
- // throw s!;
- // }
- // ```
+ /// Parameters:
+ /// 0: the type that can't be thrown
static const CompileTimeErrorCode THROW_OF_INVALID_TYPE =
CompileTimeErrorCode(
'THROW_OF_INVALID_TYPE',
@@ -15095,50 +4045,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the element whose type could not be inferred.
- * 1: The [TopLevelInferenceError]'s arguments that led to the cycle.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a top-level variable has no type
- // annotation and the variable's initializer refers to the variable, either
- // directly or indirectly.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the variables `x` and
- // `y` are defined in terms of each other, and neither has an explicit type,
- // so the type of the other can't be inferred:
- //
- // ```dart
- // var x = y;
- // var y = [!x!];
- // ```
- //
- // #### Common fixes
- //
- // If the two variables don't need to refer to each other, then break the
- // cycle:
- //
- // ```dart
- // var x = 0;
- // var y = x;
- // ```
- //
- // If the two variables need to refer to each other, then give at least one of
- // them an explicit type:
- //
- // ```dart
- // int x = y;
- // var y = x;
- // ```
- //
- // Note, however, that while this code doesn't produce any diagnostics, it
- // will produce a stack overflow at runtime unless at least one of the
- // variables is assigned a value that doesn't depend on the other variables
- // before any of the variables in the cycle are referenced.
+ /// Parameters:
+ /// 0: the element whose type could not be inferred.
+ /// 1: The [TopLevelInferenceError]'s arguments that led to the cycle.
static const CompileTimeErrorCode TOP_LEVEL_CYCLE = CompileTimeErrorCode(
'TOP_LEVEL_CYCLE',
"The type of '{0}' can't be inferred because it depends on itself through "
@@ -15149,33 +4058,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a typedef refers to itself,
- // either directly or indirectly.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `F` depends on itself
- // indirectly through `G`:
- //
- // ```dart
- // typedef [!F!] = void Function(G);
- // typedef G = void Function(F);
- // ```
- //
- // #### Common fixes
- //
- // Change one or more of the typedefs in the cycle so that none of them refer
- // to themselves:
- //
- // ```dart
- // typedef F = void Function(G);
- // typedef G = void Function(int);
- // ```
+ /// No parameters.
static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF =
CompileTimeErrorCode(
'TYPE_ALIAS_CANNOT_REFERENCE_ITSELF',
@@ -15184,46 +4067,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type that is deferred and being used in a type
- * annotation
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type annotation is in a
- // variable declaration, or the type used in a cast (`as`) or type test (`is`)
- // is a type declared in a library that is imported using a deferred import.
- // These types are required to be available at compile time, but aren't.
- //
- // For more information, see the language tour's coverage of
- // [deferred loading](https://dart.dev/guides/language/language-tour#lazily-loading-a-library).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type of the
- // parameter `f` is imported from a deferred library:
- //
- // ```dart
- // import 'dart:io' deferred as io;
- //
- // void f([!io.File!] f) {}
- // ```
- //
- // #### Common fixes
- //
- // If you need to reference the imported type, then remove the `deferred`
- // keyword:
- //
- // ```dart
- // import 'dart:io' as io;
- //
- // void f(io.File f) {}
- // ```
- //
- // If the import is required to be deferred and there's another type that is
- // appropriate, then use that type in place of the type from the deferred
- // library.
+ /// Parameters:
+ /// 0: the name of the type that is deferred and being used in a type
+ /// annotation
static const CompileTimeErrorCode TYPE_ANNOTATION_DEFERRED_CLASS =
CompileTimeErrorCode(
'TYPE_ANNOTATION_DEFERRED_CLASS',
@@ -15235,38 +4081,11 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type used in the instance creation that should be
- * limited by the bound as specified in the class declaration
- * 1: the name of the type parameter
- * 2: the substituted bound of the type parameter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type argument isn't the same
- // as or a subclass of the bounds of the corresponding type parameter.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `String` isn't a
- // subclass of `num`:
- //
- // ```dart
- // class A<E extends num> {}
- //
- // var a = A<[!String!]>();
- // ```
- //
- // #### Common fixes
- //
- // Change the type argument to be a subclass of the bounds:
- //
- // ```dart
- // class A<E extends num> {}
- //
- // var a = A<int>();
- // ```
+ /// Parameters:
+ /// 0: the name of the type used in the instance creation that should be
+ /// limited by the bound as specified in the class declaration
+ /// 1: the name of the type parameter
+ /// 2: the substituted bound of the type parameter
static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS =
CompileTimeErrorCode(
'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS',
@@ -15275,46 +4094,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a static member references a
- // type parameter that is declared for the class. Type parameters only have
- // meaning for instances of the class.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the static method
- // `hasType` has a reference to the type parameter `T`:
- //
- // ```dart
- // class C<T> {
- // static bool hasType(Object o) => o is [!T!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the member can be an instance member, then remove the keyword `static`:
- //
- // ```dart
- // class C<T> {
- // bool hasType(Object o) => o is T;
- // }
- // ```
- //
- // If the member must be a static member, then make the member be generic:
- //
- // ```dart
- // class C<T> {
- // static bool hasType<S>(Object o) => o is S;
- // }
- // ```
- //
- // Note, however, that there isn’t a relationship between `T` and `S`, so this
- // second option changes the semantics from what was likely to be intended.
+ /// No parameters.
static const CompileTimeErrorCode TYPE_PARAMETER_REFERENCED_BY_STATIC =
CompileTimeErrorCode(
'TYPE_PARAMETER_REFERENCED_BY_STATIC',
@@ -15325,52 +4105,11 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type parameter
- * 1: the name of the bounding type
- *
- * See [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS].
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the bound of a type parameter
- // (the type following the `extends` keyword) is either directly or indirectly
- // the type parameter itself. Stating that the type parameter must be the same
- // as itself or a subtype of itself or a subtype of itself isn't helpful
- // because it will always be the same as itself.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the bound of `T` is
- // `T`:
- //
- // ```dart
- // class C<[!T!] extends T> {}
- // ```
- //
- // The following code produces this diagnostic because the bound of `T1` is
- // `T2`, and the bound of `T2` is `T1`, effectively making the bound of `T1`
- // be `T1`:
- //
- // ```dart
- // class C<[!T1!] extends T2, T2 extends T1> {}
- // ```
- //
- // #### Common fixes
- //
- // If the type parameter needs to be a subclass of some type, then replace the
- // bound with the required type:
- //
- // ```dart
- // class C<T extends num> {}
- // ```
- //
- // If the type parameter can be any type, then remove the `extends` clause:
- //
- // ```dart
- // class C<T> {}
- // ```
+ /// Parameters:
+ /// 0: the name of the type parameter
+ /// 1: the name of the bounding type
+ ///
+ /// See [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS].
static const CompileTimeErrorCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND =
CompileTimeErrorCode(
'TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND',
@@ -15380,55 +4119,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the right-hand side of an `is`
- // or `is!` test isn't a type.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the right-hand side is
- // a parameter, not a type:
- //
- // ```dart
- // typedef B = int Function(int);
- //
- // void f(Object a, B b) {
- // if (a is [!b!]) {
- // return;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you intended to use a type test, then replace the right-hand side with a
- // type:
- //
- // ```dart
- // typedef B = int Function(int);
- //
- // void f(Object a, B b) {
- // if (a is B) {
- // return;
- // }
- // }
- // ```
- //
- // If you intended to use a different kind of test, then change the test:
- //
- // ```dart
- // typedef B = int Function(int);
- //
- // void f(Object a, B b) {
- // if (a == b) {
- // return;
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode TYPE_TEST_WITH_NON_TYPE =
CompileTimeErrorCode(
'TYPE_TEST_WITH_NON_TYPE',
@@ -15437,38 +4128,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name following the `is` in a
- // type test expression isn't defined.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `Srting` isn't
- // defined:
- //
- // ```dart
- // void f(Object o) {
- // if (o is [!Srting!]) {
- // // ...
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the name with the name of a type:
- //
- // ```dart
- // void f(Object o) {
- // if (o is String) {
- // // ...
- // }
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode TYPE_TEST_WITH_UNDEFINED_NAME =
CompileTimeErrorCode(
'TYPE_TEST_WITH_UNDEFINED_NAME',
@@ -15522,61 +4182,6 @@
uniqueName: 'UNCHECKED_PROPERTY_ACCESS_OF_NULLABLE_VALUE',
);
- // #### Description
- //
- // The analyzer produces this diagnostic when an expression whose type is
- // [potentially non-nullable][] is dereferenced without first verifying that
- // the value isn't `null`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `s` can be `null` at
- // the point where it's referenced:
- //
- // ```dart
- // void f(String? s) {
- // if (s.[!length!] > 3) {
- // // ...
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the value really can be `null`, then add a test to ensure that members
- // are only accessed when the value isn't `null`:
- //
- // ```dart
- // void f(String? s) {
- // if (s != null && s.length > 3) {
- // // ...
- // }
- // }
- // ```
- //
- // If the expression is a variable and the value should never be `null`, then
- // change the type of the variable to be non-nullable:
- //
- // ```dart
- // void f(String s) {
- // if (s.length > 3) {
- // // ...
- // }
- // }
- // ```
- //
- // If you believe that the value of the expression should never be `null`, but
- // you can't change the type of the variable, and you're willing to risk
- // having an exception thrown at runtime if you're wrong, then you can assert
- // that the value isn't null:
- //
- // ```dart
- // void f(String? s) {
- // if (s!.length > 3) {
- // // ...
- // }
- // }
- // ```
static const CompileTimeErrorCode
UNCHECKED_USE_OF_NULLABLE_VALUE_AS_CONDITION = CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
@@ -15621,44 +4226,7 @@
uniqueName: 'UNCHECKED_USE_OF_NULLABLE_VALUE_IN_YIELD_EACH',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a name that isn't defined is
- // used as an annotation.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `undefined`
- // isn't defined:
- //
- // ```dart
- // [!@undefined!]
- // void f() {}
- // ```
- //
- // #### Common fixes
- //
- // If the name is correct, but it isn’t declared yet, then declare the name as
- // a constant value:
- //
- // ```dart
- // const undefined = 'undefined';
- //
- // @undefined
- // void f() {}
- // ```
- //
- // If the name is wrong, replace the name with the name of a valid constant:
- //
- // ```dart
- // @deprecated
- // void f() {}
- // ```
- //
- // Otherwise, remove the annotation.
+ /// No parameters.
static const CompileTimeErrorCode UNDEFINED_ANNOTATION = CompileTimeErrorCode(
'UNDEFINED_ANNOTATION',
"Undefined name '{0}' used as an annotation.",
@@ -15668,40 +4236,8 @@
isUnresolvedIdentifier: true,
);
- /**
- * Parameters:
- * 0: the name of the undefined class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a class but either isn't defined or isn't visible
- // in the scope in which it's being referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `Piont` isn't defined:
- //
- // ```dart
- // class Point {}
- //
- // void f([!Piont!] p) {}
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a class that is defined. The example above can be corrected by
- // fixing the spelling of the class:
- //
- // ```dart
- // class Point {}
- //
- // void f(Point p) {}
- // ```
- //
- // If the class is defined but isn't visible, then you probably need to add an
- // import.
+ /// Parameters:
+ /// 0: the name of the undefined class
static const CompileTimeErrorCode UNDEFINED_CLASS = CompileTimeErrorCode(
'UNDEFINED_CLASS',
"Undefined class '{0}'.",
@@ -15712,13 +4248,11 @@
isUnresolvedIdentifier: true,
);
- /**
- * Same as [CompileTimeErrorCode.UNDEFINED_CLASS], but to catch using
- * "boolean" instead of "bool" in order to improve the correction message.
- *
- * Parameters:
- * 0: the name of the undefined class
- */
+ /// Same as [CompileTimeErrorCode.UNDEFINED_CLASS], but to catch using
+ /// "boolean" instead of "bool" in order to improve the correction message.
+ ///
+ /// Parameters:
+ /// 0: the name of the undefined class
static const CompileTimeErrorCode UNDEFINED_CLASS_BOOLEAN =
CompileTimeErrorCode(
'UNDEFINED_CLASS',
@@ -15729,69 +4263,9 @@
uniqueName: 'UNDEFINED_CLASS_BOOLEAN',
);
- /**
- * Parameters:
- * 0: the name of the superclass that does not define the invoked constructor
- * 1: the name of the constructor being invoked
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a superclass constructor is
- // invoked in the initializer list of a constructor, but the superclass
- // doesn't define the constructor being invoked.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `A` doesn't have an
- // unnamed constructor:
- //
- // ```dart
- // class A {
- // A.n();
- // }
- // class B extends A {
- // B() : [!super()!];
- // }
- // ```
- //
- // The following code produces this diagnostic because `A` doesn't have a
- // constructor named `m`:
- //
- // ```dart
- // class A {
- // A.n();
- // }
- // class B extends A {
- // B() : [!super.m()!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the superclass defines a constructor that should be invoked, then change
- // the constructor being invoked:
- //
- // ```dart
- // class A {
- // A.n();
- // }
- // class B extends A {
- // B() : super.n();
- // }
- // ```
- //
- // If the superclass doesn't define an appropriate constructor, then define
- // the constructor being invoked:
- //
- // ```dart
- // class A {
- // A.m();
- // A.n();
- // }
- // class B extends A {
- // B() : super.m();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the superclass that does not define the invoked constructor
+ /// 1: the name of the constructor being invoked
static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER =
CompileTimeErrorCode(
'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER',
@@ -15802,10 +4276,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the superclass that does not define the invoked constructor
- */
+ /// Parameters:
+ /// 0: the name of the superclass that does not define the invoked constructor
static const CompileTimeErrorCode
UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = CompileTimeErrorCode(
'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER',
@@ -15817,47 +4289,9 @@
uniqueName: 'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT',
);
- /**
- * Parameters:
- * 0: the name of the enum constant that is not defined
- * 1: the name of the enum used to access the constant
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of an enum constant, and the name either isn't
- // defined or isn't visible in the scope in which it's being referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `E` doesn't define a
- // constant named `c`:
- //
- // ```dart
- // enum E {a, b}
- //
- // var e = E.[!c!];
- // ```
- //
- // #### Common fixes
- //
- // If the constant should be defined, then add it to the declaration of the
- // enum:
- //
- // ```dart
- // enum E {a, b, c}
- //
- // var e = E.c;
- // ```
- //
- // If the constant shouldn't be defined, then change the name to the name of
- // an existing constant:
- //
- // ```dart
- // enum E {a, b}
- //
- // var e = E.b;
- // ```
+ /// Parameters:
+ /// 0: the name of the enum constant that is not defined
+ /// 1: the name of the enum used to access the constant
static const CompileTimeErrorCode UNDEFINED_ENUM_CONSTANT =
CompileTimeErrorCode(
'UNDEFINED_ENUM_CONSTANT',
@@ -15868,92 +4302,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the constructor that is undefined
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the constructor invoked to
- // initialize an enum constant doesn't exist.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the enum constant `c`
- // is being initialized by the unnamed constructor, but there's no unnamed
- // constructor defined in `E`:
- //
- // ```dart
- // enum E {
- // [!c!]();
- //
- // const E.x();
- // }
- // ```
- //
- // The following code produces this diagnostic because the enum constant `c`
- // is being initialized by the constructor named `x`, but there's no
- // constructor named `x` defined in `E`:
- //
- // ```dart
- // enum E {
- // c.[!x!]();
- //
- // const E.y();
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the enum constant is being initialized by the unnamed constructor and
- // one of the named constructors should have been used, then add the name of
- // the constructor:
- //
- // ```dart
- // enum E {
- // c.x();
- //
- // const E.x();
- // }
- // ```
- //
- // If the enum constant is being initialized by the unnamed constructor and
- // none of the named constructors are appropriate, then define the unnamed
- // constructor:
- //
- // ```dart
- // enum E {
- // c();
- //
- // const E();
- // }
- // ```
- //
- // If the enum constant is being initialized by a named constructor and one
- // of the existing constructors should have been used, then change the name
- // of the constructor being invoked (or remove it if the unnamed constructor
- // should be used):
- //
- // ```dart
- // enum E {
- // c.y();
- //
- // const E();
- // const E.y();
- // }
- // ```
- //
- // If the enum constant is being initialized by a named constructor and none
- // of the existing constructors should have been used, then define a
- // constructor with the name that was used:
- //
- // ```dart
- // enum E {
- // c.x();
- //
- // const E.x();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the constructor that is undefined
static const CompileTimeErrorCode UNDEFINED_ENUM_CONSTRUCTOR_NAMED =
CompileTimeErrorCode(
'UNDEFINED_ENUM_CONSTRUCTOR',
@@ -15976,99 +4326,9 @@
uniqueName: 'UNDEFINED_ENUM_CONSTRUCTOR_UNNAMED',
);
- /**
- * Parameters:
- * 0: the name of the getter that is undefined
- * 1: the name of the extension that was explicitly specified
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override is used to
- // invoke a getter, but the getter isn't defined by the specified extension.
- // The analyzer also produces this diagnostic when a static getter is
- // referenced but isn't defined by the specified extension.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't declare an instance getter named `b`:
- //
- // ```dart
- // extension E on String {
- // String get a => 'a';
- // }
- //
- // extension F on String {
- // String get b => 'b';
- // }
- //
- // void f() {
- // E('c').[!b!];
- // }
- // ```
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't declare a static getter named `a`:
- //
- // ```dart
- // extension E on String {}
- //
- // var x = E.[!a!];
- // ```
- //
- // #### Common fixes
- //
- // If the name of the getter is incorrect, then change it to the name of an
- // existing getter:
- //
- // ```dart
- // extension E on String {
- // String get a => 'a';
- // }
- //
- // extension F on String {
- // String get b => 'b';
- // }
- //
- // void f() {
- // E('c').a;
- // }
- // ```
- //
- // If the name of the getter is correct but the name of the extension is
- // wrong, then change the name of the extension to the correct name:
- //
- // ```dart
- // extension E on String {
- // String get a => 'a';
- // }
- //
- // extension F on String {
- // String get b => 'b';
- // }
- //
- // void f() {
- // F('c').b;
- // }
- // ```
- //
- // If the name of the getter and extension are both correct, but the getter
- // isn't defined, then define the getter:
- //
- // ```dart
- // extension E on String {
- // String get a => 'a';
- // String get b => 'z';
- // }
- //
- // extension F on String {
- // String get b => 'b';
- // }
- //
- // void f() {
- // E('c').b;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the getter that is undefined
+ /// 1: the name of the extension that was explicitly specified
static const CompileTimeErrorCode UNDEFINED_EXTENSION_GETTER =
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_GETTER',
@@ -16079,99 +4339,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the method that is undefined
- * 1: the name of the extension that was explicitly specified
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override is used to
- // invoke a method, but the method isn't defined by the specified extension.
- // The analyzer also produces this diagnostic when a static method is
- // referenced but isn't defined by the specified extension.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't declare an instance method named `b`:
- //
- // ```dart
- // extension E on String {
- // String a() => 'a';
- // }
- //
- // extension F on String {
- // String b() => 'b';
- // }
- //
- // void f() {
- // E('c').[!b!]();
- // }
- // ```
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't declare a static method named `a`:
- //
- // ```dart
- // extension E on String {}
- //
- // var x = E.[!a!]();
- // ```
- //
- // #### Common fixes
- //
- // If the name of the method is incorrect, then change it to the name of an
- // existing method:
- //
- // ```dart
- // extension E on String {
- // String a() => 'a';
- // }
- //
- // extension F on String {
- // String b() => 'b';
- // }
- //
- // void f() {
- // E('c').a();
- // }
- // ```
- //
- // If the name of the method is correct, but the name of the extension is
- // wrong, then change the name of the extension to the correct name:
- //
- // ```dart
- // extension E on String {
- // String a() => 'a';
- // }
- //
- // extension F on String {
- // String b() => 'b';
- // }
- //
- // void f() {
- // F('c').b();
- // }
- // ```
- //
- // If the name of the method and extension are both correct, but the method
- // isn't defined, then define the method:
- //
- // ```dart
- // extension E on String {
- // String a() => 'a';
- // String b() => 'z';
- // }
- //
- // extension F on String {
- // String b() => 'b';
- // }
- //
- // void f() {
- // E('c').b();
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the method that is undefined
+ /// 1: the name of the extension that was explicitly specified
static const CompileTimeErrorCode UNDEFINED_EXTENSION_METHOD =
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_METHOD',
@@ -16182,51 +4352,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the operator that is undefined
- * 1: the name of the extension that was explicitly specified
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an operator is invoked on a
- // specific extension when that extension doesn't implement the operator.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't define the operator `*`:
- //
- // ```dart
- // var x = E('') [!*!] 4;
- //
- // extension E on String {}
- // ```
- //
- // #### Common fixes
- //
- // If the extension is expected to implement the operator, then add an
- // implementation of the operator to the extension:
- //
- // ```dart
- // var x = E('') * 4;
- //
- // extension E on String {
- // int operator *(int multiplier) => length * multiplier;
- // }
- // ```
- //
- // If the operator is defined by a different extension, then change the name
- // of the extension to the name of the one that defines the operator.
- //
- // If the operator is defined on the argument of the extension override, then
- // remove the extension override:
- //
- // ```dart
- // var x = '' * 4;
- //
- // extension E on String {}
- // ```
+ /// Parameters:
+ /// 0: the name of the operator that is undefined
+ /// 1: the name of the extension that was explicitly specified
static const CompileTimeErrorCode UNDEFINED_EXTENSION_OPERATOR =
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_OPERATOR',
@@ -16235,101 +4363,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the setter that is undefined
- * 1: the name of the extension that was explicitly specified
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension override is used to
- // invoke a setter, but the setter isn't defined by the specified extension.
- // The analyzer also produces this diagnostic when a static setter is
- // referenced but isn't defined by the specified extension.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't declare an instance setter named `b`:
- //
- // ```dart
- // extension E on String {
- // set a(String v) {}
- // }
- //
- // extension F on String {
- // set b(String v) {}
- // }
- //
- // void f() {
- // E('c').[!b!] = 'd';
- // }
- // ```
- //
- // The following code produces this diagnostic because the extension `E`
- // doesn't declare a static setter named `a`:
- //
- // ```dart
- // extension E on String {}
- //
- // void f() {
- // E.[!a!] = 3;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the name of the setter is incorrect, then change it to the name of an
- // existing setter:
- //
- // ```dart
- // extension E on String {
- // set a(String v) {}
- // }
- //
- // extension F on String {
- // set b(String v) {}
- // }
- //
- // void f() {
- // E('c').a = 'd';
- // }
- // ```
- //
- // If the name of the setter is correct, but the name of the extension is
- // wrong, then change the name of the extension to the correct name:
- //
- // ```dart
- // extension E on String {
- // set a(String v) {}
- // }
- //
- // extension F on String {
- // set b(String v) {}
- // }
- //
- // void f() {
- // F('c').b = 'd';
- // }
- // ```
- //
- // If the name of the setter and extension are both correct, but the setter
- // isn't defined, then define the setter:
- //
- // ```dart
- // extension E on String {
- // set a(String v) {}
- // set b(String v) {}
- // }
- //
- // extension F on String {
- // set b(String v) {}
- // }
- //
- // void f() {
- // E('c').b = 'd';
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the setter that is undefined
+ /// 1: the name of the extension that was explicitly specified
static const CompileTimeErrorCode UNDEFINED_EXTENSION_SETTER =
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_SETTER',
@@ -16340,45 +4376,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the method that is undefined
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a function but either isn't defined or isn't
- // visible in the scope in which it's being referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `emty` isn't
- // defined:
- //
- // ```dart
- // List<int> empty() => [];
- //
- // void main() {
- // print([!emty!]());
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a function that is defined. The example above can be corrected
- // by fixing the spelling of the function:
- //
- // ```dart
- // List<int> empty() => [];
- //
- // void main() {
- // print(empty());
- // }
- // ```
- //
- // If the function is defined but isn't visible, then you probably need to add
- // an import or re-arrange your code to make the function visible.
+ /// Parameters:
+ /// 0: the name of the method that is undefined
static const CompileTimeErrorCode UNDEFINED_FUNCTION = CompileTimeErrorCode(
'UNDEFINED_FUNCTION',
"The function '{0}' isn't defined.",
@@ -16389,35 +4388,9 @@
isUnresolvedIdentifier: true,
);
- /**
- * Parameters:
- * 0: the name of the getter
- * 1: the name of the enclosing type where the getter is being looked for
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a getter but either isn't defined or isn't
- // visible in the scope in which it's being referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `String` has no member
- // named `len`:
- //
- // ```dart
- // int f(String s) => s.[!len!];
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a getter that is defined. The example above can be corrected by
- // fixing the spelling of the getter:
- //
- // ```dart
- // int f(String s) => s.length;
- // ```
+ /// Parameters:
+ /// 0: the name of the getter
+ /// 1: the name of the enclosing type where the getter is being looked for
static const CompileTimeErrorCode UNDEFINED_GETTER = CompileTimeErrorCode(
'UNDEFINED_GETTER',
"The getter '{0}' isn't defined for the type '{1}'.",
@@ -16428,11 +4401,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the getter
- * 1: the name of the function type alias
- */
+ /// Parameters:
+ /// 0: the name of the getter
+ /// 1: the name of the function type alias
static const CompileTimeErrorCode UNDEFINED_GETTER_ON_FUNCTION_TYPE =
CompileTimeErrorCode(
'UNDEFINED_GETTER',
@@ -16444,37 +4415,8 @@
uniqueName: 'UNDEFINED_GETTER_ON_FUNCTION_TYPE',
);
- /**
- * Parameters:
- * 0: the name of the identifier
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // either isn't defined or isn't visible in the scope in which it's being
- // referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `rihgt` isn't
- // defined:
- //
- // ```dart
- // int min(int left, int right) => left <= [!rihgt!] ? left : right;
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // an identifier that is defined. The example above can be corrected by
- // fixing the spelling of the variable:
- //
- // ```dart
- // int min(int left, int right) => left <= right ? left : right;
- // ```
- //
- // If the identifier is defined but isn't visible, then you probably need to
- // add an import or re-arrange your code to make the identifier visible.
+ /// Parameters:
+ /// 0: the name of the identifier
static const CompileTimeErrorCode UNDEFINED_IDENTIFIER = CompileTimeErrorCode(
'UNDEFINED_IDENTIFIER',
"Undefined name '{0}'.",
@@ -16484,33 +4426,7 @@
isUnresolvedIdentifier: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the name `await` is used in a
- // method or function body without being declared, and the body isn't marked
- // with the `async` keyword. The name `await` only introduces an await
- // expression in an asynchronous function.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the name `await` is
- // used in the body of `f` even though the body of `f` isn't marked with the
- // `async` keyword:
- //
- // ```dart
- // void f(p) { [!await!] p; }
- // ```
- //
- // #### Common fixes
- //
- // Add the keyword `async` to the function body:
- //
- // ```dart
- // void f(p) async { await p; }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode UNDEFINED_IDENTIFIER_AWAIT =
CompileTimeErrorCode(
'UNDEFINED_IDENTIFIER_AWAIT',
@@ -16521,35 +4437,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the method that is undefined
- * 1: the resolved type name that the method lookup is happening on
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a method but either isn't defined or isn't
- // visible in the scope in which it's being referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the identifier
- // `removeMiddle` isn't defined:
- //
- // ```dart
- // int f(List<int> l) => l.[!removeMiddle!]();
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a method that is defined. The example above can be corrected by
- // fixing the spelling of the method:
- //
- // ```dart
- // int f(List<int> l) => l.removeLast();
- // ```
+ /// Parameters:
+ /// 0: the name of the method that is undefined
+ /// 1: the resolved type name that the method lookup is happening on
static const CompileTimeErrorCode UNDEFINED_METHOD = CompileTimeErrorCode(
'UNDEFINED_METHOD',
"The method '{0}' isn't defined for the type '{1}'.",
@@ -16559,11 +4449,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the method
- * 1: the name of the function type alias
- */
+ /// Parameters:
+ /// 0: the name of the method
+ /// 1: the name of the function type alias
static const CompileTimeErrorCode UNDEFINED_METHOD_ON_FUNCTION_TYPE =
CompileTimeErrorCode(
'UNDEFINED_METHOD',
@@ -16575,78 +4463,8 @@
uniqueName: 'UNDEFINED_METHOD_ON_FUNCTION_TYPE',
);
- /**
- * Parameters:
- * 0: the name of the requested named parameter
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function invocation
- // has a named argument, but the method or function being invoked doesn't
- // define a parameter with the same name.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `m` doesn't declare a
- // named parameter named `a`:
- //
- // ```dart
- // %language=2.9
- // class C {
- // m({int b}) {}
- // }
- //
- // void f(C c) {
- // c.m([!a!]: 1);
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the argument name is mistyped, then replace it with the correct name.
- // The example above can be fixed by changing `a` to `b`:
- //
- // ```dart
- // %language=2.9
- // class C {
- // m({int b}) {}
- // }
- //
- // void f(C c) {
- // c.m(b: 1);
- // }
- // ```
- //
- // If a subclass adds a parameter with the name in question, then cast the
- // receiver to the subclass:
- //
- // ```dart
- // %language=2.9
- // class C {
- // m({int b}) {}
- // }
- //
- // class D extends C {
- // m({int a, int b}) {}
- // }
- //
- // void f(C c) {
- // (c as D).m(a: 1);
- // }
- // ```
- //
- // If the parameter should be added to the function, then add it:
- //
- // ```dart
- // %language=2.9
- // class C {
- // m({int a, int b}) {}
- // }
- //
- // void f(C c) {
- // c.m(a: 1);
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the requested named parameter
static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER =
CompileTimeErrorCode(
'UNDEFINED_NAMED_PARAMETER',
@@ -16657,38 +4475,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the operator
- * 1: the name of the enclosing type where the operator is being looked for
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a user-definable operator is
- // invoked on an object for which the operator isn't defined.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the class `C` doesn't
- // define the operator `+`:
- //
- // ```dart
- // class C {}
- //
- // C f(C c) => c [!+!] 2;
- // ```
- //
- // #### Common fixes
- //
- // If the operator should be defined for the class, then define it:
- //
- // ```dart
- // class C {
- // C operator +(int i) => this;
- // }
- //
- // C f(C c) => c + 2;
- // ```
+ /// Parameters:
+ /// 0: the name of the operator
+ /// 1: the name of the enclosing type where the operator is being looked for
static const CompileTimeErrorCode UNDEFINED_OPERATOR = CompileTimeErrorCode(
'UNDEFINED_OPERATOR',
"The operator '{0}' isn't defined for the type '{1}'.",
@@ -16696,35 +4485,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a prefixed identifier is found
- // where the prefix is valid, but the identifier isn't declared in any of the
- // libraries imported using that prefix.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `dart:core` doesn't
- // define anything named `a`:
- //
- // ```dart
- // import 'dart:core' as p;
- //
- // void f() {
- // p.[!a!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the library in which the name is declared isn't imported yet, add an
- // import for the library.
- //
- // If the name is wrong, then change it to one of the names that's declared in
- // the imported libraries.
+ /// No parameters.
static const CompileTimeErrorCode UNDEFINED_PREFIXED_NAME =
CompileTimeErrorCode(
'UNDEFINED_PREFIXED_NAME',
@@ -16736,45 +4497,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the setter
- * 1: the name of the enclosing type where the setter is being looked for
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a setter but either isn't defined or isn't
- // visible in the scope in which the identifier is being referenced.
- //
- // #### Example
- //
- // The following code produces this diagnostic because there isn't a setter
- // named `z`:
- //
- // ```dart
- // class C {
- // int x = 0;
- // void m(int y) {
- // this.[!z!] = y;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a setter that is defined. The example above can be corrected by
- // fixing the spelling of the setter:
- //
- // ```dart
- // class C {
- // int x = 0;
- // void m(int y) {
- // this.x = y;
- // }
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the setter
+ /// 1: the name of the enclosing type where the setter is being looked for
static const CompileTimeErrorCode UNDEFINED_SETTER = CompileTimeErrorCode(
'UNDEFINED_SETTER',
"The setter '{0}' isn't defined for the type '{1}'.",
@@ -16785,11 +4510,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the setter
- * 1: the name of the function type alias
- */
+ /// Parameters:
+ /// 0: the name of the setter
+ /// 1: the name of the function type alias
static const CompileTimeErrorCode UNDEFINED_SETTER_ON_FUNCTION_TYPE =
CompileTimeErrorCode(
'UNDEFINED_SETTER',
@@ -16801,11 +4524,9 @@
uniqueName: 'UNDEFINED_SETTER_ON_FUNCTION_TYPE',
);
- /**
- * Parameters:
- * 0: the name of the getter
- * 1: the name of the enclosing type where the getter is being looked for
- */
+ /// Parameters:
+ /// 0: the name of the getter
+ /// 1: the name of the enclosing type where the getter is being looked for
static const CompileTimeErrorCode UNDEFINED_SUPER_GETTER =
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
@@ -16817,51 +4538,9 @@
uniqueName: 'UNDEFINED_SUPER_GETTER',
);
- /**
- * Parameters:
- * 0: the name of the method that is undefined
- * 1: the resolved type name that the method lookup is happening on
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an inherited member (method,
- // getter, setter, or operator) is referenced using `super`, but there’s no
- // member with that name in the superclass chain.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `Object` doesn't define
- // a method named `n`:
- //
- // ```dart
- // class C {
- // void m() {
- // super.[!n!]();
- // }
- // }
- // ```
- //
- // The following code produces this diagnostic because `Object` doesn't define
- // a getter named `g`:
- //
- // ```dart
- // class C {
- // void m() {
- // super.[!g!];
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the inherited member you intend to invoke has a different name, then
- // make the name of the invoked member match the inherited member.
- //
- // If the member you intend to invoke is defined in the same class, then
- // remove the `super.`.
- //
- // If the member isn’t defined, then either add the member to one of the
- // superclasses or remove the invocation.
+ /// Parameters:
+ /// 0: the name of the method that is undefined
+ /// 1: the resolved type name that the method lookup is happening on
static const CompileTimeErrorCode UNDEFINED_SUPER_METHOD =
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
@@ -16873,11 +4552,9 @@
uniqueName: 'UNDEFINED_SUPER_METHOD',
);
- /**
- * Parameters:
- * 0: the name of the operator
- * 1: the name of the enclosing type where the operator is being looked for
- */
+ /// Parameters:
+ /// 0: the name of the operator
+ /// 1: the name of the enclosing type where the operator is being looked for
static const CompileTimeErrorCode UNDEFINED_SUPER_OPERATOR =
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
@@ -16887,11 +4564,9 @@
uniqueName: 'UNDEFINED_SUPER_OPERATOR',
);
- /**
- * Parameters:
- * 0: the name of the setter
- * 1: the name of the enclosing type where the setter is being looked for
- */
+ /// Parameters:
+ /// 0: the name of the setter
+ /// 1: the name of the enclosing type where the setter is being looked for
static const CompileTimeErrorCode UNDEFINED_SUPER_SETTER =
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
@@ -16903,50 +4578,12 @@
uniqueName: 'UNDEFINED_SUPER_SETTER',
);
- /**
- * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used
- * when we are able to find the name defined in a supertype. It exists to
- * provide a more informative error message.
- *
- * Parameters:
- * 0: the name of the defining type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when code in one class references a
- // static member in a superclass without prefixing the member's name with the
- // name of the superclass. Static members can only be referenced without a
- // prefix in the class in which they're declared.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the static field `x` is
- // referenced in the getter `g` without prefixing it with the name of the
- // defining class:
- //
- // ```dart
- // class A {
- // static int x = 3;
- // }
- //
- // class B extends A {
- // int get g => [!x!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Prefix the name of the static member with the name of the declaring class:
- //
- // ```dart
- // class A {
- // static int x = 3;
- // }
- //
- // class B extends A {
- // int get g => A.x;
- // }
- // ```
+ /// This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used
+ /// when we are able to find the name defined in a supertype. It exists to
+ /// provide a more informative error message.
+ ///
+ /// Parameters:
+ /// 0: the name of the defining type
static const CompileTimeErrorCode
UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = CompileTimeErrorCode(
'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER',
@@ -16956,66 +4593,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the defining type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an undefined name is found, and
- // the name is the same as a static member of the extended type or one of its
- // superclasses.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `m` is a static member
- // of the extended type `C`:
- //
- // ```dart
- // class C {
- // static void m() {}
- // }
- //
- // extension E on C {
- // void f() {
- // [!m!]();
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If you're trying to reference a static member that's declared outside the
- // extension, then add the name of the class or extension before the reference
- // to the member:
- //
- // ```dart
- // class C {
- // static void m() {}
- // }
- //
- // extension E on C {
- // void f() {
- // C.m();
- // }
- // }
- // ```
- //
- // If you're referencing a member that isn't declared yet, add a declaration:
- //
- // ```dart
- // class C {
- // static void m() {}
- // }
- //
- // extension E on C {
- // void f() {
- // m();
- // }
- //
- // void m() {}
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the defining type
static const CompileTimeErrorCode
UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE =
CompileTimeErrorCode(
@@ -17026,29 +4605,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the URI pointing to a non-existent file
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an import, export, or part
- // directive is found where the URI refers to a file that doesn't exist.
- //
- // #### Example
- //
- // If the file `lib.dart` doesn't exist, the following code produces this
- // diagnostic:
- //
- // ```dart
- // import [!'lib.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // If the URI was mistyped or invalid, then correct the URI.
- //
- // If the URI is correct, then create the file.
+ /// Parameters:
+ /// 0: the URI pointing to a non-existent file
static const CompileTimeErrorCode URI_DOES_NOT_EXIST = CompileTimeErrorCode(
'URI_DOES_NOT_EXIST',
"Target of URI doesn't exist: '{0}'.",
@@ -17058,39 +4616,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the URI pointing to a non-existent file
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an import, export, or part
- // directive is found where the URI refers to a file that doesn't exist and
- // the name of the file ends with a pattern that's commonly produced by code
- // generators, such as one of the following:
- // - `.g.dart`
- // - `.pb.dart`
- // - `.pbenum.dart`
- // - `.pbserver.dart`
- // - `.pbjson.dart`
- // - `.template.dart`
- //
- // #### Example
- //
- // If the file `lib.g.dart` doesn't exist, the following code produces this
- // diagnostic:
- //
- // ```dart
- // import [!'lib.g.dart'!];
- // ```
- //
- // #### Common fixes
- //
- // If the file is a generated file, then run the generator that generates the
- // file.
- //
- // If the file isn't a generated file, then check the spelling of the URI or
- // create the file.
+ /// Parameters:
+ /// 0: the URI pointing to a non-existent file
static const CompileTimeErrorCode URI_HAS_NOT_BEEN_GENERATED =
CompileTimeErrorCode(
'URI_HAS_NOT_BEEN_GENERATED',
@@ -17101,37 +4628,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the string literal in an
- // `import`, `export`, or `part` directive contains an interpolation. The
- // resolution of the URIs in directives must happen before the declarations
- // are compiled, so expressions can’t be evaluated while determining the
- // values of the URIs.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the string in the
- // `import` directive contains an interpolation:
- //
- // ```dart
- // import [!'dart:$m'!];
- //
- // const m = 'math';
- // ```
- //
- // #### Common fixes
- //
- // Remove the interpolation from the URI:
- //
- // ```dart
- // import 'dart:math';
- //
- // var zero = min(0, 0);
- // ```
+ /// No parameters.
static const CompileTimeErrorCode URI_WITH_INTERPOLATION =
CompileTimeErrorCode(
'URI_WITH_INTERPOLATION',
@@ -17139,27 +4636,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a library is imported using the
- // `dart-ext` scheme.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the native library `x`
- // is being imported using a scheme of `dart-ext`:
- //
- // ```dart
- // import [!'dart-ext:x'!];
- // ```
- //
- // #### Common fixes
- //
- // Rewrite the code to use `dart:ffi` as a way of invoking the contents of the
- // native library.
+ /// No parameters.
static const CompileTimeErrorCode USE_OF_NATIVE_EXTENSION =
CompileTimeErrorCode(
'USE_OF_NATIVE_EXTENSION',
@@ -17168,33 +4645,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds an expression whose
- // type is `void`, and the expression is used in a place where a value is
- // expected, such as before a member access or on the right-hand side of an
- // assignment.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `f` doesn't produce an
- // object on which `toString` can be invoked:
- //
- // ```dart
- // void f() {}
- //
- // void g() {
- // [!f()!].toString();
- // }
- // ```
- //
- // #### Common fixes
- //
- // Either rewrite the code so that the expression has a value or rewrite the
- // code so that it doesn't depend on the value.
+ /// No parameters.
static const CompileTimeErrorCode USE_OF_VOID_RESULT = CompileTimeErrorCode(
'USE_OF_VOID_RESULT',
"This expression has a type of 'void' so its value can't be used.",
@@ -17205,38 +4656,6 @@
hasPublishedDocs: true,
);
- // #### Description
- //
- // The analyzer produces this diagnostic when an enum declaration defines a
- // member named `values`, whether the member is an enum constant, an instance
- // member, or a static member.
- //
- // Any such member conflicts with the implicit declaration of the static
- // getter named `values` that returns a list containing all the enum
- // constants.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the enum `E` defines
- // an instance member named `values`:
- //
- // ```dart
- // enum E {
- // v;
- // void [!values!]() {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the name of the conflicting member:
- //
- // ```dart
- // enum E {
- // v;
- // void getValues() {}
- // }
- // ```
static const CompileTimeErrorCode VALUES_DECLARATION_IN_ENUM =
CompileTimeErrorCode(
'VALUES_DECLARATION_IN_ENUM',
@@ -17245,46 +4664,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the object being assigned.
- * 1: the type of the variable being assigned to
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the evaluation of a constant
- // expression would result in a `CastException`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of `x` is an
- // `int`, which can't be assigned to `y` because an `int` isn't a `String`:
- //
- // ```dart
- // %language=2.9
- // const Object x = 0;
- // const String y = [!x!];
- // ```
- //
- // #### Common fixes
- //
- // If the declaration of the constant is correct, then change the value being
- // assigned to be of the correct type:
- //
- // ```dart
- // %language=2.9
- // const Object x = 0;
- // const String y = '$x';
- // ```
- //
- // If the assigned value is correct, then change the declaration to have the
- // correct type:
- //
- // ```dart
- // %language=2.9
- // const Object x = 0;
- // const int y = x;
- // ```
+ /// Parameters:
+ /// 0: the type of the object being assigned.
+ /// 1: the type of the variable being assigned to
static const CompileTimeErrorCode VARIABLE_TYPE_MISMATCH =
CompileTimeErrorCode(
'VARIABLE_TYPE_MISMATCH',
@@ -17294,23 +4676,21 @@
hasPublishedDocs: true,
);
- /**
- * Let `C` be a generic class that declares a formal type parameter `X`, and
- * assume that `T` is a direct superinterface of `C`.
- *
- * It is a compile-time error if `X` is explicitly defined as a covariant or
- * 'in' type parameter and `X` occurs in a non-covariant position in `T`.
- * It is a compile-time error if `X` is explicitly defined as a contravariant
- * or 'out' type parameter and `X` occurs in a non-contravariant position in
- * `T`.
- *
- * Parameters:
- * 0: the name of the type parameter
- * 1: the variance modifier defined for {0}
- * 2: the variance position of the type parameter {0} in the
- * superinterface {3}
- * 3: the name of the superinterface
- */
+ /// Let `C` be a generic class that declares a formal type parameter `X`, and
+ /// assume that `T` is a direct superinterface of `C`.
+ ///
+ /// It is a compile-time error if `X` is explicitly defined as a covariant or
+ /// 'in' type parameter and `X` occurs in a non-covariant position in `T`.
+ /// It is a compile-time error if `X` is explicitly defined as a contravariant
+ /// or 'out' type parameter and `X` occurs in a non-contravariant position in
+ /// `T`.
+ ///
+ /// Parameters:
+ /// 0: the name of the type parameter
+ /// 1: the variance modifier defined for {0}
+ /// 2: the variance position of the type parameter {0} in the
+ /// superinterface {3}
+ /// 3: the name of the superinterface
static const CompileTimeErrorCode
WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE =
CompileTimeErrorCode(
@@ -17322,40 +4702,10 @@
"parameters in 'out' positions in the superinterface.",
);
- /**
- * Parameters:
- * 0: the name of the declared operator
- * 1: the number of parameters expected
- * 2: the number of parameters found in the operator declaration
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a declaration of an operator has
- // the wrong number of parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the operator `+` must
- // have a single parameter corresponding to the right operand:
- //
- // ```dart
- // class C {
- // int operator [!+!](a, b) => 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add or remove parameters to match the required number:
- //
- // ```dart
- // class C {
- // int operator +(a) => 0;
- // }
- // ```
- // TODO(brianwilkerson) It would be good to add a link to the spec or some
- // other documentation that lists the number of parameters for each operator,
- // but I don't know what to link to.
+ /// Parameters:
+ /// 0: the name of the declared operator
+ /// 1: the number of parameters expected
+ /// 2: the number of parameters found in the operator declaration
static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR',
@@ -17363,13 +4713,11 @@
hasPublishedDocs: true,
);
- /**
- * 7.1.1 Operators: It is a compile time error if the arity of the
- * user-declared operator - is not 0 or 1.
- *
- * Parameters:
- * 0: the number of parameters found in the operator declaration
- */
+ /// 7.1.1 Operators: It is a compile time error if the arity of the
+ /// user-declared operator - is not 0 or 1.
+ ///
+ /// Parameters:
+ /// 0: the number of parameters found in the operator declaration
static const CompileTimeErrorCode
WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS = CompileTimeErrorCode(
'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR',
@@ -17378,47 +4726,7 @@
uniqueName: 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS',
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a setter is found that doesn't
- // declare exactly one required positional parameter.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the setter `s` declares
- // two required parameters:
- //
- // ```dart
- // %language=2.9
- // class C {
- // set [!s!](int x, int y) {}
- // }
- // ```
- //
- // The following code produces this diagnostic because the setter `s` declares
- // one optional parameter:
- //
- // ```dart
- // %language=2.9
- // class C {
- // set [!s!]([int x]) {}
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the declaration so that there's exactly one required positional
- // parameter:
- //
- // ```dart
- // %language=2.9
- // class C {
- // set s(int x) {}
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER',
@@ -17426,53 +4734,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the type being referenced (<i>G</i>)
- * 1: the number of type parameters that were declared
- * 2: the number of type arguments provided
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type that has type parameters
- // is used and type arguments are provided, but the number of type arguments
- // isn't the same as the number of type parameters.
- //
- // The analyzer also produces this diagnostic when a constructor is invoked
- // and the number of type arguments doesn't match the number of type
- // parameters declared for the class.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `C` has one type
- // parameter but two type arguments are provided when it is used as a type
- // annotation:
- //
- // ```dart
- // class C<E> {}
- //
- // void f([!C<int, int>!] x) {}
- // ```
- //
- // The following code produces this diagnostic because `C` declares one type
- // parameter, but two type arguments are provided when creating an instance:
- //
- // ```dart
- // class C<E> {}
- //
- // var c = [!C<int, int>!]();
- // ```
- //
- // #### Common fixes
- //
- // Add or remove type arguments, as necessary, to match the number of type
- // parameters defined for the type:
- //
- // ```dart
- // class C<E> {}
- //
- // void f(C<int> x) {}
- // ```
+ /// Parameters:
+ /// 0: the name of the type being referenced (<i>G</i>)
+ /// 1: the number of type parameters that were declared
+ /// 2: the number of type arguments provided
static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS',
@@ -17484,11 +4749,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the number of type parameters that were declared
- * 1: the number of type arguments provided
- */
+ /// Parameters:
+ /// 0: the number of type parameters that were declared
+ /// 1: the number of type arguments provided
static const CompileTimeErrorCode
WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION = CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION',
@@ -17500,53 +4763,9 @@
uniqueName: 'WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION',
);
- /**
- * Parameters:
- * 0: the name of the class being instantiated
- * 1: the name of the constructor being invoked
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when type arguments are provided
- // after the name of a named constructor. Constructors can't declare type
- // parameters, so invocations can only provide the type arguments associated
- // with the class, and those type arguments are required to follow the name of
- // the class rather than the name of the constructor.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the type parameters
- // (`<String>`) follow the name of the constructor rather than the name of the
- // class:
- //
- // ```dart
- // class C<T> {
- // C.named();
- // }
- // C f() => C.named[!<String>!]();
- // ```
- //
- // #### Common fixes
- //
- // If the type arguments are for the class' type parameters, then move the
- // type arguments to follow the class name:
- //
- // ```dart
- // class C<T> {
- // C.named();
- // }
- // C f() => C<String>.named();
- // ```
- //
- // If the type arguments aren't for the class' type parameters, then remove
- // them:
- //
- // ```dart
- // class C<T> {
- // C.named();
- // }
- // C f() => C.named();
- // ```
+ /// Parameters:
+ /// 0: the name of the class being instantiated
+ /// 1: the name of the constructor being invoked
static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR',
@@ -17555,49 +4774,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the number of type parameters that were declared
- * 1: the number of type arguments provided
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an enum constant in an enum
- // that has type parameters is instantiated and type arguments are provided,
- // but the number of type arguments isn't the same as the number of type
- // parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the enum constant `c`
- // provides one type argument even though the enum `E` is declared to have
- // two type parameters:
- //
- // ```dart
- // enum E<T, U> {
- // c[!<int>!]()
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the number of type parameters is correct, then change the number of
- // type arguments to match the number of type parameters:
- //
- // ```dart
- // enum E<T, U> {
- // c<int, String>()
- // }
- // ```
- //
- // If the number of type arguments is correct, then change the number of type
- // parameters to match the number of type arguments:
- //
- // ```dart
- // enum E<T> {
- // c<int>()
- // }
- // ```
+ /// Parameters:
+ /// 0: the number of type parameters that were declared
+ /// 1: the number of type arguments provided
static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_ENUM =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_ENUM',
@@ -17607,48 +4786,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the extension being referenced
- * 1: the number of type parameters that were declared
- * 2: the number of type arguments provided
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an extension that has type
- // parameters is used and type arguments are provided, but the number of type
- // arguments isn't the same as the number of type parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the extension `E` is
- // declared to have a single type parameter (`T`), but the extension override
- // has two type arguments:
- //
- // ```dart
- // extension E<T> on List<T> {
- // int get len => length;
- // }
- //
- // void f(List<int> p) {
- // E[!<int, String>!](p).len;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the type arguments so that there are the same number of type
- // arguments as there are type parameters:
- //
- // ```dart
- // extension E<T> on List<T> {
- // int get len => length;
- // }
- //
- // void f(List<int> p) {
- // E<int>(p).len;
- // }
- // ```
+ /// Parameters:
+ /// 0: the name of the extension being referenced
+ /// 1: the number of type parameters that were declared
+ /// 2: the number of type arguments provided
static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_EXTENSION =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_EXTENSION',
@@ -17658,12 +4799,10 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the function being referenced
- * 1: the number of type parameters that were declared
- * 2: the number of type arguments provided
- */
+ /// Parameters:
+ /// 0: the name of the function being referenced
+ /// 1: the number of type parameters that were declared
+ /// 2: the number of type arguments provided
static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION',
@@ -17674,55 +4813,10 @@
"type parameters.",
);
- /**
- * Parameters:
- * 0: the name of the method being referenced (<i>G</i>)
- * 1: the number of type parameters that were declared
- * 2: the number of type arguments provided
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function is invoked
- // with a different number of type arguments than the number of type
- // parameters specified in its declaration. There must either be no type
- // arguments or the number of arguments must match the number of parameters.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the invocation of the
- // method `m` has two type arguments, but the declaration of `m` only has one
- // type parameter:
- //
- // ```dart
- // class C {
- // int m<A>(A a) => 0;
- // }
- //
- // int f(C c) => c.m[!<int, int>!](2);
- // ```
- //
- // #### Common fixes
- //
- // If the type arguments are necessary, then make them match the number of
- // type parameters by either adding or removing type arguments:
- //
- // ```dart
- // class C {
- // int m<A>(A a) => 0;
- // }
- //
- // int f(C c) => c.m<int>(2);
- // ```
- //
- // If the type arguments aren't necessary, then remove them:
- //
- // ```dart
- // class C {
- // int m<A>(A a) => 0;
- // }
- //
- // int f(C c) => c.m(2);
- // ```
+ /// Parameters:
+ /// 0: the name of the method being referenced (<i>G</i>)
+ /// 1: the number of type parameters that were declared
+ /// 2: the number of type arguments provided
static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD =
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD',
@@ -17732,11 +4826,9 @@
hasPublishedDocs: true,
);
- /**
- * Let `C` be a generic class that declares a formal type parameter `X`, and
- * assume that `T` is a direct superinterface of `C`. It is a compile-time
- * error if `X` occurs contravariantly or invariantly in `T`.
- */
+ /// Let `C` be a generic class that declares a formal type parameter `X`, and
+ /// assume that `T` is a direct superinterface of `C`. It is a compile-time
+ /// error if `X` occurs contravariantly or invariantly in `T`.
static const CompileTimeErrorCode
WRONG_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE = CompileTimeErrorCode(
'WRONG_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE',
@@ -17747,24 +4839,22 @@
"superinterfaces.",
);
- /**
- * Let `C` be a generic class that declares a formal type parameter `X`.
- *
- * If `X` is explicitly contravariant then it is a compile-time error for
- * `X` to occur in a non-contravariant position in a member signature in the
- * body of `C`, except when `X` is in a contravariant position in the type
- * annotation of a covariant formal parameter.
- *
- * If `X` is explicitly covariant then it is a compile-time error for
- * `X` to occur in a non-covariant position in a member signature in the
- * body of `C`, except when `X` is in a covariant position in the type
- * annotation of a covariant formal parameter.
- *
- * Parameters:
- * 0: the variance modifier defined for {0}
- * 1: the name of the type parameter
- * 2: the variance position that the type parameter {1} is in
- */
+ /// Let `C` be a generic class that declares a formal type parameter `X`.
+ ///
+ /// If `X` is explicitly contravariant then it is a compile-time error for
+ /// `X` to occur in a non-contravariant position in a member signature in the
+ /// body of `C`, except when `X` is in a contravariant position in the type
+ /// annotation of a covariant formal parameter.
+ ///
+ /// If `X` is explicitly covariant then it is a compile-time error for
+ /// `X` to occur in a non-covariant position in a member signature in the
+ /// body of `C`, except when `X` is in a covariant position in the type
+ /// annotation of a covariant formal parameter.
+ ///
+ /// Parameters:
+ /// 0: the variance modifier defined for {0}
+ /// 1: the name of the type parameter
+ /// 2: the variance position that the type parameter {1} is in
static const CompileTimeErrorCode WRONG_TYPE_PARAMETER_VARIANCE_POSITION =
CompileTimeErrorCode(
'WRONG_TYPE_PARAMETER_VARIANCE_POSITION',
@@ -17775,46 +4865,7 @@
"'out', or 'inout'.",
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `yield` or `yield*` statement
- // appears in a function whose body isn't marked with one of the `async*` or
- // `sync*` modifiers.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `yield` is being used
- // in a function whose body doesn't have a modifier:
- //
- // ```dart
- // Iterable<int> get digits {
- // yield* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- // }
- // ```
- //
- // The following code produces this diagnostic because `yield*` is being used
- // in a function whose body has the `async` modifier rather than the `async*`
- // modifier:
- //
- // ```dart
- // Stream<int> get digits async {
- // yield* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Add a modifier, or change the existing modifier to be either `async*` or
- // `sync*`:
- //
- // ```dart
- // Iterable<int> get digits sync* {
- // yield* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- // }
- // ```
+ /// No parameters.
static const CompileTimeErrorCode YIELD_EACH_IN_NON_GENERATOR =
CompileTimeErrorCode(
'YIELD_IN_NON_GENERATOR',
@@ -17826,11 +4877,9 @@
uniqueName: 'YIELD_EACH_IN_NON_GENERATOR',
);
- /**
- * Parameters:
- * 0: the type of the expression after `yield*`
- * 1: the return type of the function containing the `yield*`
- */
+ /// Parameters:
+ /// 0: the type of the expression after `yield*`
+ /// 1: the return type of the function containing the `yield*`
static const CompileTimeErrorCode YIELD_EACH_OF_INVALID_TYPE =
CompileTimeErrorCode(
'YIELD_OF_INVALID_TYPE',
@@ -17840,12 +4889,10 @@
uniqueName: 'YIELD_EACH_OF_INVALID_TYPE',
);
- /**
- * ?? Yield: It is a compile-time error if a yield statement appears in a
- * function that is not a generator function.
- *
- * No parameters.
- */
+ /// ?? Yield: It is a compile-time error if a yield statement appears in a
+ /// function that is not a generator function.
+ ///
+ /// No parameters.
static const CompileTimeErrorCode YIELD_IN_NON_GENERATOR =
CompileTimeErrorCode(
'YIELD_IN_NON_GENERATOR',
@@ -17856,50 +4903,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the type of the expression after `yield`
- * 1: the return type of the function containing the `yield`
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the type of object produced by
- // a `yield` or `yield*` expression doesn't match the type of objects that
- // are to be returned from the `Iterable` or `Stream` types that are returned
- // from a generator (a function or method marked with either `sync*` or
- // `async*`).
- //
- // #### Example
- //
- // The following code produces this diagnostic because the getter `zero` is
- // declared to return an `Iterable` that returns integers, but the `yield` is
- // returning a string from the iterable:
- //
- // ```dart
- // Iterable<int> get zero sync* {
- // yield [!'0'!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the return type of the function is correct, then fix the expression
- // following the keyword `yield` to return the correct type:
- //
- // ```dart
- // Iterable<int> get zero sync* {
- // yield 0;
- // }
- // ```
- //
- // If the expression following the `yield` is correct, then change the return
- // type of the function to allow it:
- //
- // ```dart
- // Iterable<String> get zero sync* {
- // yield '0';
- // }
- // ```
+ /// Parameters:
+ /// 0: the type of the expression after `yield`
+ /// 1: the return type of the function containing the `yield`
static const CompileTimeErrorCode YIELD_OF_INVALID_TYPE =
CompileTimeErrorCode(
'YIELD_OF_INVALID_TYPE',
@@ -18037,82 +5043,7 @@
}
class StaticWarningCode extends AnalyzerErrorCode {
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic in two cases.
- //
- // The first is when the left operand of an `??` operator can't be `null`.
- // The right operand is only evaluated if the left operand has the value
- // `null`, and because the left operand can't be `null`, the right operand is
- // never evaluated.
- //
- // The second is when the left-hand side of an assignment using the `??=`
- // operator can't be `null`. The right-hand side is only evaluated if the
- // left-hand side has the value `null`, and because the left-hand side can't
- // be `null`, the right-hand side is never evaluated.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` can't be `null`:
- //
- // ```dart
- // int f(int x) {
- // return x ?? [!0!];
- // }
- // ```
- //
- // The following code produces this diagnostic because `f` can't be `null`:
- //
- // ```dart
- // class C {
- // int f = -1;
- //
- // void m(int x) {
- // f ??= [!x!];
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the diagnostic is reported for an `??` operator, then remove the `??`
- // operator and the right operand:
- //
- // ```dart
- // int f(int x) {
- // return x;
- // }
- // ```
- //
- // If the diagnostic is reported for an assignment, and the assignment isn't
- // needed, then remove the assignment:
- //
- // ```dart
- // class C {
- // int f = -1;
- //
- // void m(int x) {
- // }
- // }
- // ```
- //
- // If the assignment is needed, but should be based on a different condition,
- // then rewrite the code to use `=` and the different condition:
- //
- // ```dart
- // class C {
- // int f = -1;
- //
- // void m(int x) {
- // if (f < 0) {
- // f = x;
- // }
- // }
- // }
- // ```
+ /// No parameters.
static const StaticWarningCode DEAD_NULL_AWARE_EXPRESSION = StaticWarningCode(
'DEAD_NULL_AWARE_EXPRESSION',
"The left operand can't be null, so the right operand is never executed.",
@@ -18120,79 +5051,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the null-aware operator that is invalid
- * 1: the non-null-aware operator that can replace the invalid operator
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a null-aware operator (`?.`,
- // `?..`, `?[`, `?..[`, or `...?`) is used on a receiver that's known to be
- // non-nullable.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `s` can't be `null`:
- //
- // ```dart
- // int? getLength(String s) {
- // return s[!?.!]length;
- // }
- // ```
- //
- // The following code produces this diagnostic because `a` can't be `null`:
- //
- // ```dart
- // var a = [];
- // var b = [[!...?!]a];
- // ```
- //
- // The following code produces this diagnostic because `s?.length` can't
- // return `null`:
- //
- // ```dart
- // void f(String? s) {
- // s?.length[!?.!]isEven;
- // }
- // ```
- //
- // The reason `s?.length` can't return `null` is because the null-aware
- // operator following `s` short-circuits the evaluation of both `length` and
- // `isEven` if `s` is `null`. In other words, if `s` is `null`, then neither
- // `length` nor `isEven` will be invoked, and if `s` is non-`null`, then
- // `length` can't return a `null` value. Either way, `isEven` can't be invoked
- // on a `null` value, so the null-aware operator isn't necessary. See
- // [Understanding null safety](/null-safety/understanding-null-safety#smarter-null-aware-methods)
- // for more details.
- //
- // The following code produces this diagnostic because `s` can't be `null`.
- //
- // ```dart
- // void f(Object? o) {
- // var s = o as String;
- // s[!?.!]length;
- // }
- // ```
- //
- // The reason `s` can't be null, despite the fact that `o` can be `null`, is
- // because of the cast to `String`, which is a non-nullable type. If `o` ever
- // has the value `null`, the cast will fail and the invocation of `length`
- // will not happen.
- //
- // #### Common fixes
- //
- // Replace the null-aware operator with a non-null-aware equivalent; for
- // example, change `?.` to `.`:
- //
- // ```dart
- // int getLength(String s) {
- // return s.length;
- // }
- // ```
- //
- // (Note that the return type was also changed to be non-nullable, which might
- // not be appropriate in some cases.)
+ /// Parameters:
+ /// 0: the null-aware operator that is invalid
+ /// 1: the non-null-aware operator that can replace the invalid operator
static const StaticWarningCode INVALID_NULL_AWARE_OPERATOR =
StaticWarningCode(
'INVALID_NULL_AWARE_OPERATOR',
@@ -18202,11 +5063,9 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the null-aware operator that is invalid
- * 1: the non-null-aware operator that can replace the invalid operator
- */
+ /// Parameters:
+ /// 0: the null-aware operator that is invalid
+ /// 1: the non-null-aware operator that can replace the invalid operator
static const StaticWarningCode
INVALID_NULL_AWARE_OPERATOR_AFTER_SHORT_CIRCUIT = StaticWarningCode(
'INVALID_NULL_AWARE_OPERATOR',
@@ -18217,13 +5076,11 @@
uniqueName: 'INVALID_NULL_AWARE_OPERATOR_AFTER_SHORT_CIRCUIT',
);
- /**
- * 7.1 Instance Methods: It is a static warning if an instance method
- * <i>m1</i> overrides an instance member <i>m2</i>, the signature of
- * <i>m2</i> explicitly specifies a default value for a formal parameter
- * <i>p</i> and the signature of <i>m1</i> specifies a different default value
- * for <i>p</i>.
- */
+ /// 7.1 Instance Methods: It is a static warning if an instance method
+ /// <i>m1</i> overrides an instance member <i>m2</i>, the signature of
+ /// <i>m2</i> explicitly specifies a default value for a formal parameter
+ /// <i>p</i> and the signature of <i>m1</i> specifies a different default value
+ /// for <i>p</i>.
static const StaticWarningCode
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED',
@@ -18232,13 +5089,11 @@
correctionMessage: "Try using the same default value in both methods.",
);
- /**
- * 7.1 Instance Methods: It is a static warning if an instance method
- * <i>m1</i> overrides an instance member <i>m2</i>, the signature of
- * <i>m2</i> explicitly specifies a default value for a formal parameter
- * <i>p</i> and the signature of <i>m1</i> specifies a different default value
- * for <i>p</i>.
- */
+ /// 7.1 Instance Methods: It is a static warning if an instance method
+ /// <i>m1</i> overrides an instance member <i>m2</i>, the signature of
+ /// <i>m2</i> explicitly specifies a default value for a formal parameter
+ /// <i>p</i> and the signature of <i>m1</i> specifies a different default value
+ /// for <i>p</i>.
static const StaticWarningCode
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL = StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL',
@@ -18247,69 +5102,8 @@
correctionMessage: "Try using the same default value in both methods.",
);
- /**
- * Parameters:
- * 0: the name of the constant that is missing
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a `switch` statement for an enum
- // doesn't include an option for one of the values in the enum.
- //
- // Note that `null` is always a possible value for an enum and therefore also
- // must be handled.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the enum constant `e2`
- // isn't handled:
- //
- // ```dart
- // enum E { e1, e2 }
- //
- // void f(E e) {
- // [!switch (e)!] {
- // case E.e1:
- // break;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If there's special handling for the missing values, then add a `case`
- // clause for each of the missing values:
- //
- // ```dart
- // enum E { e1, e2 }
- //
- // void f(E e) {
- // switch (e) {
- // case E.e1:
- // break;
- // case E.e2:
- // break;
- // }
- // }
- // ```
- //
- // If the missing values should be handled the same way, then add a `default`
- // clause:
- //
- // ```dart
- // enum E { e1, e2 }
- //
- // void f(E e) {
- // switch (e) {
- // case E.e1:
- // break;
- // default:
- // break;
- // }
- // }
- // ```
- // TODO(brianwilkerson) This documentation will need to be updated when NNBD
- // ships.
+ /// Parameters:
+ /// 0: the name of the constant that is missing
static const StaticWarningCode MISSING_ENUM_CONSTANT_IN_SWITCH =
StaticWarningCode(
'MISSING_ENUM_CONSTANT_IN_SWITCH',
@@ -18320,33 +5114,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the operand of the `!` operator
- // can't be `null`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because `x` can't be `null`:
- //
- // ```dart
- // int f(int x) {
- // return x[!!!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // Remove the null check operator (`!`):
- //
- // ```dart
- // int f(int x) {
- // return x;
- // }
- // ```
+ /// No parameters.
static const StaticWarningCode UNNECESSARY_NON_NULL_ASSERTION =
StaticWarningCode(
'UNNECESSARY_NON_NULL_ASSERTION',
diff --git a/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart b/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
index 3e8424e..8fc1f98 100644
--- a/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
+++ b/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
@@ -9,15 +9,9 @@
import "package:analyzer/error/error.dart";
-// It is hard to visually separate each code's _doc comment_ from its published
-// _documentation comment_ when each is written as an end-of-line comment.
-// ignore_for_file: slash_for_doc_comments
-
class ManifestWarningCode extends ErrorCode {
- /**
- * A code indicating that the camera permissions is not supported on Chrome
- * OS.
- */
+ /// A code indicating that the camera permissions is not supported on Chrome
+ /// OS.
static const ManifestWarningCode CAMERA_PERMISSIONS_INCOMPATIBLE =
ManifestWarningCode(
'CAMERA_PERMISSIONS_INCOMPATIBLE',
@@ -31,9 +25,7 @@
"android:required=\"false\">`.",
);
- /**
- * A code indicating that the activity is set to be non resizable.
- */
+ /// A code indicating that the activity is set to be non resizable.
static const ManifestWarningCode NON_RESIZABLE_ACTIVITY = ManifestWarningCode(
'NON_RESIZABLE_ACTIVITY',
"The `<activity>` element should be allowed to be resized to allow users "
@@ -43,10 +35,8 @@
"`resizableActivity=\"true\"` attribute.",
);
- /**
- * A code indicating that the touchscreen feature is not specified in the
- * manifest.
- */
+ /// A code indicating that the touchscreen feature is not specified in the
+ /// manifest.
static const ManifestWarningCode NO_TOUCHSCREEN_FEATURE = ManifestWarningCode(
'NO_TOUCHSCREEN_FEATURE',
"The default \"android.hardware.touchscreen\" needs to be optional for "
@@ -56,10 +46,8 @@
"/> to the manifest.",
);
- /**
- * A code indicating that a specified permission is not supported on Chrome
- * OS.
- */
+ /// A code indicating that a specified permission is not supported on Chrome
+ /// OS.
static const ManifestWarningCode PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE =
ManifestWarningCode(
'PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE',
@@ -69,9 +57,7 @@
"android:required=\"false\">`.",
);
- /**
- * A code indicating that the activity is locked to an orientation.
- */
+ /// A code indicating that the activity is locked to an orientation.
static const ManifestWarningCode SETTING_ORIENTATION_ON_ACTIVITY =
ManifestWarningCode(
'SETTING_ORIENTATION_ON_ACTIVITY',
@@ -83,9 +69,7 @@
"`screenOrientation=\"unspecified\"` or `\"fullSensor\"` attribute.",
);
- /**
- * A code indicating that a specified feature is not supported on Chrome OS.
- */
+ /// A code indicating that a specified feature is not supported on Chrome OS.
static const ManifestWarningCode UNSUPPORTED_CHROME_OS_FEATURE =
ManifestWarningCode(
'UNSUPPORTED_CHROME_OS_FEATURE',
@@ -95,10 +79,8 @@
"Try changing to `android:required=\"false\"` for this feature.",
);
- /**
- * A code indicating that a specified hardware feature is not supported on
- * Chrome OS.
- */
+ /// A code indicating that a specified hardware feature is not supported on
+ /// Chrome OS.
static const ManifestWarningCode UNSUPPORTED_CHROME_OS_HARDWARE =
ManifestWarningCode(
'UNSUPPORTED_CHROME_OS_HARDWARE',
diff --git a/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart b/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
index cc54c3a..7ca6652 100644
--- a/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
+++ b/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
@@ -9,40 +9,9 @@
import "package:analyzer/error/error.dart";
-// It is hard to visually separate each code's _doc comment_ from its published
-// _documentation comment_ when each is written as an end-of-line comment.
-// ignore_for_file: slash_for_doc_comments
-
class PubspecWarningCode extends ErrorCode {
- /**
- * Parameters:
- * 0: the path to the asset directory as given in the file.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an asset list contains a value
- // referencing a directory that doesn't exist.
- //
- // #### Example
- //
- // Assuming that the directory `assets` doesn't exist, the following code
- // produces this diagnostic because it's listed as a directory containing
- // assets:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter:
- // assets:
- // - assets/
- // ```
- //
- // #### Common fixes
- //
- // If the path is correct, then create a directory at that path.
- //
- // If the path isn't correct, then change the path to match the path of the
- // directory containing the assets.
+ /// Parameters:
+ /// 0: the path to the asset directory as given in the file.
static const PubspecWarningCode ASSET_DIRECTORY_DOES_NOT_EXIST =
PubspecWarningCode(
'ASSET_DIRECTORY_DOES_NOT_EXIST',
@@ -52,34 +21,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the path to the asset as given in the file.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an asset list contains a value
- // referencing a file that doesn't exist.
- //
- // #### Example
- //
- // Assuming that the file `doesNotExist.gif` doesn't exist, the following code
- // produces this diagnostic because it's listed as an asset:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter:
- // assets:
- // - doesNotExist.gif
- // ```
- //
- // #### Common fixes
- //
- // If the path is correct, then create a file at that path.
- //
- // If the path isn't correct, then change the path to match the path of the
- // file containing the asset.
+ /// Parameters:
+ /// 0: the path to the asset as given in the file.
static const PubspecWarningCode ASSET_DOES_NOT_EXIST = PubspecWarningCode(
'ASSET_DOES_NOT_EXIST',
"The asset file '{0}' doesn't exist.",
@@ -87,37 +30,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of the `asset` key
- // isn't a list.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of the assets
- // key is a string when a list is expected:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter:
- // assets: assets/
- // ```
- //
- // #### Common fixes
- //
- // Change the value of the asset list so that it's a list:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter:
- // assets:
- // - assets/
- // ```
+ /// No parameters.
static const PubspecWarningCode ASSET_FIELD_NOT_LIST = PubspecWarningCode(
'ASSET_FIELD_NOT_LIST',
"The value of the 'asset' field is expected to be a list of relative file "
@@ -127,39 +40,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an asset list contains a value
- // that isn't a string.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the asset list contains
- // a map:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter:
- // assets:
- // - image.gif: true
- // ```
- //
- // #### Common fixes
- //
- // Change the asset list so that it only contains valid POSIX-style file
- // paths:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter:
- // assets:
- // - image.gif
- // ```
+ /// No parameters.
static const PubspecWarningCode ASSET_NOT_STRING = PubspecWarningCode(
'ASSET_NOT_STRING',
"Assets are required to be file paths (strings).",
@@ -167,36 +48,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of either the
- // `dependencies` or `dev_dependencies` key isn't a map.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of the
- // top-level `dependencies` key is a list:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // - meta
- // ```
- //
- // #### Common fixes
- //
- // Use a map as the value of the `dependencies` key:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // meta: ^1.0.2
- // ```
+ /// No parameters.
static const PubspecWarningCode DEPENDENCIES_FIELD_NOT_MAP =
PubspecWarningCode(
'DEPENDENCIES_FIELD_NOT_MAP',
@@ -205,34 +57,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a key is used in a
- // `pubspec.yaml` file that was deprecated. Unused keys take up space and
- // might imply semantics that are no longer valid.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the `author` key is no
- // longer being used:
- //
- // ```dart
- // %uri="pubspec.yaml"
- // name: example
- // author: 'Dash'
- // ```
- //
- // #### Common fixes
- //
- // Remove the deprecated key:
- //
- // ```dart
- // %uri="pubspec.yaml"
- // name: example
- // ```
+ /// No parameters.
static const PubspecWarningCode DEPRECATED_FIELD = PubspecWarningCode(
'DEPRECATED_FIELD',
"The '{0}' field is no longer used and can be removed.",
@@ -240,44 +65,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the value of the `flutter` key
- // isn't a map.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value of the
- // top-level `flutter` key is a string:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter: true
- // ```
- //
- // #### Common fixes
- //
- // If you need to specify Flutter-specific options, then change the value to
- // be a map:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // flutter:
- // uses-material-design: true
- // ```
- //
- // If you don't need to specify Flutter-specific options, then remove the
- // `flutter` key:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // ```
+ /// No parameters.
static const PubspecWarningCode FLUTTER_FIELD_NOT_MAP = PubspecWarningCode(
'FLUTTER_FIELD_NOT_MAP',
"The value of the 'flutter' field is expected to be a map.",
@@ -285,55 +73,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the kind of dependency.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a package under either
- // `dependencies` or `dev_dependencies` isn't a pub, `git`, or `path` based
- // dependency.
- //
- // See [Package dependencies](https://dart.dev/tools/pub/dependencies) for
- // more information about the kind of dependencies that are supported.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the dependency on the
- // package `transmogrify` isn't a pub, `git`, or `path` based dependency:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // transmogrify:
- // hosted:
- // name: transmogrify
- // url: http://your-package-server.com
- // version: ^1.4.0
- // ```
- //
- // #### Common fixes
- //
- // If you want to publish your package to `pub.dev`, then change the
- // dependencies to ones that are supported by `pub`.
- //
- // If you don't want to publish your package to `pub.dev`, then add a
- // `publish_to: none` entry to mark the package as one that isn't intended to
- // be published:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // publish_to: none
- // dependencies:
- // transmogrify:
- // hosted:
- // name: transmogrify
- // url: http://your-package-server.com
- // version: ^1.4.0
- // ```
+ /// Parameters:
+ /// 0: the kind of dependency.
static const PubspecWarningCode INVALID_DEPENDENCY = PubspecWarningCode(
'INVALID_DEPENDENCY',
"Publishable packages can't have '{0}' dependencies.",
@@ -343,35 +84,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's no top-level `name` key.
- // The `name` key provides the name of the package, which is required.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the package doesn't
- // have a name:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // dependencies:
- // meta: ^1.0.2
- // ```
- //
- // #### Common fixes
- //
- // Add the top-level key `name` with a value that's the name of the package:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // meta: ^1.0.2
- // ```
+ /// No parameters.
static const PubspecWarningCode MISSING_NAME = PubspecWarningCode(
'MISSING_NAME',
"The 'name' field is required but missing.",
@@ -379,33 +92,7 @@
hasPublishedDocs: true,
);
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the top-level `name` key has a
- // value that isn't a string.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the value following the
- // `name` key is a list:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name:
- // - example
- // ```
- //
- // #### Common fixes
- //
- // Replace the value with a string:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // ```
+ /// No parameters.
static const PubspecWarningCode NAME_NOT_STRING = PubspecWarningCode(
'NAME_NOT_STRING',
"The value of the 'name' field is required to be a string.",
@@ -413,34 +100,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the path to the dependency as given in the file.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a dependency has a `path` key
- // referencing a directory that doesn't exist.
- //
- // #### Example
- //
- // Assuming that the directory `doesNotExist` doesn't exist, the following
- // code produces this diagnostic because it's listed as the path of a package:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // local_package:
- // path: doesNotExist
- // ```
- //
- // #### Common fixes
- //
- // If the path is correct, then create a directory at that path.
- //
- // If the path isn't correct, then change the path to match the path to the
- // root of the package.
+ /// Parameters:
+ /// 0: the path to the dependency as given in the file.
static const PubspecWarningCode PATH_DOES_NOT_EXIST = PubspecWarningCode(
'PATH_DOES_NOT_EXIST',
"The path '{0}' doesn't exist.",
@@ -449,31 +110,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the path as given in the file.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a dependency has a `path` key
- // whose value is a string, but isn't a POSIX-style path.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the path following the
- // `path` key is a Windows path:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // local_package:
- // path: E:\local_package
- // ```
- //
- // #### Common fixes
- //
- // Convert the path to a POSIX path.
+ /// Parameters:
+ /// 0: the path as given in the file.
static const PubspecWarningCode PATH_NOT_POSIX = PubspecWarningCode(
'PATH_NOT_POSIX',
"The path '{0}' isn't a POSIX-style path.",
@@ -481,40 +119,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the path to the dependency as given in the file.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a dependency has a `path` key
- // that references a directory that doesn't contain a `pubspec.yaml` file.
- //
- // #### Example
- //
- // Assuming that the directory `local_package` doesn't contain a file named
- // `pubspec.yaml`, the following code produces this diagnostic because it's
- // listed as the path of a package:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // local_package:
- // path: local_package
- // ```
- //
- // #### Common fixes
- //
- // If the path is intended to be the root of a package, then add a
- // `pubspec.yaml` file in the directory:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: local_package
- // ```
- //
- // If the path is wrong, then replace it with the correct path.
+ /// Parameters:
+ /// 0: the path to the dependency as given in the file.
static const PubspecWarningCode PATH_PUBSPEC_DOES_NOT_EXIST =
PubspecWarningCode(
'PATH_PUBSPEC_DOES_NOT_EXIST',
@@ -525,42 +131,8 @@
hasPublishedDocs: true,
);
- /**
- * Parameters:
- * 0: the name of the package in the dev_dependency list.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when there's an entry under
- // `dev_dependencies` for a package that is also listed under `dependencies`.
- // The packages under `dependencies` are available to all of the code in the
- // package, so there's no need to also list them under `dev_dependencies`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the package `meta` is
- // listed under both `dependencies` and `dev_dependencies`:
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // meta: ^1.0.2
- // dev_dependencies:
- // meta: ^1.0.2
- // ```
- //
- // #### Common fixes
- //
- // Remove the entry under `dev_dependencies` (and the `dev_dependencies` key
- // if that's the only package listed there):
- //
- // ```yaml
- // %uri="pubspec.yaml"
- // name: example
- // dependencies:
- // meta: ^1.0.2
- // ```
+ /// Parameters:
+ /// 0: the name of the package in the dev_dependency list.
static const PubspecWarningCode UNNECESSARY_DEV_DEPENDENCY =
PubspecWarningCode(
'UNNECESSARY_DEV_DEPENDENCY',
diff --git a/pkg/analyzer/tool/messages/error_code_info.dart b/pkg/analyzer/tool/messages/error_code_info.dart
index 0b1d48e..f643590a 100644
--- a/pkg/analyzer/tool/messages/error_code_info.dart
+++ b/pkg/analyzer/tool/messages/error_code_info.dart
@@ -502,16 +502,8 @@
var out = StringBuffer();
var comment = this.comment;
if (comment != null) {
- out.writeln('$indent/**');
for (var line in comment.split('\n')) {
- out.writeln('$indent *${line.isEmpty ? '' : ' '}$line');
- }
- out.writeln('$indent */');
- }
- var documentation = this.documentation;
- if (documentation != null) {
- for (var line in documentation.split('\n')) {
- out.writeln('$indent//${line.isEmpty ? '' : ' '}$line');
+ out.writeln('$indent/// ${line.isEmpty ? '' : ' '}$line');
}
}
return out.toString();
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart
index d9cffbc..6773a78 100644
--- a/pkg/analyzer/tool/messages/generate.dart
+++ b/pkg/analyzer/tool/messages/generate.dart
@@ -81,12 +81,6 @@
for (var importPath in imports.toList()..sort()) {
out.writeln("import ${json.encode(importPath)};");
}
- out.writeln();
- out.writeln("// It is hard to visually separate each code's _doc comment_ "
- "from its published");
- out.writeln('// _documentation comment_ when each is written as an '
- 'end-of-line comment.');
- out.writeln('// ignore_for_file: slash_for_doc_comments');
if (shouldGenerateFastaAnalyzerErrorCodes) {
out.writeln();
_generateFastaAnalyzerErrorCodeList();
diff --git a/pkg/compiler/lib/src/null_compiler_output.dart b/pkg/compiler/lib/src/null_compiler_output.dart
index d7a0eb1..6832eb9 100644
--- a/pkg/compiler/lib/src/null_compiler_output.dart
+++ b/pkg/compiler/lib/src/null_compiler_output.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.10
-
/// Null pattern implementation of the [api.CompilerOutput] interface.
library compiler.null_api;
@@ -54,7 +52,7 @@
NullBinarySink(this.uri);
@override
- void write(List<int> buffer, [int start = 0, int end]) {}
+ void write(List<int> buffer, [int start = 0, int? end]) {}
@override
void close() {}
diff --git a/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
index 5f58be1..fc00e71 100644
--- a/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
+++ b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.10
-
import 'package:kernel/ast.dart' as ir;
/// Helper class that traverses a kernel AST subtree to see if it has any
@@ -74,7 +72,7 @@
@override
bool visitIfStatement(ir.IfStatement ifStatement) {
return ifStatement.then.accept(this) ||
- (ifStatement.otherwise != null && ifStatement.otherwise.accept(this));
+ (ifStatement.otherwise != null && ifStatement.otherwise!.accept(this));
}
@override
@@ -111,7 +109,7 @@
@override
bool visitFunctionNode(ir.FunctionNode node) {
- return node.body.accept(this);
+ return node.body!.accept(this);
}
@override
diff --git a/pkg/compiler/lib/src/universe/target_checks.dart b/pkg/compiler/lib/src/universe/target_checks.dart
index 11416d8..6d4ac79 100644
--- a/pkg/compiler/lib/src/universe/target_checks.dart
+++ b/pkg/compiler/lib/src/universe/target_checks.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.10
-
library dart2js.target_checks;
/// A summary of the checks required when entering a target method.
diff --git a/pkg/compiler/lib/src/util/sink_adapter.dart b/pkg/compiler/lib/src/util/sink_adapter.dart
index 7e249ebd..46996b6 100644
--- a/pkg/compiler/lib/src/util/sink_adapter.dart
+++ b/pkg/compiler/lib/src/util/sink_adapter.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.10
-
import '../../compiler_api.dart' as api;
class BinaryOutputSinkAdapter implements Sink<List<int>> {
diff --git a/tools/VERSION b/tools/VERSION
index c582ef0..6db6686 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 127
+PRERELEASE 128
PRERELEASE_PATCH 0
\ No newline at end of file