Version 2.15.0-182.0.dev
Merge commit '2b36a3945ddeeb126c4195fa54d7999df1692f36' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index f09e2dd..d282df6 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2021-10-03T09:32:39.517171",
+ "generated": "2021-10-04T10:29:25.433041",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -566,12 +566,6 @@
"languageVersion": "2.12"
},
{
- "name": "resource",
- "rootUri": "../third_party/pkg/resource",
- "packageUri": "lib/",
- "languageVersion": "2.0"
- },
- {
"name": "scrape",
"rootUri": "../pkg/scrape",
"packageUri": "lib/",
diff --git a/BUILD.gn b/BUILD.gn
index dc70380..c409ffd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -100,10 +100,6 @@
deps = [ "utils/dartdevc" ]
}
-group("dartfmt") {
- deps = [ "utils/dartfmt" ]
-}
-
group("analysis_server") {
deps = [ "utils/analysis_server" ]
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e467d97..db20c84 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -297,6 +297,12 @@
`dart compile exe` and `dart compile aot-snapshot` commands, which offer the
same functionality.
+- **Breaking Change**: The standalone `dartfmt` tool has been removed as
+ previously announced. Its replacement is the `dart format` command.
+
+ Note that `dart format` has [a different set of options and
+ defaults][dartfmt cli] than `dartfmt`.
+
#### Dart VM
- **Breaking Change** [#45451](https://github.com/dart-lang/sdk/issues/45451):
diff --git a/DEPS b/DEPS
index b426244..a567d7f 100644
--- a/DEPS
+++ b/DEPS
@@ -93,7 +93,7 @@
"csslib_rev": "6338de25a09d098a62c9a1992c175e9ceb5b994a",
# Note: Updates to dart_style have to be coordinated with the infrastructure
- # team so that the internal formatter in `tools/sdks/dart-sdk/bin/dartfmt`
+ # team so that the internal formatter `tools/sdks/dart-sdk/bin/dart format`
# matches the version here.
#
# Please follow this process to make updates:
@@ -106,7 +106,7 @@
# For more details, see https://github.com/dart-lang/sdk/issues/30164
"dart_style_rev": "14d9b6fd58cc4744676c12be3cc5eee2a779db82",
- "dartdoc_rev" : "e5ebb7a6e88427db25c21811dc91190475934b17",
+ "dartdoc_rev" : "c2f284f09bcc49025fe26e86b2d45e1b546f81a3",
"devtools_rev" : "2b47d9ed486479153ca2fd038000950674ed1beb",
"jsshell_tag": "version:88.0",
"ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
@@ -141,7 +141,6 @@
"protobuf_rev": "c1eb6cb51af39ccbaa1a8e19349546586a5c8e31",
"pub_rev": "37d05928939b3100e7e55c3dff922651db1de1e1",
"pub_semver_rev": "a43ad72fb6b7869607581b5fedcb186d1e74276a",
- "resource_rev": "6b79867d0becf5395e5819a75720963b8298e9a7",
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",
"rust_revision": "b7856f695d65a8ebc846754f97d15814bcb1c244",
"shelf_static_rev": "202ec1a53c9a830c17cf3b718d089cf7eba568ad",
@@ -404,8 +403,6 @@
Var("dart_git") + "pub_semver.git" + "@" + Var("pub_semver_rev"),
Var("dart_root") + "/third_party/pkg/pub":
Var("dart_git") + "pub.git" + "@" + Var("pub_rev"),
- Var("dart_root") + "/third_party/pkg/resource":
- Var("dart_git") + "resource.git" + "@" + Var("resource_rev"),
Var("dart_root") + "/third_party/pkg/shelf":
Var("dart_git") + "shelf.git" + "@" + Var("shelf_rev"),
Var("dart_root") + "/third_party/pkg/shelf_packages_handler":
diff --git a/README.dart-sdk b/README.dart-sdk
index 0123d05..90851d5 100644
--- a/README.dart-sdk
+++ b/README.dart-sdk
@@ -5,13 +5,12 @@
Here's a brief guide to what's in here:
bin/ Binaries/scripts to compile, run, and manage Dart applications.
- dart Dart virtual machine
+ dart Main Dart command-line executable
dart2js Dart-to-JavaScript compiler
dart2native Dart-to-native AOT compiler
dartanalyzer Dart static analyzer
dartdoc Dart documentation generator
pub Pub, the Dart package manager
- dartfmt Dart code formatter
lib/ Libraries that are shipped with the Dart runtime. More
information is available at api.dartlang.org.
diff --git a/pkg/_fe_analyzer_shared/lib/src/base/errors.dart b/pkg/_fe_analyzer_shared/lib/src/base/errors.dart
index 09be91b..d5ed3aa 100644
--- a/pkg/_fe_analyzer_shared/lib/src/base/errors.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/base/errors.dart
@@ -19,9 +19,9 @@
*/
final String uniqueName;
- final String _message;
+ final String _problemMessage;
- final String? _correction;
+ final String? _correctionMessage;
/**
* Return `true` if diagnostics with this code have documentation for them
@@ -36,30 +36,34 @@
/**
* Initialize a newly created error code to have the given [name]. The message
- * associated with the error will be created from the given [message]
+ * associated with the error will be created from the given [problemMessage]
* template. The correction associated with the error will be created from the
- * given [correction] template.
+ * given [correctionMessage] template.
*/
const ErrorCode({
- String? correction,
+ String? correctionMessage,
this.hasPublishedDocs = false,
this.isUnresolvedIdentifier: false,
- required String message,
required this.name,
+ @Deprecated('Please use problemMessage') String? message,
+ String? problemMessage,
required this.uniqueName,
- }) : _correction = correction,
- _message = message,
+ }) : _correctionMessage = correctionMessage,
+ _problemMessage = problemMessage ?? message ?? 'NO MESSAGE',
// ignore: unnecessary_null_comparison
assert(hasPublishedDocs != null),
// ignore: unnecessary_null_comparison
- assert(isUnresolvedIdentifier != null);
+ assert(isUnresolvedIdentifier != null),
+ assert((message == null) != (problemMessage == null),
+ 'Either problemMessage or message must be provided (not both)');
/**
* The template used to create the correction to be displayed for this error,
* or `null` if there is no correction information for this error. The
* correction should indicate how the user can fix the error.
*/
- String? get correction => customizedCorrections[uniqueName] ?? _correction;
+ String? get correctionMessage =>
+ customizedCorrections[uniqueName] ?? _correctionMessage;
/**
* The severity of the error.
@@ -71,10 +75,12 @@
bool get isIgnorable => errorSeverity != ErrorSeverity.ERROR;
/**
- * The template used to create the message to be displayed for this error. The
- * message should indicate what is wrong and why it is wrong.
+ * The template used to create the problem message to be displayed for this
+ * error. The problem message should indicate what is wrong and why it is
+ * wrong.
*/
- String get message => customizedMessages[uniqueName] ?? _message;
+ String get problemMessage =>
+ customizedMessages[uniqueName] ?? _problemMessage;
/**
* The type of the error.
diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/errors.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/errors.dart
index a5c83a9..61d909d 100644
--- a/pkg/_fe_analyzer_shared/lib/src/scanner/errors.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/scanner/errors.dart
@@ -155,7 +155,7 @@
'UNEXPECTED_DOLLAR_IN_STRING',
"A '\$' has special meaning inside a string, and must be followed by "
"an identifier or an expression in curly braces ({}).",
- correction: "Try adding a backslash (\\) to escape the '\$'.");
+ correctionMessage: "Try adding a backslash (\\) to escape the '\$'.");
/**
* Parameters:
@@ -167,7 +167,7 @@
static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT =
const ScannerErrorCode(
'UNTERMINATED_MULTI_LINE_COMMENT', "Unterminated multi-line comment.",
- correction: "Try terminating the comment with '*/', or "
+ correctionMessage: "Try terminating the comment with '*/', or "
"removing any unbalanced occurrences of '/*'"
" (because comments nest in Dart).");
@@ -177,14 +177,15 @@
/**
* Initialize a newly created error code to have the given [name]. The message
- * associated with the error will be created from the given [message]
+ * associated with the error will be created from the given [problemMessage]
* template. The correction associated with the error will be created from the
- * given [correction] template.
+ * given [correctionMessage] template.
*/
- const ScannerErrorCode(String name, String message, {String? correction})
+ const ScannerErrorCode(String name, String problemMessage,
+ {String? correctionMessage})
: super(
- correction: correction,
- message: message,
+ correctionMessage: correctionMessage,
+ problemMessage: problemMessage,
name: name,
uniqueName: 'ScannerErrorCode.$name',
);
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_error_code.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_error_code.dart
index 1f68a5c..1c992e0 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_error_code.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_error_code.dart
@@ -157,14 +157,14 @@
/// Initialize a newly created error code.
const TransformSetErrorCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'TransformSetErrorCode.$name',
);
diff --git a/pkg/analysis_server/test/protocol_server_test.dart b/pkg/analysis_server/test/protocol_server_test.dart
index 248d817..8f430c8 100644
--- a/pkg/analysis_server/test/protocol_server_test.dart
+++ b/pkg/analysis_server/test/protocol_server_test.dart
@@ -166,7 +166,8 @@
void test_fromEngine_lint() {
engineError = MockAnalysisError(
source: source,
- errorCode: LintCode('my_lint', 'my message', correction: 'correction'),
+ errorCode:
+ LintCode('my_lint', 'my message', correctionMessage: 'correction'),
offset: 10,
length: 20,
message: 'my message',
@@ -390,8 +391,8 @@
this.url});
@override
- String get correction {
- throw StateError('Unexpected invocation of correction');
+ String get correctionMessage {
+ throw StateError('Unexpected invocation of correctionMessage');
}
@override
@@ -404,8 +405,8 @@
bool get isUnresolvedIdentifier => false;
@override
- String get message {
- throw StateError('Unexpected invocation of message');
+ String get problemMessage {
+ throw StateError('Unexpected invocation of problemMessage');
}
@override
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index cbbb42b..628175a 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -968,7 +968,7 @@
/// The correction to be displayed for this error, or `null` if there is no
/// correction information for this error.
- String? _correction;
+ String? _correctionMessage;
/// The source in which the error occurred, or `null` if unknown.
final Source source;
@@ -982,22 +982,22 @@
[List<Object?>? arguments,
List<DiagnosticMessage> contextMessages = const []])
: _contextMessages = contextMessages {
- String message = formatList(errorCode.message, arguments);
- String? correctionTemplate = errorCode.correction;
+ String problemMessage = formatList(errorCode.problemMessage, arguments);
+ String? correctionTemplate = errorCode.correctionMessage;
if (correctionTemplate != null) {
- _correction = formatList(correctionTemplate, arguments);
+ _correctionMessage = formatList(correctionTemplate, arguments);
}
_problemMessage = DiagnosticMessageImpl(
filePath: source.fullName,
length: length,
- message: message,
+ message: problemMessage,
offset: offset,
url: null);
}
/// Initialize a newly created analysis error with given values.
AnalysisError.forValues(this.source, int offset, int length, this.errorCode,
- String message, this._correction,
+ String message, this._correctionMessage,
{List<DiagnosticMessage> contextMessages = const []})
: _contextMessages = contextMessages {
_problemMessage = DiagnosticMessageImpl(
@@ -1029,10 +1029,10 @@
/// Return the template used to create the correction to be displayed for this
/// error, or `null` if there is no correction information for this error. The
/// correction should indicate how the user can fix the error.
- String? get correction => _correction;
+ String? get correction => _correctionMessage;
@override
- String? get correctionMessage => _correction;
+ String? get correctionMessage => _correctionMessage;
@override
int get hashCode {
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 4c95c70..be84490 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
@@ -44,17 +44,17 @@
/// Initialize a newly created error code to have the given [name].
const AnalysisOptionsErrorCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'AnalysisOptionsErrorCode.${uniqueName ?? name}',
);
@@ -74,7 +74,7 @@
AnalysisOptionsHintCode(
'PREVIEW_DART_2_SETTING_DEPRECATED',
"The 'enablePreviewDart2' setting is deprecated.",
- correction: "It is no longer necessary to explicitly enable Dart 2.",
+ correctionMessage: "It is no longer necessary to explicitly enable Dart 2.",
);
/**
@@ -84,7 +84,8 @@
AnalysisOptionsHintCode(
'STRONG_MODE_SETTING_DEPRECATED',
"The 'strong-mode: true' setting is deprecated.",
- correction: "It is no longer necessary to explicitly enable strong mode.",
+ correctionMessage:
+ "It is no longer necessary to explicitly enable strong mode.",
);
/**
@@ -95,24 +96,24 @@
AnalysisOptionsHintCode(
'SUPER_MIXINS_SETTING_DEPRECATED',
"The 'enableSuperMixins' setting is deprecated.",
- correction:
+ correctionMessage:
"Support has been added to the language for 'mixin' based mixins.",
);
/// Initialize a newly created error code to have the given [name].
const AnalysisOptionsHintCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'AnalysisOptionsHintCode.${uniqueName ?? name}',
);
@@ -191,7 +192,7 @@
AnalysisOptionsWarningCode(
'SPEC_MODE_REMOVED',
"The option 'strong-mode: false' is no longer supported.",
- correction:
+ correctionMessage:
"It's recommended to remove the 'strong-mode:' setting (and make your code Dart 2 compliant).",
);
@@ -250,7 +251,7 @@
AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
"The option '{1}' isn't supported by '{0}'.",
- correction: "Try using one of the supported options: {2}.",
+ correctionMessage: "Try using one of the supported options: {2}.",
);
/**
@@ -266,23 +267,23 @@
AnalysisOptionsWarningCode(
'UNSUPPORTED_VALUE',
"The value '{1}' isn't supported by '{0}'.",
- correction: "Try using one of the supported options: {2}.",
+ correctionMessage: "Try using one of the supported options: {2}.",
);
/// Initialize a newly created error code to have the given [name].
const AnalysisOptionsWarningCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'AnalysisOptionsWarningCode.${uniqueName ?? name}',
);
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 474f80d..4e37aaf 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -80,7 +80,7 @@
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
class AnalysisDriver implements AnalysisDriverGeneric {
/// The version of data format, should be incremented on every format change.
- static const int DATA_VERSION = 182;
+ static const int DATA_VERSION = 183;
/// The number of exception contexts allowed to write. Once this field is
/// zero, we stop writing any new exception contexts in this process.
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 410a7ce..c0960a2 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -140,7 +140,6 @@
Set<FileState>? _directReferencedLibraries;
LibraryCycle? _libraryCycle;
- String? _transitiveSignature;
/// The flag that shows whether the file has an error or warning that
/// might be fixed by a change to another file.
@@ -320,10 +319,12 @@
/// Return the signature of the file, based on API signatures of the
/// transitive closure of imported / exported files.
+ /// TODO(scheglov) Remove it.
String get transitiveSignature {
- libraryCycle; // sets _transitiveSignature
- _transitiveSignature ??= _invalidTransitiveSignature;
- return _transitiveSignature!;
+ var librarySignatureBuilder = ApiSignature()
+ ..addString(uriStr)
+ ..addString(libraryCycle.transitiveSignature);
+ return librarySignatureBuilder.toHex();
}
/// The [UnlinkedUnit2] of the file.
@@ -335,13 +336,6 @@
/// Return the [uri] string.
String get uriStr => uri.toString();
- String get _invalidTransitiveSignature {
- return (ApiSignature()
- ..addString(path)
- ..addBytes(unlinkedSignature))
- .toHex();
- }
-
@override
bool operator ==(Object other) {
return other is FileState && other.uri == uri;
@@ -357,14 +351,8 @@
return bytes;
}
- void internal_setLibraryCycle(LibraryCycle? cycle, String? signature) {
- if (cycle == null) {
- _libraryCycle = null;
- _transitiveSignature = null;
- } else {
- _libraryCycle = cycle;
- _transitiveSignature = signature;
- }
+ void internal_setLibraryCycle(LibraryCycle? cycle) {
+ _libraryCycle = cycle;
}
/// Return a new parsed unresolved [CompilationUnit].
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_context.dart b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
index 461b256..dbc60bd 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
@@ -121,7 +121,7 @@
}
}
- var resolutionKey = cycle.transitiveSignature! + '.linked_bundle';
+ var resolutionKey = cycle.transitiveSignature + '.linked_bundle';
var resolutionBytes = byteStore.get(resolutionKey) as Uint8List?;
if (resolutionBytes == null) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_graph.dart b/pkg/analyzer/lib/src/dart/analysis/library_graph.dart
index 2d5b660..ff481c5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_graph.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_graph.dart
@@ -20,10 +20,10 @@
/// Information about libraries that reference each other, so form a cycle.
class LibraryCycle {
/// The libraries that belong to this cycle.
- final List<FileState> libraries = [];
+ final List<FileState> libraries;
/// The library cycles that this cycle references directly.
- final Set<LibraryCycle> directDependencies = <LibraryCycle>{};
+ final Set<LibraryCycle> directDependencies;
/// The cycles that use this cycle, used to [invalidate] transitively.
final List<LibraryCycle> _directUsers = [];
@@ -34,7 +34,17 @@
/// transitive signatures of the cycles that the [libraries] reference
/// directly. So, indirectly it is based on the transitive closure of all
/// files that [libraries] reference (but we don't compute these files).
- String? transitiveSignature;
+ String transitiveSignature;
+
+ LibraryCycle({
+ required this.libraries,
+ required this.directDependencies,
+ required this.transitiveSignature,
+ }) {
+ for (var directDependency in directDependencies) {
+ directDependency._directUsers.add(this);
+ }
+ }
/// Invalidate this cycle and any cycles that directly or indirectly use it.
///
@@ -42,12 +52,14 @@
/// [libraries] that share this [LibraryCycle] instance.
void invalidate() {
for (var library in libraries) {
- library.internal_setLibraryCycle(null, null);
+ library.internal_setLibraryCycle(null);
}
- for (var user in _directUsers) {
+ for (var user in _directUsers.toList()) {
user.invalidate();
}
- _directUsers.clear();
+ for (var directDependency in directDependencies) {
+ directDependency._directUsers.remove(this);
+ }
}
@override
@@ -87,8 +99,6 @@
@override
void evaluateScc(List<_LibraryNode> scc) {
- var cycle = LibraryCycle();
-
var signature = ApiSignature();
signature.addUint32List(_salt);
@@ -100,17 +110,20 @@
});
// Append direct referenced cycles.
+ var directDependencies = <LibraryCycle>{};
for (var node in scc) {
var file = node.file;
_appendDirectlyReferenced(
- cycle, signature, file.importedFiles.whereNotNull().toList());
- _appendDirectlyReferenced(
- cycle, signature, file.exportedFiles.whereNotNull().toList());
+ directDependencies,
+ signature,
+ file.directReferencedLibraries.whereNotNull().toList(),
+ );
}
// Fill the cycle with libraries.
+ var libraries = <FileState>[];
for (var node in scc) {
- cycle.libraries.add(node.file);
+ libraries.add(node.file);
signature.addLanguageVersion(node.file.packageLanguageVersion);
signature.addString(node.file.uriStr);
@@ -122,20 +135,16 @@
}
}
- // Compute the general library cycle signature.
- cycle.transitiveSignature = signature.toHex();
+ // Create the LibraryCycle instance for the cycle.
+ var cycle = LibraryCycle(
+ libraries: libraries,
+ directDependencies: directDependencies,
+ transitiveSignature: signature.toHex(),
+ );
- // Compute library specific signatures.
+ // Set the instance into the libraries.
for (var node in scc) {
- var librarySignatureBuilder = ApiSignature()
- ..addString(node.file.uriStr)
- ..addString(cycle.transitiveSignature!);
- var librarySignature = librarySignatureBuilder.toHex();
-
- node.file.internal_setLibraryCycle(
- cycle,
- librarySignature,
- );
+ node.file.internal_setLibraryCycle(cycle);
}
}
@@ -144,7 +153,7 @@
}
void _appendDirectlyReferenced(
- LibraryCycle cycle,
+ Set<LibraryCycle> directDependencies,
ApiSignature signature,
List<FileState> directlyReferenced,
) {
@@ -155,9 +164,8 @@
// We get null when the library is a part of the cycle being build.
if (referencedCycle == null) continue;
- if (cycle.directDependencies.add(referencedCycle)) {
- referencedCycle._directUsers.add(cycle);
- signature.addString(referencedCycle.transitiveSignature!);
+ if (directDependencies.add(referencedCycle)) {
+ signature.addString(referencedCycle.transitiveSignature);
}
}
}
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 8edc5cf..b8f9aef 100644
--- a/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/ffi_code.g.dart
@@ -21,7 +21,7 @@
static const FfiCode ANNOTATION_ON_POINTER_FIELD = FfiCode(
'ANNOTATION_ON_POINTER_FIELD',
"Fields in a struct class whose type is 'Pointer' should not have any annotations.",
- correction: "Try removing the annotation.",
+ correctionMessage: "Try removing the annotation.",
);
/**
@@ -31,7 +31,7 @@
static const FfiCode ARGUMENT_MUST_BE_A_CONSTANT = FfiCode(
'ARGUMENT_MUST_BE_A_CONSTANT',
"Argument '{0}' must be a constant.",
- correction: "Try replacing the value with a literal or const.",
+ correctionMessage: "Try replacing the value with a literal or const.",
);
/**
@@ -40,7 +40,8 @@
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 be instantiated by a generative constructor.",
- correction: "Try allocating it via allocation, or load from a 'Pointer'.",
+ correctionMessage:
+ "Try allocating it via allocation, or load from a 'Pointer'.",
);
/**
@@ -50,7 +51,7 @@
static const FfiCode EMPTY_STRUCT = FfiCode(
'EMPTY_STRUCT',
"Struct '{0}' is empty. Empty structs are undefined behavior.",
- correction: "Try adding a field to '{0}' or use a different Struct.",
+ correctionMessage: "Try adding a field to '{0}' or use a different Struct.",
);
/**
@@ -59,7 +60,7 @@
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 native type.",
- correction: "Try removing the extra annotation.",
+ correctionMessage: "Try removing the extra annotation.",
);
/**
@@ -68,7 +69,7 @@
static const FfiCode EXTRA_SIZE_ANNOTATION_CARRAY = FfiCode(
'EXTRA_SIZE_ANNOTATION_CARRAY',
"'Array's must have exactly one 'Array' annotation.",
- correction: "Try removing the extra annotation.",
+ correctionMessage: "Try removing the extra annotation.",
);
/**
@@ -77,7 +78,7 @@
static const FfiCode FFI_NATIVE_ONLY_STATIC = FfiCode(
'FFI_NATIVE_ONLY_STATIC',
"FfiNative annotations can only be used on static functions.",
- correction: "Change the method to static.",
+ correctionMessage: "Change the method to static.",
);
/**
@@ -86,7 +87,7 @@
static const FfiCode FIELD_INITIALIZER_IN_STRUCT = FfiCode(
'FIELD_INITIALIZER_IN_STRUCT',
"Constructors in subclasses of 'Struct' and 'Union' can't have field initializers.",
- correction:
+ correctionMessage:
"Try removing the field initializer and marking the field as external.",
);
@@ -96,7 +97,7 @@
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.",
- correction:
+ correctionMessage:
"Try removing the initializer and marking the field as external.",
);
@@ -106,7 +107,7 @@
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.",
- correction: "Try adding the 'external' modifier.",
+ correctionMessage: "Try adding the 'external' modifier.",
);
/**
@@ -116,7 +117,7 @@
static const FfiCode GENERIC_STRUCT_SUBCLASS = FfiCode(
'GENERIC_STRUCT_SUBCLASS',
"The class '{0}' can't extend 'Struct' or 'Union' because it is generic.",
- correction: "Try removing the type parameters from '{0}'.",
+ correctionMessage: "Try removing the type parameters from '{0}'.",
);
/**
@@ -125,7 +126,7 @@
static const FfiCode INVALID_EXCEPTION_VALUE = FfiCode(
'INVALID_EXCEPTION_VALUE',
"The method 'Pointer.fromFunction' must not have an exceptional return value (the second argument) when the return type of the function is either 'void', 'Handle' or 'Pointer'.",
- correction: "Try removing the exceptional return value.",
+ correctionMessage: "Try removing the exceptional return value.",
);
/**
@@ -135,7 +136,7 @@
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 declared as 'int', 'double', 'Array', 'Pointer', or subtype of 'Struct' or 'Union'.",
- correction:
+ correctionMessage:
"Try using 'int', 'double', 'Array', 'Pointer', or subtype of 'Struct' or 'Union'.",
);
@@ -145,7 +146,7 @@
static const FfiCode LEAF_CALL_MUST_NOT_RETURN_HANDLE = FfiCode(
'LEAF_CALL_MUST_NOT_RETURN_HANDLE',
"FFI leaf call must not return a Handle.",
- correction: "Try changing the return type to primitive or struct.",
+ correctionMessage: "Try changing the return type to primitive or struct.",
);
/**
@@ -154,7 +155,7 @@
static const FfiCode LEAF_CALL_MUST_NOT_TAKE_HANDLE = FfiCode(
'LEAF_CALL_MUST_NOT_TAKE_HANDLE',
"FFI leaf call must not take arguments of type Handle.",
- correction: "Try changing the argument type to primitive or struct.",
+ correctionMessage: "Try changing the argument type to primitive or struct.",
);
/**
@@ -163,7 +164,7 @@
static const FfiCode MISMATCHED_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
'MISMATCHED_ANNOTATION_ON_STRUCT_FIELD',
"The annotation does not match the declared type of the field.",
- correction:
+ correctionMessage:
"Try using a different annotation or changing the declared type to match.",
);
@@ -173,7 +174,7 @@
static const FfiCode MISSING_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
'MISSING_ANNOTATION_ON_STRUCT_FIELD',
"Fields in a struct class must either have the type 'Pointer' or an annotation indicating the native type.",
- correction: "Try adding an annotation.",
+ correctionMessage: "Try adding an annotation.",
);
/**
@@ -182,7 +183,7 @@
static const FfiCode MISSING_EXCEPTION_VALUE = FfiCode(
'MISSING_EXCEPTION_VALUE',
"The method 'Pointer.fromFunction' must have an exceptional return value (the second argument) when the return type of the function is neither 'void', 'Handle' or 'Pointer'.",
- correction: "Try adding an exceptional return value.",
+ correctionMessage: "Try adding an exceptional return value.",
);
/**
@@ -192,7 +193,7 @@
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', 'double' or 'Pointer'.",
- correction: "Try using 'int', 'double' or 'Pointer'.",
+ correctionMessage: "Try using 'int', 'double' or 'Pointer'.",
);
/**
@@ -201,7 +202,7 @@
static const FfiCode MISSING_SIZE_ANNOTATION_CARRAY = FfiCode(
'MISSING_SIZE_ANNOTATION_CARRAY',
"'Array's must have exactly one 'Array' annotation.",
- correction: "Try adding a 'Array' annotation.",
+ correctionMessage: "Try adding a 'Array' annotation.",
);
/**
@@ -212,7 +213,8 @@
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 type.",
- correction: "Try changing the type to only use members for 'dart:ffi'.",
+ correctionMessage:
+ "Try changing the type to only use members for 'dart:ffi'.",
);
/**
@@ -224,7 +226,7 @@
static const FfiCode MUST_BE_A_SUBTYPE = FfiCode(
'MUST_BE_A_SUBTYPE',
"The type '{0}' must be a subtype of '{1}' for '{2}'.",
- correction: "Try changing one or both of the type arguments.",
+ correctionMessage: "Try changing one or both of the type arguments.",
);
/**
@@ -234,7 +236,7 @@
static const FfiCode NON_CONSTANT_TYPE_ARGUMENT = FfiCode(
'NON_CONSTANT_TYPE_ARGUMENT',
"The type arguments to '{0}' must be compile time constants but type parameters are not constants.",
- correction: "Try changing the type argument to be a constant type.",
+ correctionMessage: "Try changing the type argument to be a constant type.",
);
/**
@@ -244,7 +246,8 @@
static const FfiCode NON_NATIVE_FUNCTION_TYPE_ARGUMENT_TO_POINTER = FfiCode(
'NON_NATIVE_FUNCTION_TYPE_ARGUMENT_TO_POINTER',
"The type argument for the pointer '{0}' must be a 'NativeFunction' in order to use 'asFunction'.",
- correction: "Try changing the type argument to be a 'NativeFunction'.",
+ correctionMessage:
+ "Try changing the type argument to be a 'NativeFunction'.",
);
/**
@@ -253,7 +256,7 @@
static const FfiCode NON_POSITIVE_ARRAY_DIMENSION = FfiCode(
'NON_POSITIVE_ARRAY_DIMENSION',
"Array dimensions must be positive numbers.",
- correction: "Try changing the input to a positive number.",
+ correctionMessage: "Try changing the input to a positive number.",
);
/**
@@ -263,7 +266,7 @@
static const FfiCode NON_SIZED_TYPE_ARGUMENT = FfiCode(
'NON_SIZED_TYPE_ARGUMENT',
"Type arguments to '{0}' can't have the type '{1}'. They can only be declared as native integer, 'Float', 'Double', 'Pointer', or subtype of 'Struct' or 'Union'.",
- correction:
+ correctionMessage:
"Try using a native integer, 'Float', 'Double', 'Pointer', or subtype of 'Struct' or 'Union'.",
);
@@ -273,7 +276,7 @@
static const FfiCode PACKED_ANNOTATION = FfiCode(
'PACKED_ANNOTATION',
"Structs must have at most one 'Packed' annotation.",
- correction: "Try removing extra 'Packed' annotations.",
+ correctionMessage: "Try removing extra 'Packed' annotations.",
);
/**
@@ -282,7 +285,7 @@
static const FfiCode PACKED_ANNOTATION_ALIGNMENT = FfiCode(
'PACKED_ANNOTATION_ALIGNMENT',
"Only packing to 1, 2, 4, 8, and 16 bytes is supported.",
- correction:
+ correctionMessage:
"Try changing the 'Packed' annotation alignment to 1, 2, 4, 8, or 16.",
);
@@ -294,7 +297,7 @@
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 struct '{1}' is not supported.",
- correction:
+ correctionMessage:
"Try packing the nested struct or packing the nested struct more tightly.",
);
@@ -304,7 +307,7 @@
static const FfiCode SIZE_ANNOTATION_DIMENSIONS = FfiCode(
'SIZE_ANNOTATION_DIMENSIONS',
"'Array's must have an 'Array' annotation that matches the dimensions.",
- correction: "Try adjusting the arguments in the 'Array' annotation.",
+ correctionMessage: "Try adjusting the arguments in the 'Array' annotation.",
);
/**
@@ -315,7 +318,7 @@
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_EXTENDS = FfiCode(
'SUBTYPE_OF_FFI_CLASS',
"The class '{0}' can't extend '{1}'.",
- correction: "Try extending 'Struct' or 'Union'.",
+ correctionMessage: "Try extending 'Struct' or 'Union'.",
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_EXTENDS',
);
@@ -327,7 +330,7 @@
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS = FfiCode(
'SUBTYPE_OF_FFI_CLASS',
"The class '{0}' can't implement '{1}'.",
- correction: "Try extending 'Struct' or 'Union'.",
+ correctionMessage: "Try extending 'Struct' or 'Union'.",
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS',
);
@@ -339,7 +342,7 @@
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_WITH = FfiCode(
'SUBTYPE_OF_FFI_CLASS',
"The class '{0}' can't mix in '{1}'.",
- correction: "Try extending 'Struct' or 'Union'.",
+ correctionMessage: "Try extending 'Struct' or 'Union'.",
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_WITH',
);
@@ -351,7 +354,7 @@
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 'Struct' or 'Union'.",
- correction: "Try extending 'Struct' or 'Union' directly.",
+ correctionMessage: "Try extending 'Struct' or 'Union' directly.",
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS',
);
@@ -363,7 +366,7 @@
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 'Struct' or 'Union'.",
- correction: "Try extending 'Struct' or 'Union' directly.",
+ correctionMessage: "Try extending 'Struct' or 'Union' directly.",
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS',
);
@@ -375,24 +378,24 @@
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 'Struct' or 'Union'.",
- correction: "Try extending 'Struct' or 'Union' directly.",
+ correctionMessage: "Try extending 'Struct' or 'Union' directly.",
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_WITH',
);
/// Initialize a newly created error code to have the given [name].
const FfiCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'FfiCode.${uniqueName ?? name}',
);
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 f1f850a..a235cbb 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
@@ -85,7 +85,7 @@
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 top-level variable.",
- correction: "Try removing the assignment.",
+ correctionMessage: "Try removing the assignment.",
);
/**
@@ -95,7 +95,7 @@
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.",
- correction: "Replace the '.' with a '?.' in the invocation.",
+ correctionMessage: "Replace the '.' with a '?.' in the invocation.",
);
/**
@@ -154,7 +154,7 @@
static const HintCode DEAD_CODE = HintCode(
'DEAD_CODE',
"Dead code.",
- correction:
+ correctionMessage:
"Try removing the code, or fixing the code before it so that it can be reached.",
hasPublishedDocs: true,
);
@@ -212,7 +212,7 @@
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)' are never reached.",
- correction:
+ correctionMessage:
"Try reordering the catch clauses so that they can be reached, or removing the unreachable catch clauses.",
hasPublishedDocs: true,
);
@@ -274,7 +274,7 @@
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 subtype of '{1}' and hence will have been caught already.",
- correction:
+ correctionMessage:
"Try reordering the catch clauses so that this block can be reached, or removing the unreachable catch clause.",
hasPublishedDocs: true,
);
@@ -309,7 +309,7 @@
static const HintCode DEPRECATED_EXTENDS_FUNCTION = HintCode(
'DEPRECATED_SUBTYPE_OF_FUNCTION',
"Extending 'Function' is deprecated.",
- correction: "Try removing 'Function' from the 'extends' clause.",
+ correctionMessage: "Try removing 'Function' from the 'extends' clause.",
hasPublishedDocs: true,
uniqueName: 'DEPRECATED_EXTENDS_FUNCTION',
);
@@ -320,7 +320,7 @@
static const HintCode DEPRECATED_FUNCTION_CLASS_DECLARATION = HintCode(
'DEPRECATED_FUNCTION_CLASS_DECLARATION',
"Declaring a class named 'Function' is deprecated.",
- correction: "Try renaming the class.",
+ correctionMessage: "Try renaming the class.",
);
/**
@@ -329,7 +329,7 @@
static const HintCode DEPRECATED_IMPLEMENTS_FUNCTION = HintCode(
'DEPRECATED_SUBTYPE_OF_FUNCTION',
"Implementing 'Function' has no effect.",
- correction: "Try removing 'Function' from the 'implements' clause.",
+ correctionMessage: "Try removing 'Function' from the 'implements' clause.",
hasPublishedDocs: true,
uniqueName: 'DEPRECATED_IMPLEMENTS_FUNCTION',
);
@@ -361,7 +361,7 @@
static const HintCode DEPRECATED_MEMBER_USE = HintCode(
'DEPRECATED_MEMBER_USE',
"'{0}' is deprecated and shouldn't be used.",
- correction:
+ correctionMessage:
"Try replacing the use of the deprecated member with the replacement.",
hasPublishedDocs: true,
);
@@ -393,7 +393,7 @@
static const HintCode DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE = HintCode(
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',
"'{0}' is deprecated and shouldn't be used.",
- correction:
+ correctionMessage:
"Try replacing the use of the deprecated member with the replacement.",
hasPublishedDocs: true,
);
@@ -407,7 +407,7 @@
HintCode(
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',
"'{0}' is deprecated and shouldn't be used. {1}.",
- correction:
+ correctionMessage:
"Try replacing the use of the deprecated member with the replacement.",
hasPublishedDocs: true,
uniqueName: 'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE',
@@ -421,7 +421,7 @@
static const HintCode DEPRECATED_MEMBER_USE_WITH_MESSAGE = HintCode(
'DEPRECATED_MEMBER_USE',
"'{0}' is deprecated and shouldn't be used. {1}.",
- correction:
+ correctionMessage:
"Try replacing the use of the deprecated member with the replacement.",
hasPublishedDocs: true,
uniqueName: 'DEPRECATED_MEMBER_USE_WITH_MESSAGE',
@@ -433,7 +433,7 @@
static const HintCode DEPRECATED_MIXIN_FUNCTION = HintCode(
'DEPRECATED_SUBTYPE_OF_FUNCTION',
"Mixing in 'Function' is deprecated.",
- correction: "Try removing 'Function' from the 'with' clause.",
+ correctionMessage: "Try removing 'Function' from the 'with' clause.",
hasPublishedDocs: true,
uniqueName: 'DEPRECATED_MIXIN_FUNCTION',
);
@@ -444,7 +444,8 @@
static const HintCode DIVISION_OPTIMIZATION = HintCode(
'DIVISION_OPTIMIZATION',
"The operator x ~/ y is more efficient than (x / y).toInt().",
- correction: "Try re-writing the expression to use the '~/' operator.",
+ correctionMessage:
+ "Try re-writing the expression to use the '~/' operator.",
);
/**
@@ -488,7 +489,7 @@
static const HintCode DUPLICATE_HIDDEN_NAME = HintCode(
'DUPLICATE_HIDDEN_NAME',
"Duplicate hidden name.",
- correction:
+ correctionMessage:
"Try removing the repeated name from the list of hidden members.",
hasPublishedDocs: true,
);
@@ -542,7 +543,7 @@
static const HintCode DUPLICATE_IGNORE = HintCode(
'DUPLICATE_IGNORE',
"The diagnostic '{0}' doesn't need to be ignored here because it's already being ignored.",
- correction:
+ correctionMessage:
"Try removing the name from the list, or removing the whole comment if this is the only name in the list.",
hasPublishedDocs: true,
);
@@ -581,7 +582,7 @@
static const HintCode DUPLICATE_IMPORT = HintCode(
'DUPLICATE_IMPORT',
"Duplicate import.",
- correction: "Try removing all but one import of the library.",
+ correctionMessage: "Try removing all but one import of the library.",
hasPublishedDocs: true,
);
@@ -626,7 +627,7 @@
static const HintCode DUPLICATE_SHOWN_NAME = HintCode(
'DUPLICATE_SHOWN_NAME',
"Duplicate shown name.",
- correction:
+ correctionMessage:
"Try removing the repeated name from the list of shown members.",
hasPublishedDocs: true,
);
@@ -677,7 +678,7 @@
static const HintCode EQUAL_ELEMENTS_IN_SET = HintCode(
'EQUAL_ELEMENTS_IN_SET',
"Two elements in a set literal shouldn't be equal.",
- correction: "Change or remove the duplicate element.",
+ correctionMessage: "Change or remove the duplicate element.",
hasPublishedDocs: true,
);
@@ -726,7 +727,7 @@
static const HintCode EQUAL_KEYS_IN_MAP = HintCode(
'EQUAL_KEYS_IN_MAP',
"Two keys in a map literal shouldn't be equal.",
- correction: "Change or remove the duplicate key.",
+ correctionMessage: "Change or remove the duplicate key.",
hasPublishedDocs: true,
);
@@ -741,7 +742,7 @@
HintCode(
'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
"A file in the 'lib' directory shouldn't import a file outside the 'lib' directory.",
- correction:
+ correctionMessage:
"Try removing the import, or moving the imported file inside the 'lib' directory.",
);
@@ -756,7 +757,7 @@
HintCode(
'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE',
"A file outside the 'lib' directory shouldn't reference a file inside the 'lib' directory using a relative path.",
- correction: "Try using a package: URI instead.",
+ correctionMessage: "Try using a package: URI instead.",
);
/**
@@ -835,7 +836,7 @@
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' that is hidden by deferring this library.",
- correction:
+ correctionMessage:
"Try changing the import to not be deferred, or rename the function in the imported library.",
hasPublishedDocs: true,
);
@@ -846,7 +847,7 @@
static const HintCode IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE = HintCode(
'IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE',
"The library '{0}' is legacy, and should not be imported into a null safe library.",
- correction: "Try migrating the imported library.",
+ correctionMessage: "Try migrating the imported library.",
);
/**
@@ -856,7 +857,7 @@
static const HintCode INFERENCE_FAILURE_ON_COLLECTION_LITERAL = HintCode(
'INFERENCE_FAILURE_ON_COLLECTION_LITERAL',
"The type argument(s) of '{0}' can't be inferred.",
- correction: "Use explicit type argument(s) for '{0}'.",
+ correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
/**
@@ -866,7 +867,7 @@
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.",
- correction: "Use explicit type argument(s) for '{0}'.",
+ correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
/**
@@ -879,7 +880,7 @@
static const HintCode INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE = HintCode(
'INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE',
"The return type of '{0}' cannot be inferred.",
- correction: "Declare the return type of '{0}'.",
+ correctionMessage: "Declare the return type of '{0}'.",
);
/**
@@ -889,7 +890,7 @@
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 inferred.",
- correction: "Use explicit type argument(s) for '{0}'.",
+ correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
/**
@@ -900,7 +901,7 @@
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.",
- correction: "Use explicit type argument(s) for '{0}'.",
+ correctionMessage: "Use explicit type argument(s) for '{0}'.",
);
/**
@@ -910,7 +911,7 @@
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.",
- correction: "Try specifying the type of the variable.",
+ correctionMessage: "Try specifying the type of the variable.",
);
/**
@@ -920,7 +921,7 @@
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.",
- correction: "Try specifying the type of the parameter.",
+ correctionMessage: "Try specifying the type of the parameter.",
);
/**
@@ -943,7 +944,7 @@
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.",
- correction: "Try using a hide clause to hide '{0}'.",
+ correctionMessage: "Try using a hide clause to hide '{0}'.",
);
/**
@@ -957,7 +958,7 @@
HintCode(
'INVALID_EXPORT_OF_INTERNAL_ELEMENT_INDIRECTLY',
"The member '{0}' can't be exported as a part of a package's public API, but is indirectly exported as part of the signature of '{1}'.",
- correction: "Try using a hide clause to hide '{0}'.",
+ correctionMessage: "Try using a hide clause to hide '{0}'.",
);
/**
@@ -1024,7 +1025,7 @@
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override number must begin with '@dart'",
- correction:
+ correctionMessage:
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN',
);
@@ -1044,7 +1045,7 @@
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override comment must be specified with an '=' character",
- correction:
+ correctionMessage:
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS',
);
@@ -1052,14 +1053,14 @@
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_GREATER = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The language version override can't specify a version greater than the latest known language version: {0}.{1}",
- correction: "Try removing the language version override.",
+ correctionMessage: "Try removing the language version override.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_GREATER',
);
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_LOCATION = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The language version override must be before any declaration or directive.",
- correction:
+ correctionMessage:
"Try moving the language version override to the top of the file.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_LOCATION',
);
@@ -1079,7 +1080,7 @@
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 word 'dart' in all lower case",
- correction:
+ correctionMessage:
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_LOWER_CASE',
);
@@ -1099,7 +1100,7 @@
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER = HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override comment must be specified with a version number, like '2.0', after the '=' character.",
- correction:
+ correctionMessage:
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER',
);
@@ -1119,7 +1120,7 @@
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 letter",
- correction:
+ correctionMessage:
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX',
);
@@ -1140,7 +1141,7 @@
HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override comment can't be followed by any non-whitespace characters",
- correction:
+ correctionMessage:
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TRAILING_CHARACTERS',
);
@@ -1161,7 +1162,7 @@
HintCode(
'INVALID_LANGUAGE_VERSION_OVERRIDE',
"The Dart language version override comment must be specified with exactly two slashes.",
- correction:
+ correctionMessage:
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TWO_SLASHES',
);
@@ -1237,7 +1238,7 @@
static const HintCode INVALID_NON_VIRTUAL_ANNOTATION = HintCode(
'INVALID_NON_VIRTUAL_ANNOTATION',
"The member '{0}' can't be '@nonVirtual' because it isn't a concrete instance member.",
- correction: "Try removing @nonVirtual.",
+ correctionMessage: "Try removing @nonVirtual.",
);
/**
@@ -1263,7 +1264,7 @@
static const HintCode INVALID_REQUIRED_NAMED_PARAM = HintCode(
'INVALID_REQUIRED_NAMED_PARAM',
"The type parameter '{0}' is annotated with @required but only named parameters without a default value can be annotated with it.",
- correction: "Remove @required.",
+ correctionMessage: "Remove @required.",
);
/**
@@ -1276,7 +1277,7 @@
static const HintCode INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM = HintCode(
'INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM',
"Incorrect use of the annotation @required on the optional positional parameter '{0}'. Optional positional parameters cannot be required.",
- correction: "Remove @required.",
+ correctionMessage: "Remove @required.",
);
/**
@@ -1289,7 +1290,7 @@
static const HintCode INVALID_REQUIRED_POSITIONAL_PARAM = HintCode(
'INVALID_REQUIRED_POSITIONAL_PARAM',
"Redundant use of the annotation @required on the required positional parameter '{0}'.",
- correction: "Remove @required.",
+ correctionMessage: "Remove @required.",
);
/**
@@ -1302,7 +1303,7 @@
static const HintCode INVALID_SEALED_ANNOTATION = HintCode(
'INVALID_SEALED_ANNOTATION',
"The member '{0}' is annotated with '@sealed' but only classes can be annotated with it.",
- correction: "Remove @sealed.",
+ correctionMessage: "Remove @sealed.",
);
/**
@@ -1496,7 +1497,7 @@
static const HintCode MISSING_JS_LIB_ANNOTATION = HintCode(
'MISSING_JS_LIB_ANNOTATION',
"The @JS() annotation can only be used if it is also declared on the library directive.",
- correction: "Try adding the annotation to the library directive.",
+ correctionMessage: "Try adding the annotation to the library directive.",
);
/**
@@ -1594,7 +1595,7 @@
static const HintCode MISSING_RETURN = HintCode(
'MISSING_RETURN',
"This function has a return type of '{0}', but doesn't end with a return statement.",
- correction:
+ correctionMessage:
"Try adding a return statement, or changing the return type to 'void'.",
hasPublishedDocs: true,
);
@@ -1642,7 +1643,7 @@
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 sealed, and any class mixing in this mixin must have '{0}' as a superclass.",
- correction:
+ correctionMessage:
"Try composing with this class, or refer to its documentation for more information.",
hasPublishedDocs: true,
);
@@ -1808,7 +1809,7 @@
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 marked as '@literal'.",
- correction: "Try adding a 'const' keyword.",
+ correctionMessage: "Try adding a 'const' keyword.",
hasPublishedDocs: true,
);
@@ -1823,7 +1824,7 @@
HintCode(
'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR',
"This instance creation must be 'const', because the {0} constructor is marked as '@literal'.",
- correction: "Try replacing the 'new' keyword with 'const'.",
+ correctionMessage: "Try replacing the 'new' keyword with 'const'.",
hasPublishedDocs: true,
uniqueName: 'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW',
);
@@ -1867,7 +1868,7 @@
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 isn't valid to throw a nullable expression.",
- correction: "Try using a non-nullable type.",
+ correctionMessage: "Try using a non-nullable type.",
hasPublishedDocs: true,
);
@@ -1908,7 +1909,7 @@
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 argument '{1}'.",
- correction: "Try adding a non-null argument.",
+ correctionMessage: "Try adding a non-null argument.",
);
/**
@@ -1927,7 +1928,7 @@
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 a condition.",
- correction:
+ correctionMessage:
"Try replacing the '?.' with a '.', testing the left-hand side for null if necessary.",
);
@@ -1957,7 +1958,7 @@
static const HintCode OVERRIDE_ON_NON_OVERRIDING_FIELD = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The field doesn't override an inherited getter or setter.",
- correction:
+ correctionMessage:
"Try updating this class to match the superclass, or removing the override annotation.",
hasPublishedDocs: true,
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_FIELD',
@@ -1971,7 +1972,7 @@
static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The getter doesn't override an inherited getter.",
- correction:
+ correctionMessage:
"Try updating this class to match the superclass, or removing the override annotation.",
hasPublishedDocs: true,
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_GETTER',
@@ -2019,7 +2020,7 @@
static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The method doesn't override an inherited method.",
- correction:
+ correctionMessage:
"Try updating this class to match the superclass, or removing the override annotation.",
hasPublishedDocs: true,
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_METHOD',
@@ -2033,7 +2034,7 @@
static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = HintCode(
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
"The setter doesn't override an inherited setter.",
- correction:
+ correctionMessage:
"Try updating this class to match the superclass, or removing the override annotation.",
hasPublishedDocs: true,
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_SETTER',
@@ -2067,7 +2068,7 @@
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.",
- correction:
+ correctionMessage:
"Try checking for throw expressions or type errors in the receiver",
);
@@ -2078,7 +2079,7 @@
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 '{1}' is also annotated.",
- correction: "Annotate '{1}' with 'doNotStore'.",
+ correctionMessage: "Annotate '{1}' with 'doNotStore'.",
);
/**
@@ -2204,7 +2205,7 @@
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 this code is required to be able to run on earlier versions.",
- correction:
+ correctionMessage:
"Try either importing 'dart:async' or updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2260,7 +2261,7 @@
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 until version 2.3.2, but this code is required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2318,7 +2319,7 @@
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 wasn't supported until version 2.3.2, but this code is required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2376,7 +2377,7 @@
static const HintCode SDK_VERSION_CONSTRUCTOR_TEAROFFS = HintCode(
'SDK_VERSION_CONSTRUCTOR_TEAROFFS',
"Tearing off a constructor requires the 'constructor-tearoffs' language feature.",
- correction:
+ correctionMessage:
"Try updating your pubspec.yaml to set the minimum SDK constraint to 2.15 or higher, and running 'pub get'.",
);
@@ -2437,7 +2438,7 @@
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 version 2.3.2, but this code is required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2497,7 +2498,7 @@
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 required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2556,7 +2557,7 @@
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 is required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
);
/**
@@ -2611,7 +2612,7 @@
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 version 2.3.2, but this code is required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2663,7 +2664,7 @@
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 required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2714,7 +2715,7 @@
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 required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2774,7 +2775,7 @@
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, but this code is required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2836,7 +2837,7 @@
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 until version 2.5.0, but this code is required to be able to run on earlier versions.",
- correction: "Try updating the SDK constraints.",
+ correctionMessage: "Try updating the SDK constraints.",
hasPublishedDocs: true,
);
@@ -2849,7 +2850,7 @@
static const HintCode STRICT_RAW_TYPE = HintCode(
'STRICT_RAW_TYPE',
"The generic type '{0}' should have explicit type arguments but doesn't.",
- correction: "Use explicit type arguments for '{0}'.",
+ correctionMessage: "Use explicit type arguments for '{0}'.",
);
/**
@@ -2905,7 +2906,7 @@
static const HintCode SUBTYPE_OF_SEALED_CLASS = HintCode(
'SUBTYPE_OF_SEALED_CLASS',
"The class '{0}' shouldn't be extended, mixed in, or implemented because it's sealed.",
- correction:
+ correctionMessage:
"Try composing instead of inheriting, or refer to the documentation of '{0}' for more information.",
hasPublishedDocs: true,
);
@@ -2961,7 +2962,7 @@
static const HintCode TYPE_CHECK_IS_NOT_NULL = HintCode(
'TYPE_CHECK_WITH_NULL',
"Tests for non-null should be done with '!= null'.",
- correction: "Try replacing the 'is! Null' check with '!= null'.",
+ correctionMessage: "Try replacing the 'is! Null' check with '!= null'.",
hasPublishedDocs: true,
uniqueName: 'TYPE_CHECK_IS_NOT_NULL',
);
@@ -2972,7 +2973,7 @@
static const HintCode TYPE_CHECK_IS_NULL = HintCode(
'TYPE_CHECK_WITH_NULL',
"Tests for null should be done with '== null'.",
- correction: "Try replacing the 'is Null' check with '== null'.",
+ correctionMessage: "Try replacing the 'is Null' check with '== null'.",
hasPublishedDocs: true,
uniqueName: 'TYPE_CHECK_IS_NULL',
);
@@ -3011,7 +3012,7 @@
static const HintCode UNDEFINED_HIDDEN_NAME = HintCode(
'UNDEFINED_HIDDEN_NAME',
"The library '{0}' doesn't export a member with the hidden name '{1}'.",
- correction: "Try removing the name from the list of hidden members.",
+ correctionMessage: "Try removing the name from the list of hidden members.",
hasPublishedDocs: true,
);
@@ -3088,7 +3089,7 @@
static const HintCode UNDEFINED_SHOWN_NAME = HintCode(
'UNDEFINED_SHOWN_NAME',
"The library '{0}' doesn't export a member with the shown name '{1}'.",
- correction: "Try removing the name from the list of shown members.",
+ correctionMessage: "Try removing the name from the list of shown members.",
hasPublishedDocs: true,
);
@@ -3099,7 +3100,7 @@
static const HintCode UNIGNORABLE_IGNORE = HintCode(
'UNIGNORABLE_IGNORE',
"The diagnostic '{0}' can't be ignored.",
- correction:
+ correctionMessage:
"Try removing the name from the list, or removing the whole comment if this is the only name in the list.",
);
@@ -3138,7 +3139,7 @@
static const HintCode UNNECESSARY_CAST = HintCode(
'UNNECESSARY_CAST',
"Unnecessary cast.",
- correction: "Try removing the cast.",
+ correctionMessage: "Try removing the cast.",
hasPublishedDocs: true,
);
@@ -3149,7 +3150,7 @@
static const HintCode UNNECESSARY_IGNORE = HintCode(
'UNNECESSARY_IGNORE',
"The diagnostic '{0}' isn't produced at this location so it doesn't need to be ignored.",
- correction:
+ correctionMessage:
"Try removing the name from the list, or removing the whole comment if this is the only name in the list.",
);
@@ -3203,7 +3204,7 @@
static const HintCode UNNECESSARY_IMPORT = HintCode(
'UNNECESSARY_IMPORT',
"The import of '{0}' is unnecessary because all of the used elements are also provided by the import of '{1}'.",
- correction: "Try removing the import directive.",
+ correctionMessage: "Try removing the import directive.",
);
/**
@@ -3255,7 +3256,7 @@
static const HintCode UNNECESSARY_NO_SUCH_METHOD = HintCode(
'UNNECESSARY_NO_SUCH_METHOD',
"Unnecessary 'noSuchMethod' declaration.",
- correction: "Try removing the declaration of 'noSuchMethod'.",
+ correctionMessage: "Try removing the declaration of 'noSuchMethod'.",
hasPublishedDocs: true,
);
@@ -3316,7 +3317,7 @@
static const HintCode UNNECESSARY_NULL_COMPARISON_FALSE = HintCode(
'UNNECESSARY_NULL_COMPARISON',
"The operand can't be null, so the condition is always false.",
- correction:
+ correctionMessage:
"Try removing the condition, an enclosing condition, or the whole conditional statement.",
hasPublishedDocs: true,
uniqueName: 'UNNECESSARY_NULL_COMPARISON_FALSE',
@@ -3328,7 +3329,7 @@
static const HintCode UNNECESSARY_NULL_COMPARISON_TRUE = HintCode(
'UNNECESSARY_NULL_COMPARISON',
"The operand can't be null, so the condition is always true.",
- correction: "Remove the condition.",
+ correctionMessage: "Remove the condition.",
hasPublishedDocs: true,
uniqueName: 'UNNECESSARY_NULL_COMPARISON_TRUE',
);
@@ -3399,7 +3400,8 @@
static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = HintCode(
'UNNECESSARY_TYPE_CHECK',
"Unnecessary type check; the result is always 'false'.",
- correction: "Try correcting the type check, or removing the type check.",
+ correctionMessage:
+ "Try correcting the type check, or removing the type check.",
hasPublishedDocs: true,
uniqueName: 'UNNECESSARY_TYPE_CHECK_FALSE',
);
@@ -3410,7 +3412,8 @@
static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = HintCode(
'UNNECESSARY_TYPE_CHECK',
"Unnecessary type check; the result is always 'true'.",
- correction: "Try correcting the type check, or removing the type check.",
+ correctionMessage:
+ "Try correcting the type check, or removing the type check.",
hasPublishedDocs: true,
uniqueName: 'UNNECESSARY_TYPE_CHECK_TRUE',
);
@@ -3455,7 +3458,7 @@
static const HintCode UNUSED_CATCH_CLAUSE = HintCode(
'UNUSED_CATCH_CLAUSE',
"The exception variable '{0}' isn't used, so the 'catch' clause can be removed.",
- correction: "Try removing the catch clause.",
+ correctionMessage: "Try removing the catch clause.",
hasPublishedDocs: true,
);
@@ -3500,7 +3503,7 @@
static const HintCode UNUSED_CATCH_STACK = HintCode(
'UNUSED_CATCH_STACK',
"The stack trace variable '{0}' isn't used and can be removed.",
- correction: "Try removing the stack trace variable, or using it.",
+ correctionMessage: "Try removing the stack trace variable, or using it.",
hasPublishedDocs: true,
);
@@ -3556,7 +3559,7 @@
static const HintCode UNUSED_ELEMENT = HintCode(
'UNUSED_ELEMENT',
"The declaration '{0}' isn't referenced.",
- correction: "Try removing the declaration of '{0}'.",
+ correctionMessage: "Try removing the declaration of '{0}'.",
hasPublishedDocs: true,
);
@@ -3567,7 +3570,7 @@
static const HintCode UNUSED_ELEMENT_PARAMETER = HintCode(
'UNUSED_ELEMENT',
"A value for optional parameter '{0}' isn't ever given.",
- correction: "Try removing the unused parameter.",
+ correctionMessage: "Try removing the unused parameter.",
hasPublishedDocs: true,
uniqueName: 'UNUSED_ELEMENT_PARAMETER',
);
@@ -3609,7 +3612,7 @@
static const HintCode UNUSED_FIELD = HintCode(
'UNUSED_FIELD',
"The value of the field '{0}' isn't used.",
- correction: "Try removing the field, or using it.",
+ correctionMessage: "Try removing the field, or using it.",
hasPublishedDocs: true,
);
@@ -3643,7 +3646,7 @@
static const HintCode UNUSED_IMPORT = HintCode(
'UNUSED_IMPORT',
"Unused import: '{0}'.",
- correction: "Try removing the import directive.",
+ correctionMessage: "Try removing the import directive.",
hasPublishedDocs: true,
);
@@ -3695,7 +3698,7 @@
static const HintCode UNUSED_LABEL = HintCode(
'UNUSED_LABEL',
"The label '{0}' isn't used.",
- correction:
+ correctionMessage:
"Try removing the label, or using it in either a 'break' or 'continue' statement.",
hasPublishedDocs: true,
);
@@ -3728,7 +3731,7 @@
static const HintCode UNUSED_LOCAL_VARIABLE = HintCode(
'UNUSED_LOCAL_VARIABLE',
"The value of the local variable '{0}' isn't used.",
- correction: "Try removing the variable or using it.",
+ correctionMessage: "Try removing the variable or using it.",
hasPublishedDocs: true,
);
@@ -3805,7 +3808,7 @@
static const HintCode UNUSED_RESULT = HintCode(
'UNUSED_RESULT',
"The value of '{0}' should be used.",
- correction:
+ correctionMessage:
"Try using the result by invoking a member, passing it to a function, or returning it from this function.",
);
@@ -3821,7 +3824,7 @@
static const HintCode UNUSED_RESULT_WITH_MESSAGE = HintCode(
'UNUSED_RESULT',
"'{0}' should be used. {1}.",
- correction:
+ correctionMessage:
"Try using the result by invoking a member, passing it to a function, or returning it from this function.",
uniqueName: 'UNUSED_RESULT_WITH_MESSAGE',
);
@@ -3859,7 +3862,7 @@
static const HintCode UNUSED_SHOWN_NAME = HintCode(
'UNUSED_SHOWN_NAME',
"The name {0} is shown, but isn’t used.",
- correction: "Try removing the name from the list of shown members.",
+ correctionMessage: "Try removing the name from the list of shown members.",
hasPublishedDocs: true,
);
@@ -3888,23 +3891,23 @@
static const HintCode USE_OF_NATIVE_EXTENSION = HintCode(
'USE_OF_NATIVE_EXTENSION',
"Dart native extensions are deprecated and aren’t available in Dart 2.15.",
- correction: "Try using dart:ffi for C interop.",
+ correctionMessage: "Try using dart:ffi for C interop.",
);
/// Initialize a newly created error code to have the given [name].
const HintCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'HintCode.${uniqueName ?? name}',
);
diff --git a/pkg/analyzer/lib/src/dart/error/lint_codes.dart b/pkg/analyzer/lib/src/dart/error/lint_codes.dart
index 536a0cb..45983c4 100644
--- a/pkg/analyzer/lib/src/dart/error/lint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/lint_codes.dart
@@ -12,12 +12,13 @@
class LintCode extends ErrorCode {
const LintCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ @Deprecated('Use correctionMessage instead') String? correction,
+ String? correctionMessage,
String? uniqueName,
}) : super(
- correction: correction,
- message: message,
+ correctionMessage: correctionMessage ?? correction,
+ problemMessage: problemMessage,
name: name,
uniqueName: uniqueName ?? 'LintCode.$name',
);
@@ -28,6 +29,9 @@
@override
int get hashCode => uniqueName.hashCode;
+ @Deprecated('Use problemMessage instead')
+ String get message => problemMessage;
+
@override
ErrorType get type => ErrorType.LINT;
@@ -44,10 +48,11 @@
/// The primary difference from [LintCode]s is that these codes cannot be
/// suppressed with `// ignore:` or `// ignore_for_file:` comments.
class SecurityLintCode extends LintCode {
- const SecurityLintCode(String name, String message,
- {String? uniqueName, String? correction})
- : super(name, message,
- uniqueName: uniqueName ?? 'LintCode.$name', correction: correction);
+ const SecurityLintCode(String name, String problemMessage,
+ {String? uniqueName, String? correctionMessage})
+ : super(name, problemMessage,
+ uniqueName: uniqueName ?? 'LintCode.$name',
+ correctionMessage: correctionMessage);
@override
bool get isIgnorable => false;
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 9da2117..d49a7eb 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -139,56 +139,56 @@
static const ParserErrorCode ABSTRACT_CLASS_MEMBER = ParserErrorCode(
'ABSTRACT_CLASS_MEMBER',
"Members of classes can't be declared to be 'abstract'.",
- correction:
+ correctionMessage:
"Try removing the 'abstract' keyword. You can add the 'abstract' keyword before the class declaration.",
);
static const ParserErrorCode ABSTRACT_ENUM = ParserErrorCode(
'ABSTRACT_ENUM',
"Enums can't be declared to be 'abstract'.",
- correction: "Try removing the keyword 'abstract'.",
+ correctionMessage: "Try removing the keyword 'abstract'.",
);
static const ParserErrorCode ABSTRACT_EXTERNAL_FIELD = ParserErrorCode(
'ABSTRACT_EXTERNAL_FIELD',
"Fields can't be declared both 'abstract' and 'external'.",
- correction: "Try removing the 'abstract' or 'external' keyword.",
+ correctionMessage: "Try removing the 'abstract' or 'external' keyword.",
);
static const ParserErrorCode ABSTRACT_LATE_FIELD = ParserErrorCode(
'ABSTRACT_LATE_FIELD',
"Abstract fields cannot be late.",
- correction: "Try removing the 'abstract' or 'late' keyword.",
+ correctionMessage: "Try removing the 'abstract' or 'late' keyword.",
);
static const ParserErrorCode ABSTRACT_STATIC_FIELD = ParserErrorCode(
'ABSTRACT_STATIC_FIELD',
"Static fields can't be declared 'abstract'.",
- correction: "Try removing the 'abstract' or 'static' keyword.",
+ correctionMessage: "Try removing the 'abstract' or 'static' keyword.",
);
static const ParserErrorCode ABSTRACT_STATIC_METHOD = ParserErrorCode(
'ABSTRACT_STATIC_METHOD',
"Static methods can't be declared to be 'abstract'.",
- correction: "Try removing the keyword 'abstract'.",
+ correctionMessage: "Try removing the keyword 'abstract'.",
);
static const ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = ParserErrorCode(
'ABSTRACT_TOP_LEVEL_FUNCTION',
"Top-level functions can't be declared to be 'abstract'.",
- correction: "Try removing the keyword 'abstract'.",
+ correctionMessage: "Try removing the keyword 'abstract'.",
);
static const ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = ParserErrorCode(
'ABSTRACT_TOP_LEVEL_VARIABLE',
"Top-level variables can't be declared to be 'abstract'.",
- correction: "Try removing the keyword 'abstract'.",
+ correctionMessage: "Try removing the keyword 'abstract'.",
);
static const ParserErrorCode ABSTRACT_TYPEDEF = ParserErrorCode(
'ABSTRACT_TYPEDEF',
"Typedefs can't be declared to be 'abstract'.",
- correction: "Try removing the keyword 'abstract'.",
+ correctionMessage: "Try removing the keyword 'abstract'.",
);
static const ParserErrorCode ANNOTATION_ON_TYPE_ARGUMENT = ParserErrorCode(
@@ -221,141 +221,142 @@
static const ParserErrorCode BINARY_OPERATOR_WRITTEN_OUT = ParserErrorCode(
'BINARY_OPERATOR_WRITTEN_OUT',
"Binary operator '{0}' is written as '{1}' instead of the written out word.",
- correction: "Try replacing '{0}' with '{1}'.",
+ correctionMessage: "Try replacing '{0}' with '{1}'.",
);
static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = ParserErrorCode(
'BREAK_OUTSIDE_OF_LOOP',
"A break statement can't be used outside of a loop or switch statement.",
- correction: "Try removing the break statement.",
+ correctionMessage: "Try removing the break statement.",
);
static const ParserErrorCode CATCH_SYNTAX = ParserErrorCode(
'CATCH_SYNTAX',
"'catch' must be followed by '(identifier)' or '(identifier, identifier)'.",
- correction:
+ correctionMessage:
"No types are needed, the first is given by 'on', the second is always 'StackTrace'.",
);
static const ParserErrorCode CATCH_SYNTAX_EXTRA_PARAMETERS = ParserErrorCode(
'CATCH_SYNTAX_EXTRA_PARAMETERS',
"'catch' must be followed by '(identifier)' or '(identifier, identifier)'.",
- correction:
+ correctionMessage:
"No types are needed, the first is given by 'on', the second is always 'StackTrace'.",
);
static const ParserErrorCode CLASS_IN_CLASS = ParserErrorCode(
'CLASS_IN_CLASS',
"Classes can't be declared inside other classes.",
- correction: "Try moving the class to the top-level.",
+ correctionMessage: "Try moving the class to the top-level.",
);
static const ParserErrorCode COLON_IN_PLACE_OF_IN = ParserErrorCode(
'COLON_IN_PLACE_OF_IN',
"For-in loops use 'in' rather than a colon.",
- correction: "Try replacing the colon with the keyword 'in'.",
+ correctionMessage: "Try replacing the colon with the keyword 'in'.",
);
static const ParserErrorCode CONFLICTING_MODIFIERS = ParserErrorCode(
'CONFLICTING_MODIFIERS',
"Members can't be declared to be both '{0}' and '{1}'.",
- correction: "Try removing one of the keywords.",
+ correctionMessage: "Try removing one of the keywords.",
);
static const ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = ParserErrorCode(
'CONSTRUCTOR_WITH_RETURN_TYPE',
"Constructors can't have a return type.",
- correction: "Try removing the return type.",
+ correctionMessage: "Try removing the return type.",
);
static const ParserErrorCode CONSTRUCTOR_WITH_TYPE_ARGUMENTS =
ParserErrorCode(
'CONSTRUCTOR_WITH_TYPE_ARGUMENTS',
"A constructor invocation can't have type arguments after the constructor name.",
- correction:
+ correctionMessage:
"Try removing the type arguments or placing them after the class name.",
);
static const ParserErrorCode CONST_AND_FINAL = ParserErrorCode(
'CONST_AND_FINAL',
"Members can't be declared to be both 'const' and 'final'.",
- correction: "Try removing either the 'const' or 'final' keyword.",
+ correctionMessage: "Try removing either the 'const' or 'final' keyword.",
);
static const ParserErrorCode CONST_CLASS = ParserErrorCode(
'CONST_CLASS',
"Classes can't be declared to be 'const'.",
- correction:
+ correctionMessage:
"Try removing the 'const' keyword. If you're trying to indicate that instances of the class can be constants, place the 'const' keyword on the class' constructor(s).",
);
static const ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = ParserErrorCode(
'CONST_CONSTRUCTOR_WITH_BODY',
"Const constructors can't have a body.",
- correction: "Try removing either the 'const' keyword or the body.",
+ correctionMessage: "Try removing either the 'const' keyword or the body.",
);
static const ParserErrorCode CONST_ENUM = ParserErrorCode(
'CONST_ENUM',
"Enums can't be declared to be 'const'.",
- correction: "Try removing the 'const' keyword.",
+ correctionMessage: "Try removing the 'const' keyword.",
);
static const ParserErrorCode CONST_FACTORY = ParserErrorCode(
'CONST_FACTORY',
"Only redirecting factory constructors can be declared to be 'const'.",
- correction:
+ correctionMessage:
"Try removing the 'const' keyword, or replacing the body with '=' followed by a valid target.",
);
static const ParserErrorCode CONST_METHOD = ParserErrorCode(
'CONST_METHOD',
"Getters, setters and methods can't be declared to be 'const'.",
- correction: "Try removing the 'const' keyword.",
+ correctionMessage: "Try removing the 'const' keyword.",
);
static const ParserErrorCode CONST_TYPEDEF = ParserErrorCode(
'CONST_TYPEDEF',
"Type aliases can't be declared to be 'const'.",
- correction: "Try removing the 'const' keyword.",
+ correctionMessage: "Try removing the 'const' keyword.",
);
static const ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = ParserErrorCode(
'CONTINUE_OUTSIDE_OF_LOOP',
"A continue statement can't be used outside of a loop or switch statement.",
- correction: "Try removing the continue statement.",
+ correctionMessage: "Try removing the continue statement.",
);
static const ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = ParserErrorCode(
'CONTINUE_WITHOUT_LABEL_IN_CASE',
"A continue statement in a switch statement must have a label as a target.",
- correction:
+ correctionMessage:
"Try adding a label associated with one of the case clauses to the continue statement.",
);
static const ParserErrorCode COVARIANT_AND_STATIC = ParserErrorCode(
'COVARIANT_AND_STATIC',
"Members can't be declared to be both 'covariant' and 'static'.",
- correction: "Try removing either the 'covariant' or 'static' keyword.",
+ correctionMessage:
+ "Try removing either the 'covariant' or 'static' keyword.",
);
static const ParserErrorCode COVARIANT_CONSTRUCTOR = ParserErrorCode(
'COVARIANT_CONSTRUCTOR',
"A constructor can't be declared to be 'covariant'.",
- correction: "Try removing the keyword 'covariant'.",
+ correctionMessage: "Try removing the keyword 'covariant'.",
);
static const ParserErrorCode COVARIANT_MEMBER = ParserErrorCode(
'COVARIANT_MEMBER',
"Getters, setters and methods can't be declared to be 'covariant'.",
- correction: "Try removing the 'covariant' keyword.",
+ correctionMessage: "Try removing the 'covariant' keyword.",
);
static const ParserErrorCode COVARIANT_TOP_LEVEL_DECLARATION =
ParserErrorCode(
'COVARIANT_TOP_LEVEL_DECLARATION',
"Top-level declarations can't be declared to be covariant.",
- correction: "Try removing the keyword 'covariant'.",
+ correctionMessage: "Try removing the keyword 'covariant'.",
);
/**
@@ -389,20 +390,20 @@
static const ParserErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE = ParserErrorCode(
'DEFAULT_VALUE_IN_FUNCTION_TYPE',
"Parameters in a function type can't have default values.",
- correction: "Try removing the default value.",
+ correctionMessage: "Try removing the default value.",
hasPublishedDocs: true,
);
static const ParserErrorCode DEFERRED_AFTER_PREFIX = ParserErrorCode(
'DEFERRED_AFTER_PREFIX',
"The deferred keyword should come immediately before the prefix ('as' clause).",
- correction: "Try moving the deferred keyword before the prefix.",
+ correctionMessage: "Try moving the deferred keyword before the prefix.",
);
static const ParserErrorCode DIRECTIVE_AFTER_DECLARATION = ParserErrorCode(
'DIRECTIVE_AFTER_DECLARATION',
"Directives must appear before any declarations.",
- correction: "Try moving the directive before any declarations.",
+ correctionMessage: "Try moving the directive before any declarations.",
);
/**
@@ -412,13 +413,13 @@
static const ParserErrorCode DUPLICATED_MODIFIER = ParserErrorCode(
'DUPLICATED_MODIFIER',
"The modifier '{0}' was already specified.",
- correction: "Try removing all but one occurrence of the modifier.",
+ correctionMessage: "Try removing all but one occurrence of the modifier.",
);
static const ParserErrorCode DUPLICATE_DEFERRED = ParserErrorCode(
'DUPLICATE_DEFERRED',
"An import directive can only have one 'deferred' keyword.",
- correction: "Try removing all but one 'deferred' keyword.",
+ correctionMessage: "Try removing all but one 'deferred' keyword.",
);
/**
@@ -429,50 +430,50 @@
ParserErrorCode(
'DUPLICATE_LABEL_IN_SWITCH_STATEMENT',
"The label '{0}' was already used in this switch statement.",
- correction: "Try choosing a different name for this label.",
+ correctionMessage: "Try choosing a different name for this label.",
);
static const ParserErrorCode DUPLICATE_PREFIX = ParserErrorCode(
'DUPLICATE_PREFIX',
"An import directive can only have one prefix ('as' clause).",
- correction: "Try removing all but one prefix.",
+ correctionMessage: "Try removing all but one prefix.",
);
static const ParserErrorCode EMPTY_ENUM_BODY = ParserErrorCode(
'EMPTY_ENUM_BODY',
"An enum must declare at least one constant name.",
- correction: "Try declaring a constant.",
+ correctionMessage: "Try declaring a constant.",
);
static const ParserErrorCode ENUM_IN_CLASS = ParserErrorCode(
'ENUM_IN_CLASS',
"Enums can't be declared inside classes.",
- correction: "Try moving the enum to the top-level.",
+ correctionMessage: "Try moving the enum to the top-level.",
);
static const ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND =
ParserErrorCode(
'EQUALITY_CANNOT_BE_EQUALITY_OPERAND',
"A comparison expression can't be an operand of another comparison expression.",
- correction: "Try putting parentheses around one of the comparisons.",
+ correctionMessage: "Try putting parentheses around one of the comparisons.",
);
static const ParserErrorCode EXPECTED_BODY = ParserErrorCode(
'EXPECTED_BODY',
"A {0} must have a body, even if it is empty.",
- correction: "Try adding an empty body.",
+ correctionMessage: "Try adding an empty body.",
);
static const ParserErrorCode EXPECTED_CASE_OR_DEFAULT = ParserErrorCode(
'EXPECTED_CASE_OR_DEFAULT',
"Expected 'case' or 'default'.",
- correction: "Try placing this code inside a case clause.",
+ correctionMessage: "Try placing this code inside a case clause.",
);
static const ParserErrorCode EXPECTED_CLASS_MEMBER = ParserErrorCode(
'EXPECTED_CLASS_MEMBER',
"Expected a class member.",
- correction: "Try placing this code inside a class member.",
+ correctionMessage: "Try placing this code inside a class member.",
);
static const ParserErrorCode EXPECTED_ELSE_OR_COMMA = ParserErrorCode(
@@ -483,7 +484,7 @@
static const ParserErrorCode EXPECTED_EXECUTABLE = ParserErrorCode(
'EXPECTED_EXECUTABLE',
"Expected a method, getter, setter or operator declaration.",
- correction:
+ correctionMessage:
"This appears to be incomplete code. Try removing it or completing it.",
);
@@ -491,7 +492,8 @@
ParserErrorCode(
'EXPECTED_IDENTIFIER_BUT_GOT_KEYWORD',
"'{0}' can't be used as an identifier because it's a keyword.",
- correction: "Try renaming this to be an identifier that isn't a keyword.",
+ correctionMessage:
+ "Try renaming this to be an identifier that isn't a keyword.",
);
static const ParserErrorCode EXPECTED_INSTEAD = ParserErrorCode(
@@ -502,7 +504,7 @@
static const ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = ParserErrorCode(
'EXPECTED_LIST_OR_MAP_LITERAL',
"Expected a list or map literal.",
- correction:
+ correctionMessage:
"Try inserting a list or map literal, or remove the type arguments.",
);
@@ -528,7 +530,7 @@
static const ParserErrorCode EXPERIMENT_NOT_ENABLED = ParserErrorCode(
'EXPERIMENT_NOT_ENABLED',
"This requires the '{0}' language feature to be enabled.",
- correction:
+ correctionMessage:
"Try updating your pubspec.yaml to set the minimum SDK constraint to {1} or higher, and running 'pub get'.",
);
@@ -536,7 +538,8 @@
ParserErrorCode(
'EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE',
"Export directives must precede part directives.",
- correction: "Try moving the export directives before the part directives.",
+ correctionMessage:
+ "Try moving the export directives before the part directives.",
);
/**
@@ -565,7 +568,7 @@
ParserErrorCode(
'EXTENSION_DECLARES_ABSTRACT_MEMBER',
"Extensions can't declare abstract members.",
- correction: "Try providing an implementation for the member.",
+ correctionMessage: "Try providing an implementation for the member.",
hasPublishedDocs: true,
);
@@ -596,7 +599,7 @@
static const ParserErrorCode EXTENSION_DECLARES_CONSTRUCTOR = ParserErrorCode(
'EXTENSION_DECLARES_CONSTRUCTOR',
"Extensions can't declare constructors.",
- correction: "Try removing the constructor declaration.",
+ correctionMessage: "Try removing the constructor declaration.",
hasPublishedDocs: true,
);
@@ -629,7 +632,7 @@
ParserErrorCode(
'EXTENSION_DECLARES_INSTANCE_FIELD',
"Extensions can't declare instance fields",
- correction:
+ correctionMessage:
"Try removing the field declaration or making it a static field",
hasPublishedDocs: true,
);
@@ -637,13 +640,13 @@
static const ParserErrorCode EXTERNAL_CLASS = ParserErrorCode(
'EXTERNAL_CLASS',
"Classes can't be declared to be 'external'.",
- correction: "Try removing the keyword 'external'.",
+ correctionMessage: "Try removing the keyword 'external'.",
);
static const ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = ParserErrorCode(
'EXTERNAL_CONSTRUCTOR_WITH_BODY',
"External constructors can't have a body.",
- correction:
+ correctionMessage:
"Try removing the body of the constructor, or removing the keyword 'external'.",
);
@@ -656,40 +659,40 @@
static const ParserErrorCode EXTERNAL_ENUM = ParserErrorCode(
'EXTERNAL_ENUM',
"Enums can't be declared to be 'external'.",
- correction: "Try removing the keyword 'external'.",
+ correctionMessage: "Try removing the keyword 'external'.",
);
static const ParserErrorCode EXTERNAL_FACTORY_REDIRECTION = ParserErrorCode(
'EXTERNAL_FACTORY_REDIRECTION',
"A redirecting factory can't be external.",
- correction: "Try removing the 'external' modifier.",
+ correctionMessage: "Try removing the 'external' modifier.",
);
static const ParserErrorCode EXTERNAL_FACTORY_WITH_BODY = ParserErrorCode(
'EXTERNAL_FACTORY_WITH_BODY',
"External factories can't have a body.",
- correction:
+ correctionMessage:
"Try removing the body of the factory, or removing the keyword 'external'.",
);
static const ParserErrorCode EXTERNAL_FIELD = ParserErrorCode(
'EXTERNAL_FIELD',
"Fields can't be declared to be 'external'.",
- correction:
+ correctionMessage:
"Try removing the keyword 'external', or replacing the field by an external getter and/or setter.",
);
static const ParserErrorCode EXTERNAL_GETTER_WITH_BODY = ParserErrorCode(
'EXTERNAL_GETTER_WITH_BODY',
"External getters can't have a body.",
- correction:
+ correctionMessage:
"Try removing the body of the getter, or removing the keyword 'external'.",
);
static const ParserErrorCode EXTERNAL_LATE_FIELD = ParserErrorCode(
'EXTERNAL_LATE_FIELD',
"External fields cannot be late.",
- correction: "Try removing the 'external' or 'late' keyword.",
+ correctionMessage: "Try removing the 'external' or 'late' keyword.",
);
static const ParserErrorCode EXTERNAL_METHOD_WITH_BODY = ParserErrorCode(
@@ -700,45 +703,45 @@
static const ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = ParserErrorCode(
'EXTERNAL_OPERATOR_WITH_BODY',
"External operators can't have a body.",
- correction:
+ correctionMessage:
"Try removing the body of the operator, or removing the keyword 'external'.",
);
static const ParserErrorCode EXTERNAL_SETTER_WITH_BODY = ParserErrorCode(
'EXTERNAL_SETTER_WITH_BODY',
"External setters can't have a body.",
- correction:
+ correctionMessage:
"Try removing the body of the setter, or removing the keyword 'external'.",
);
static const ParserErrorCode EXTERNAL_TYPEDEF = ParserErrorCode(
'EXTERNAL_TYPEDEF',
"Typedefs can't be declared to be 'external'.",
- correction: "Try removing the keyword 'external'.",
+ correctionMessage: "Try removing the keyword 'external'.",
);
static const ParserErrorCode EXTRANEOUS_MODIFIER = ParserErrorCode(
'EXTRANEOUS_MODIFIER',
"Can't have modifier '{0}' here.",
- correction: "Try removing '{0}'.",
+ correctionMessage: "Try removing '{0}'.",
);
static const ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = ParserErrorCode(
'FACTORY_TOP_LEVEL_DECLARATION',
"Top-level declarations can't be declared to be 'factory'.",
- correction: "Try removing the keyword 'factory'.",
+ correctionMessage: "Try removing the keyword 'factory'.",
);
static const ParserErrorCode FACTORY_WITHOUT_BODY = ParserErrorCode(
'FACTORY_WITHOUT_BODY',
"A non-redirecting 'factory' constructor must have a body.",
- correction: "Try adding a body to the constructor.",
+ correctionMessage: "Try adding a body to the constructor.",
);
static const ParserErrorCode FACTORY_WITH_INITIALIZERS = ParserErrorCode(
'FACTORY_WITH_INITIALIZERS',
"A 'factory' constructor can't have initializers.",
- correction:
+ correctionMessage:
"Try removing the 'factory' keyword to make this a generative constructor, or removing the initializers.",
);
@@ -746,7 +749,7 @@
ParserErrorCode(
'FIELD_INITIALIZED_OUTSIDE_DECLARING_CLASS',
"A field can only be initialized in its declaring class",
- correction:
+ correctionMessage:
"Try passing a value into the superclass constructor, or moving the initialization into the constructor body.",
);
@@ -754,82 +757,83 @@
ParserErrorCode(
'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR',
"Field formal parameters can only be used in a constructor.",
- correction: "Try removing 'this.'.",
+ correctionMessage: "Try removing 'this.'.",
);
static const ParserErrorCode FINAL_AND_COVARIANT = ParserErrorCode(
'FINAL_AND_COVARIANT',
"Members can't be declared to be both 'final' and 'covariant'.",
- correction: "Try removing either the 'final' or 'covariant' keyword.",
+ correctionMessage:
+ "Try removing either the 'final' or 'covariant' keyword.",
);
static const ParserErrorCode FINAL_AND_COVARIANT_LATE_WITH_INITIALIZER =
ParserErrorCode(
'FINAL_AND_COVARIANT_LATE_WITH_INITIALIZER',
"Members marked 'late' with an initializer can't be declared to be both 'final' and 'covariant'.",
- correction:
+ correctionMessage:
"Try removing either the 'final' or 'covariant' keyword, or removing the initializer.",
);
static const ParserErrorCode FINAL_AND_VAR = ParserErrorCode(
'FINAL_AND_VAR',
"Members can't be declared to be both 'final' and 'var'.",
- correction: "Try removing the keyword 'var'.",
+ correctionMessage: "Try removing the keyword 'var'.",
);
static const ParserErrorCode FINAL_CLASS = ParserErrorCode(
'FINAL_CLASS',
"Classes can't be declared to be 'final'.",
- correction: "Try removing the keyword 'final'.",
+ correctionMessage: "Try removing the keyword 'final'.",
);
static const ParserErrorCode FINAL_CONSTRUCTOR = ParserErrorCode(
'FINAL_CONSTRUCTOR',
"A constructor can't be declared to be 'final'.",
- correction: "Try removing the keyword 'final'.",
+ correctionMessage: "Try removing the keyword 'final'.",
);
static const ParserErrorCode FINAL_ENUM = ParserErrorCode(
'FINAL_ENUM',
"Enums can't be declared to be 'final'.",
- correction: "Try removing the keyword 'final'.",
+ correctionMessage: "Try removing the keyword 'final'.",
);
static const ParserErrorCode FINAL_METHOD = ParserErrorCode(
'FINAL_METHOD',
"Getters, setters and methods can't be declared to be 'final'.",
- correction: "Try removing the keyword 'final'.",
+ correctionMessage: "Try removing the keyword 'final'.",
);
static const ParserErrorCode FINAL_TYPEDEF = ParserErrorCode(
'FINAL_TYPEDEF',
"Typedefs can't be declared to be 'final'.",
- correction: "Try removing the keyword 'final'.",
+ correctionMessage: "Try removing the keyword 'final'.",
);
static const ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = ParserErrorCode(
'FUNCTION_TYPED_PARAMETER_VAR',
"Function-typed parameters can't specify 'const', 'final' or 'var' in place of a return type.",
- correction: "Try replacing the keyword with a return type.",
+ correctionMessage: "Try replacing the keyword with a return type.",
);
static const ParserErrorCode GETTER_CONSTRUCTOR = ParserErrorCode(
'GETTER_CONSTRUCTOR',
"Constructors can't be a getter.",
- correction: "Try removing 'get'.",
+ correctionMessage: "Try removing 'get'.",
);
static const ParserErrorCode GETTER_IN_FUNCTION = ParserErrorCode(
'GETTER_IN_FUNCTION',
"Getters can't be defined within methods or functions.",
- correction:
+ correctionMessage:
"Try moving the getter outside the method or function, or converting the getter to a function.",
);
static const ParserErrorCode GETTER_WITH_PARAMETERS = ParserErrorCode(
'GETTER_WITH_PARAMETERS',
"Getters must be declared without a parameter list.",
- correction:
+ correctionMessage:
"Try removing the parameter list, or removing the keyword 'get' to define a method rather than a getter.",
);
@@ -842,40 +846,43 @@
static const ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = ParserErrorCode(
'IMPLEMENTS_BEFORE_EXTENDS',
"The extends clause must be before the implements clause.",
- correction: "Try moving the extends clause before the implements clause.",
+ correctionMessage:
+ "Try moving the extends clause before the implements clause.",
);
static const ParserErrorCode IMPLEMENTS_BEFORE_ON = ParserErrorCode(
'IMPLEMENTS_BEFORE_ON',
"The on clause must be before the implements clause.",
- correction: "Try moving the on clause before the implements clause.",
+ correctionMessage: "Try moving the on clause before the implements clause.",
);
static const ParserErrorCode IMPLEMENTS_BEFORE_WITH = ParserErrorCode(
'IMPLEMENTS_BEFORE_WITH',
"The with clause must be before the implements clause.",
- correction: "Try moving the with clause before the implements clause.",
+ correctionMessage:
+ "Try moving the with clause before the implements clause.",
);
static const ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE =
ParserErrorCode(
'IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE',
"Import directives must precede part directives.",
- correction: "Try moving the import directives before the part directives.",
+ correctionMessage:
+ "Try moving the import directives before the part directives.",
);
static const ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH =
ParserErrorCode(
'INITIALIZED_VARIABLE_IN_FOR_EACH',
"The loop variable in a for-each loop can't be initialized.",
- correction:
+ correctionMessage:
"Try removing the initializer, or using a different kind of loop.",
);
static const ParserErrorCode INVALID_AWAIT_IN_FOR = ParserErrorCode(
'INVALID_AWAIT_IN_FOR',
"The keyword 'await' isn't allowed for a normal 'for' statement.",
- correction: "Try removing the keyword, or use a for-each statement.",
+ correctionMessage: "Try removing the keyword, or use a for-each statement.",
);
/**
@@ -900,7 +907,7 @@
static const ParserErrorCode INVALID_GENERIC_FUNCTION_TYPE = ParserErrorCode(
'INVALID_GENERIC_FUNCTION_TYPE',
"Invalid generic function type.",
- correction:
+ correctionMessage:
"Try using a generic function type (returnType 'Function(' parameters ')').",
);
@@ -912,14 +919,14 @@
static const ParserErrorCode INVALID_INITIALIZER = ParserErrorCode(
'INVALID_INITIALIZER',
"Not a valid initializer.",
- correction: "To initialize a field, use the syntax 'name = value'.",
+ correctionMessage: "To initialize a field, use the syntax 'name = value'.",
);
static const ParserErrorCode INVALID_LITERAL_IN_CONFIGURATION =
ParserErrorCode(
'INVALID_LITERAL_IN_CONFIGURATION',
"The literal in a configuration can't contain interpolation.",
- correction: "Try removing the interpolation expressions.",
+ correctionMessage: "Try removing the interpolation expressions.",
);
/**
@@ -947,13 +954,13 @@
ParserErrorCode(
'INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER',
"The operator '?.' cannot be used with 'super' because 'super' cannot be null.",
- correction: "Try replacing '?.' with '.'",
+ correctionMessage: "Try replacing '?.' with '.'",
);
static const ParserErrorCode INVALID_STAR_AFTER_ASYNC = ParserErrorCode(
'INVALID_STAR_AFTER_ASYNC',
"The modifier 'async*' isn't allowed for an expression function body.",
- correction: "Try converting the body to a block.",
+ correctionMessage: "Try converting the body to a block.",
);
static const ParserErrorCode INVALID_SUPER_IN_INITIALIZER = ParserErrorCode(
@@ -964,7 +971,7 @@
static const ParserErrorCode INVALID_SYNC = ParserErrorCode(
'INVALID_SYNC',
"The modifier 'sync' isn't allowed for an expression function body.",
- correction: "Try converting the body to a block.",
+ correctionMessage: "Try converting the body to a block.",
);
static const ParserErrorCode INVALID_THIS_IN_INITIALIZER = ParserErrorCode(
@@ -1011,124 +1018,125 @@
ParserErrorCode(
'INVALID_USE_OF_COVARIANT_IN_EXTENSION',
"Can't have modifier '{0}' in an extension.",
- correction: "Try removing '{0}'.",
+ correctionMessage: "Try removing '{0}'.",
hasPublishedDocs: true,
);
static const ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = ParserErrorCode(
'LIBRARY_DIRECTIVE_NOT_FIRST',
"The library directive must appear before all other directives.",
- correction: "Try moving the library directive before any other directives.",
+ correctionMessage:
+ "Try moving the library directive before any other directives.",
);
static const ParserErrorCode LITERAL_WITH_CLASS = ParserErrorCode(
'LITERAL_WITH_CLASS',
"A {0} literal can't be prefixed by '{1}'.",
- correction: "Try removing '{1}'",
+ correctionMessage: "Try removing '{1}'",
);
static const ParserErrorCode LITERAL_WITH_CLASS_AND_NEW = ParserErrorCode(
'LITERAL_WITH_CLASS_AND_NEW',
"A {0} literal can't be prefixed by 'new {1}'.",
- correction: "Try removing 'new' and '{1}'",
+ correctionMessage: "Try removing 'new' and '{1}'",
);
static const ParserErrorCode LITERAL_WITH_NEW = ParserErrorCode(
'LITERAL_WITH_NEW',
"A literal can't be prefixed by 'new'.",
- correction: "Try removing 'new'",
+ correctionMessage: "Try removing 'new'",
);
static const ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER =
ParserErrorCode(
'LOCAL_FUNCTION_DECLARATION_MODIFIER',
"Local function declarations can't specify any modifiers.",
- correction: "Try removing the modifier.",
+ correctionMessage: "Try removing the modifier.",
);
static const ParserErrorCode MEMBER_WITH_CLASS_NAME = ParserErrorCode(
'MEMBER_WITH_CLASS_NAME',
"A class member can't have the same name as the enclosing class.",
- correction: "Try renaming the member.",
+ correctionMessage: "Try renaming the member.",
);
static const ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = ParserErrorCode(
'MISSING_ASSIGNABLE_SELECTOR',
"Missing selector such as '.identifier' or '[0]'.",
- correction: "Try adding a selector.",
+ correctionMessage: "Try adding a selector.",
);
static const ParserErrorCode MISSING_ASSIGNMENT_IN_INITIALIZER =
ParserErrorCode(
'MISSING_ASSIGNMENT_IN_INITIALIZER',
"Expected an assignment after the field name.",
- correction: "To initialize a field, use the syntax 'name = value'.",
+ correctionMessage: "To initialize a field, use the syntax 'name = value'.",
);
static const ParserErrorCode MISSING_CATCH_OR_FINALLY = ParserErrorCode(
'MISSING_CATCH_OR_FINALLY',
"A try block must be followed by an 'on', 'catch', or 'finally' clause.",
- correction:
+ correctionMessage:
"Try adding either a catch or finally clause, or remove the try statement.",
);
static const ParserErrorCode MISSING_CLOSING_PARENTHESIS = ParserErrorCode(
'MISSING_CLOSING_PARENTHESIS',
"The closing parenthesis is missing.",
- correction: "Try adding the closing parenthesis.",
+ correctionMessage: "Try adding the closing parenthesis.",
);
static const ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE =
ParserErrorCode(
'MISSING_CONST_FINAL_VAR_OR_TYPE',
"Variables must be declared using the keywords 'const', 'final', 'var' or a type name.",
- correction:
+ correctionMessage:
"Try adding the name of the type of the variable or the keyword 'var'.",
);
static const ParserErrorCode MISSING_ENUM_BODY = ParserErrorCode(
'MISSING_ENUM_BODY',
"An enum definition must have a body with at least one constant name.",
- correction: "Try adding a body and defining at least one constant.",
+ correctionMessage: "Try adding a body and defining at least one constant.",
);
static const ParserErrorCode MISSING_EXPRESSION_IN_INITIALIZER =
ParserErrorCode(
'MISSING_EXPRESSION_IN_INITIALIZER',
"Expected an expression after the assignment operator.",
- correction:
+ correctionMessage:
"Try adding the value to be assigned, or remove the assignment operator.",
);
static const ParserErrorCode MISSING_EXPRESSION_IN_THROW = ParserErrorCode(
'MISSING_EXPRESSION_IN_THROW',
"Missing expression after 'throw'.",
- correction:
+ correctionMessage:
"Add an expression after 'throw' or use 'rethrow' to throw a caught exception",
);
static const ParserErrorCode MISSING_FUNCTION_BODY = ParserErrorCode(
'MISSING_FUNCTION_BODY',
"A function body must be provided.",
- correction: "Try adding a function body.",
+ correctionMessage: "Try adding a function body.",
);
static const ParserErrorCode MISSING_FUNCTION_KEYWORD = ParserErrorCode(
'MISSING_FUNCTION_KEYWORD',
"Function types must have the keyword 'Function' before the parameter list.",
- correction: "Try adding the keyword 'Function'.",
+ correctionMessage: "Try adding the keyword 'Function'.",
);
static const ParserErrorCode MISSING_FUNCTION_PARAMETERS = ParserErrorCode(
'MISSING_FUNCTION_PARAMETERS',
"Functions must have an explicit list of parameters.",
- correction: "Try adding a parameter list.",
+ correctionMessage: "Try adding a parameter list.",
);
static const ParserErrorCode MISSING_GET = ParserErrorCode(
'MISSING_GET',
"Getters must have the keyword 'get' before the getter name.",
- correction: "Try adding the keyword 'get'.",
+ correctionMessage: "Try adding the keyword 'get'.",
);
static const ParserErrorCode MISSING_IDENTIFIER = ParserErrorCode(
@@ -1144,20 +1152,20 @@
static const ParserErrorCode MISSING_KEYWORD_OPERATOR = ParserErrorCode(
'MISSING_KEYWORD_OPERATOR',
"Operator declarations must be preceded by the keyword 'operator'.",
- correction: "Try adding the keyword 'operator'.",
+ correctionMessage: "Try adding the keyword 'operator'.",
);
static const ParserErrorCode MISSING_METHOD_PARAMETERS = ParserErrorCode(
'MISSING_METHOD_PARAMETERS',
"Methods must have an explicit list of parameters.",
- correction: "Try adding a parameter list.",
+ correctionMessage: "Try adding a parameter list.",
);
static const ParserErrorCode MISSING_NAME_FOR_NAMED_PARAMETER =
ParserErrorCode(
'MISSING_NAME_FOR_NAMED_PARAMETER',
"Named parameters in a function type must have a name",
- correction:
+ correctionMessage:
"Try providing a name for the parameter or removing the curly braces.",
);
@@ -1165,7 +1173,7 @@
ParserErrorCode(
'MISSING_NAME_IN_LIBRARY_DIRECTIVE',
"Library directives must include a library name.",
- correction:
+ correctionMessage:
"Try adding a library name after the keyword 'library', or remove the library directive if the library doesn't have any parts.",
);
@@ -1173,20 +1181,21 @@
ParserErrorCode(
'MISSING_NAME_IN_PART_OF_DIRECTIVE',
"Part-of directives must include a library name.",
- correction: "Try adding a library name after the 'of'.",
+ correctionMessage: "Try adding a library name after the 'of'.",
);
static const ParserErrorCode MISSING_PREFIX_IN_DEFERRED_IMPORT =
ParserErrorCode(
'MISSING_PREFIX_IN_DEFERRED_IMPORT',
"Deferred imports should have a prefix.",
- correction: "Try adding a prefix to the import by adding an 'as' clause.",
+ correctionMessage:
+ "Try adding a prefix to the import by adding an 'as' clause.",
);
static const ParserErrorCode MISSING_STAR_AFTER_SYNC = ParserErrorCode(
'MISSING_STAR_AFTER_SYNC',
"The modifier 'sync' must be followed by a star ('*').",
- correction: "Try removing the modifier, or add a star.",
+ correctionMessage: "Try removing the modifier, or add a star.",
);
static const ParserErrorCode MISSING_STATEMENT = ParserErrorCode(
@@ -1202,25 +1211,25 @@
ParserErrorCode(
'MISSING_TERMINATOR_FOR_PARAMETER_GROUP',
"There is no '{0}' to close the parameter group.",
- correction: "Try inserting a '{0}' at the end of the group.",
+ correctionMessage: "Try inserting a '{0}' at the end of the group.",
);
static const ParserErrorCode MISSING_TYPEDEF_PARAMETERS = ParserErrorCode(
'MISSING_TYPEDEF_PARAMETERS',
"Typedefs must have an explicit list of parameters.",
- correction: "Try adding a parameter list.",
+ correctionMessage: "Try adding a parameter list.",
);
static const ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = ParserErrorCode(
'MISSING_VARIABLE_IN_FOR_EACH',
"A loop variable must be declared in a for-each loop before the 'in', but none was found.",
- correction: "Try declaring a loop variable.",
+ correctionMessage: "Try declaring a loop variable.",
);
static const ParserErrorCode MIXED_PARAMETER_GROUPS = ParserErrorCode(
'MIXED_PARAMETER_GROUPS',
"Can't have both positional and named parameters in a single parameter list.",
- correction: "Try choosing a single style of optional parameters.",
+ correctionMessage: "Try choosing a single style of optional parameters.",
);
static const ParserErrorCode MIXIN_DECLARES_CONSTRUCTOR = ParserErrorCode(
@@ -1231,53 +1240,54 @@
static const ParserErrorCode MODIFIER_OUT_OF_ORDER = ParserErrorCode(
'MODIFIER_OUT_OF_ORDER',
"The modifier '{0}' should be before the modifier '{1}'.",
- correction: "Try re-ordering the modifiers.",
+ correctionMessage: "Try re-ordering the modifiers.",
);
static const ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = ParserErrorCode(
'MULTIPLE_EXTENDS_CLAUSES',
"Each class definition can have at most one extends clause.",
- correction:
+ correctionMessage:
"Try choosing one superclass and define your class to implement (or mix in) the others.",
);
static const ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = ParserErrorCode(
'MULTIPLE_IMPLEMENTS_CLAUSES',
"Each class or mixin definition can have at most one implements clause.",
- correction:
+ correctionMessage:
"Try combining all of the implements clauses into a single clause.",
);
static const ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = ParserErrorCode(
'MULTIPLE_LIBRARY_DIRECTIVES',
"Only one library directive may be declared in a file.",
- correction: "Try removing all but one of the library directives.",
+ correctionMessage: "Try removing all but one of the library directives.",
);
static const ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS =
ParserErrorCode(
'MULTIPLE_NAMED_PARAMETER_GROUPS',
"Can't have multiple groups of named parameters in a single parameter list.",
- correction: "Try combining all of the groups into a single group.",
+ correctionMessage: "Try combining all of the groups into a single group.",
);
static const ParserErrorCode MULTIPLE_ON_CLAUSES = ParserErrorCode(
'MULTIPLE_ON_CLAUSES',
"Each mixin definition can have at most one on clause.",
- correction: "Try combining all of the on clauses into a single clause.",
+ correctionMessage:
+ "Try combining all of the on clauses into a single clause.",
);
static const ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = ParserErrorCode(
'MULTIPLE_PART_OF_DIRECTIVES',
"Only one part-of directive may be declared in a file.",
- correction: "Try removing all but one of the part-of directives.",
+ correctionMessage: "Try removing all but one of the part-of directives.",
);
static const ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS =
ParserErrorCode(
'MULTIPLE_POSITIONAL_PARAMETER_GROUPS',
"Can't have multiple groups of positional parameters in a single parameter list.",
- correction: "Try combining all of the groups into a single group.",
+ correctionMessage: "Try combining all of the groups into a single group.",
);
/**
@@ -1287,52 +1297,54 @@
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 'in', but {0} were found.",
- correction:
+ correctionMessage:
"Try moving all but one of the declarations inside the loop body.",
);
static const ParserErrorCode MULTIPLE_VARIANCE_MODIFIERS = ParserErrorCode(
'MULTIPLE_VARIANCE_MODIFIERS',
"Each type parameter can have at most one variance modifier.",
- correction: "Use at most one of the 'in', 'out', or 'inout' modifiers.",
+ correctionMessage:
+ "Use at most one of the 'in', 'out', or 'inout' modifiers.",
);
static const ParserErrorCode MULTIPLE_WITH_CLAUSES = ParserErrorCode(
'MULTIPLE_WITH_CLAUSES',
"Each class definition can have at most one with clause.",
- correction: "Try combining all of the with clauses into a single clause.",
+ correctionMessage:
+ "Try combining all of the with clauses into a single clause.",
);
static const ParserErrorCode NAMED_FUNCTION_EXPRESSION = ParserErrorCode(
'NAMED_FUNCTION_EXPRESSION',
"Function expressions can't be named.",
- correction:
+ correctionMessage:
"Try removing the name, or moving the function expression to a function declaration statement.",
);
static const ParserErrorCode NAMED_FUNCTION_TYPE = ParserErrorCode(
'NAMED_FUNCTION_TYPE',
"Function types can't be named.",
- correction: "Try replacing the name with the keyword 'Function'.",
+ correctionMessage: "Try replacing the name with the keyword 'Function'.",
);
static const ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = ParserErrorCode(
'NAMED_PARAMETER_OUTSIDE_GROUP',
"Named parameters must be enclosed in curly braces ('{' and '}').",
- correction: "Try surrounding the named parameters in curly braces.",
+ correctionMessage: "Try surrounding the named parameters in curly braces.",
);
static const ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = ParserErrorCode(
'NATIVE_CLAUSE_IN_NON_SDK_CODE',
"Native clause can only be used in the SDK and code that is loaded through native extensions.",
- correction: "Try removing the native clause.",
+ correctionMessage: "Try removing the native clause.",
);
static const ParserErrorCode NATIVE_CLAUSE_SHOULD_BE_ANNOTATION =
ParserErrorCode(
'NATIVE_CLAUSE_SHOULD_BE_ANNOTATION',
"Native clause in this form is deprecated.",
- correction:
+ correctionMessage:
"Try removing this native clause and adding @native() or @native('native-name') before the declaration.",
);
@@ -1340,32 +1352,33 @@
ParserErrorCode(
'NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE',
"Native functions can only be declared in the SDK and code that is loaded through native extensions.",
- correction: "Try removing the word 'native'.",
+ correctionMessage: "Try removing the word 'native'.",
);
static const ParserErrorCode NON_CONSTRUCTOR_FACTORY = ParserErrorCode(
'NON_CONSTRUCTOR_FACTORY',
"Only a constructor can be declared to be a factory.",
- correction: "Try removing the keyword 'factory'.",
+ correctionMessage: "Try removing the keyword 'factory'.",
);
static const ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = ParserErrorCode(
'NON_IDENTIFIER_LIBRARY_NAME',
"The name of a library must be an identifier.",
- correction: "Try using an identifier as the name of the library.",
+ correctionMessage: "Try using an identifier as the name of the library.",
);
static const ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = ParserErrorCode(
'NON_PART_OF_DIRECTIVE_IN_PART',
"The part-of directive must be the only directive in a part.",
- correction:
+ correctionMessage:
"Try removing the other directives, or moving them to the library for which this is a part.",
);
static const ParserErrorCode NON_STRING_LITERAL_AS_URI = ParserErrorCode(
'NON_STRING_LITERAL_AS_URI',
"The URI must be a string literal.",
- correction: "Try enclosing the URI in either single or double quotes.",
+ correctionMessage:
+ "Try enclosing the URI in either single or double quotes.",
);
/**
@@ -1381,7 +1394,7 @@
ParserErrorCode(
'NORMAL_BEFORE_OPTIONAL_PARAMETERS',
"Normal parameters must occur before optional parameters.",
- correction:
+ correctionMessage:
"Try moving all of the normal parameters before the optional parameters.",
);
@@ -1389,7 +1402,7 @@
ParserErrorCode(
'NULL_AWARE_CASCADE_OUT_OF_ORDER',
"The '?..' cascade operator must be first in the cascade sequence.",
- correction:
+ correctionMessage:
"Try moving the '?..' operator to be the first cascade operator in the sequence.",
);
@@ -1397,7 +1410,7 @@
ParserErrorCode(
'POSITIONAL_AFTER_NAMED_ARGUMENT',
"Positional arguments must occur before named arguments.",
- correction:
+ correctionMessage:
"Try moving all of the positional arguments before the named arguments.",
);
@@ -1405,20 +1418,21 @@
ParserErrorCode(
'POSITIONAL_PARAMETER_OUTSIDE_GROUP',
"Positional parameters must be enclosed in square brackets ('[' and ']').",
- correction: "Try surrounding the positional parameters in square brackets.",
+ correctionMessage:
+ "Try surrounding the positional parameters in square brackets.",
);
static const ParserErrorCode PREFIX_AFTER_COMBINATOR = ParserErrorCode(
'PREFIX_AFTER_COMBINATOR',
"The prefix ('as' clause) should come before any show/hide combinators.",
- correction: "Try moving the prefix before the combinators.",
+ correctionMessage: "Try moving the prefix before the combinators.",
);
static const ParserErrorCode REDIRECTING_CONSTRUCTOR_WITH_BODY =
ParserErrorCode(
'REDIRECTING_CONSTRUCTOR_WITH_BODY',
"Redirecting constructors can't have a body.",
- correction:
+ correctionMessage:
"Try removing the body, or not making this a redirecting constructor.",
);
@@ -1426,104 +1440,105 @@
ParserErrorCode(
'REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR',
"Only factory constructor can specify '=' redirection.",
- correction:
+ correctionMessage:
"Try making this a factory constructor, or remove the redirection.",
);
static const ParserErrorCode SETTER_CONSTRUCTOR = ParserErrorCode(
'SETTER_CONSTRUCTOR',
"Constructors can't be a setter.",
- correction: "Try removing 'set'.",
+ correctionMessage: "Try removing 'set'.",
);
static const ParserErrorCode SETTER_IN_FUNCTION = ParserErrorCode(
'SETTER_IN_FUNCTION',
"Setters can't be defined within methods or functions.",
- correction: "Try moving the setter outside the method or function.",
+ correctionMessage: "Try moving the setter outside the method or function.",
);
static const ParserErrorCode STACK_OVERFLOW = ParserErrorCode(
'STACK_OVERFLOW',
"The file has too many nested expressions or statements.",
- correction: "Try simplifying the code.",
+ correctionMessage: "Try simplifying the code.",
);
static const ParserErrorCode STATIC_CONSTRUCTOR = ParserErrorCode(
'STATIC_CONSTRUCTOR',
"Constructors can't be static.",
- correction: "Try removing the keyword 'static'.",
+ correctionMessage: "Try removing the keyword 'static'.",
);
static const ParserErrorCode STATIC_GETTER_WITHOUT_BODY = ParserErrorCode(
'STATIC_GETTER_WITHOUT_BODY',
"A 'static' getter must have a body.",
- correction:
+ correctionMessage:
"Try adding a body to the getter, or removing the keyword 'static'.",
);
static const ParserErrorCode STATIC_OPERATOR = ParserErrorCode(
'STATIC_OPERATOR',
"Operators can't be static.",
- correction: "Try removing the keyword 'static'.",
+ correctionMessage: "Try removing the keyword 'static'.",
);
static const ParserErrorCode STATIC_SETTER_WITHOUT_BODY = ParserErrorCode(
'STATIC_SETTER_WITHOUT_BODY',
"A 'static' setter must have a body.",
- correction:
+ correctionMessage:
"Try adding a body to the setter, or removing the keyword 'static'.",
);
static const ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = ParserErrorCode(
'STATIC_TOP_LEVEL_DECLARATION',
"Top-level declarations can't be declared to be static.",
- correction: "Try removing the keyword 'static'.",
+ correctionMessage: "Try removing the keyword 'static'.",
);
static const ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE =
ParserErrorCode(
'SWITCH_HAS_CASE_AFTER_DEFAULT_CASE',
"The default case should be the last case in a switch statement.",
- correction: "Try moving the default case after the other case clauses.",
+ correctionMessage:
+ "Try moving the default case after the other case clauses.",
);
static const ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES =
ParserErrorCode(
'SWITCH_HAS_MULTIPLE_DEFAULT_CASES',
"The 'default' case can only be declared once.",
- correction: "Try removing all but one default case.",
+ correctionMessage: "Try removing all but one default case.",
);
static const ParserErrorCode TOP_LEVEL_OPERATOR = ParserErrorCode(
'TOP_LEVEL_OPERATOR',
"Operators must be declared within a class.",
- correction:
+ correctionMessage:
"Try removing the operator, moving it to a class, or converting it to be a function.",
);
static const ParserErrorCode TYPEDEF_IN_CLASS = ParserErrorCode(
'TYPEDEF_IN_CLASS',
"Typedefs can't be declared inside classes.",
- correction: "Try moving the typedef to the top-level.",
+ correctionMessage: "Try moving the typedef to the top-level.",
);
static const ParserErrorCode TYPE_ARGUMENTS_ON_TYPE_VARIABLE =
ParserErrorCode(
'TYPE_ARGUMENTS_ON_TYPE_VARIABLE',
"Can't use type arguments with type variable '{0}'.",
- correction: "Try removing the type arguments.",
+ correctionMessage: "Try removing the type arguments.",
);
static const ParserErrorCode TYPE_BEFORE_FACTORY = ParserErrorCode(
'TYPE_BEFORE_FACTORY',
"Factory constructors cannot have a return type.",
- correction: "Try removing the type appearing before 'factory'.",
+ correctionMessage: "Try removing the type appearing before 'factory'.",
);
static const ParserErrorCode TYPE_PARAMETER_ON_CONSTRUCTOR = ParserErrorCode(
'TYPE_PARAMETER_ON_CONSTRUCTOR',
"Constructors can't have type parameters.",
- correction: "Try removing the type parameters.",
+ correctionMessage: "Try removing the type parameters.",
);
/**
@@ -1533,7 +1548,7 @@
static const ParserErrorCode TYPE_PARAMETER_ON_OPERATOR = ParserErrorCode(
'TYPE_PARAMETER_ON_OPERATOR',
"Types parameters aren't allowed when defining an operator.",
- correction: "Try removing the type parameters.",
+ correctionMessage: "Try removing the type parameters.",
);
/**
@@ -1544,7 +1559,7 @@
ParserErrorCode(
'UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP',
"There is no '{0}' to open a parameter group.",
- correction: "Try inserting the '{0}' at the appropriate location.",
+ correctionMessage: "Try inserting the '{0}' at the appropriate location.",
);
/**
@@ -1554,13 +1569,13 @@
static const ParserErrorCode UNEXPECTED_TOKEN = ParserErrorCode(
'UNEXPECTED_TOKEN',
"Unexpected text '{0}'.",
- correction: "Try removing the text.",
+ correctionMessage: "Try removing the text.",
);
static const ParserErrorCode VAR_AND_TYPE = ParserErrorCode(
'VAR_AND_TYPE',
"Variables can't be declared using both 'var' and a type name.",
- correction: "Try removing 'var.'",
+ correctionMessage: "Try removing 'var.'",
);
static const ParserErrorCode VAR_AS_TYPE_NAME = ParserErrorCode(
@@ -1571,46 +1586,46 @@
static const ParserErrorCode VAR_CLASS = ParserErrorCode(
'VAR_CLASS',
"Classes can't be declared to be 'var'.",
- correction: "Try removing the keyword 'var'.",
+ correctionMessage: "Try removing the keyword 'var'.",
);
static const ParserErrorCode VAR_ENUM = ParserErrorCode(
'VAR_ENUM',
"Enums can't be declared to be 'var'.",
- correction: "Try removing the keyword 'var'.",
+ correctionMessage: "Try removing the keyword 'var'.",
);
static const ParserErrorCode VAR_RETURN_TYPE = ParserErrorCode(
'VAR_RETURN_TYPE',
"The return type can't be 'var'.",
- correction:
+ correctionMessage:
"Try removing the keyword 'var', or replacing it with the name of the return type.",
);
static const ParserErrorCode VAR_TYPEDEF = ParserErrorCode(
'VAR_TYPEDEF',
"Typedefs can't be declared to be 'var'.",
- correction:
+ correctionMessage:
"Try removing the keyword 'var', or replacing it with the name of the return type.",
);
static const ParserErrorCode VOID_WITH_TYPE_ARGUMENTS = ParserErrorCode(
'VOID_WITH_TYPE_ARGUMENTS',
"Type 'void' can't have type arguments.",
- correction: "Try removing the type arguments.",
+ correctionMessage: "Try removing the type arguments.",
);
static const ParserErrorCode WITH_BEFORE_EXTENDS = ParserErrorCode(
'WITH_BEFORE_EXTENDS',
"The extends clause must be before the with clause.",
- correction: "Try moving the extends clause before the with clause.",
+ correctionMessage: "Try moving the extends clause before the with clause.",
);
static const ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER =
ParserErrorCode(
'WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER',
"The default value of a positional parameter should be preceded by '='.",
- correction: "Try replacing the ':' with '='.",
+ correctionMessage: "Try replacing the ':' with '='.",
);
/**
@@ -1622,23 +1637,23 @@
ParserErrorCode(
'WRONG_TERMINATOR_FOR_PARAMETER_GROUP',
"Expected '{0}' to close parameter group.",
- correction: "Try replacing '{0}' with '{1}'.",
+ correctionMessage: "Try replacing '{0}' with '{1}'.",
);
/// Initialize a newly created error code to have the given [name].
const ParserErrorCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'ParserErrorCode.${uniqueName ?? name}',
);
diff --git a/pkg/analyzer/lib/src/dart/error/todo_codes.dart b/pkg/analyzer/lib/src/dart/error/todo_codes.dart
index e1f955a..175ed0a 100644
--- a/pkg/analyzer/lib/src/dart/error/todo_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/todo_codes.dart
@@ -83,7 +83,7 @@
*/
const TodoCode(String name)
: super(
- message: "{0}",
+ problemMessage: "{0}",
name: name,
uniqueName: 'TodoCode.$name',
);
diff --git a/pkg/analyzer/lib/src/error/analyzer_error_code.dart b/pkg/analyzer/lib/src/error/analyzer_error_code.dart
index 2b07046..5d99bf3 100644
--- a/pkg/analyzer/lib/src/error/analyzer_error_code.dart
+++ b/pkg/analyzer/lib/src/error/analyzer_error_code.dart
@@ -8,18 +8,18 @@
abstract class AnalyzerErrorCode extends ErrorCode {
/// Initialize a newly created error code.
const AnalyzerErrorCode({
- String? correction,
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
- required String message,
required String name,
+ required String problemMessage,
required String uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: uniqueName,
);
}
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index eb89966..38bf0a3 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -66,7 +66,7 @@
CompileTimeErrorCode(
'ABSTRACT_FIELD_INITIALIZER',
"Abstract fields can't have initializers.",
- correction:
+ correctionMessage:
"Try removing the field initializer or the 'abstract' keyword from the field declaration.",
hasPublishedDocs: true,
uniqueName: 'ABSTRACT_FIELD_CONSTRUCTOR_INITIALIZER',
@@ -79,7 +79,8 @@
CompileTimeErrorCode(
'ABSTRACT_FIELD_INITIALIZER',
"Abstract fields can't have initializers.",
- correction: "Try removing the initializer or the 'abstract' keyword.",
+ correctionMessage:
+ "Try removing the initializer or the 'abstract' keyword.",
hasPublishedDocs: true,
);
@@ -175,7 +176,7 @@
static const CompileTimeErrorCode AMBIGUOUS_EXPORT = CompileTimeErrorCode(
'AMBIGUOUS_EXPORT',
"The name '{0}' is defined in the libraries '{1}' and '{2}'.",
- correction:
+ correctionMessage:
"Try removing the export of one of the libraries, or explicitly hiding the name in one of the export directives.",
hasPublishedDocs: true,
);
@@ -244,7 +245,7 @@
CompileTimeErrorCode(
'AMBIGUOUS_EXTENSION_MEMBER_ACCESS',
"A member named '{0}' is defined in extensions {1}, and none are more specific.",
- correction:
+ correctionMessage:
"Try using an extension override to specify the extension you want to be chosen.",
hasPublishedDocs: true,
);
@@ -321,7 +322,7 @@
static const CompileTimeErrorCode AMBIGUOUS_IMPORT = CompileTimeErrorCode(
'AMBIGUOUS_IMPORT',
"The name '{0}' is defined in the libraries {1}.",
- correction:
+ correctionMessage:
"Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.",
hasPublishedDocs: true,
);
@@ -381,7 +382,7 @@
CompileTimeErrorCode(
'AMBIGUOUS_SET_OR_MAP_LITERAL_BOTH',
"The literal can't be either a map or a set because it contains at least one literal map entry or a spread operator spreading a 'Map', and at least one element which is neither of these.",
- correction:
+ correctionMessage:
"Try removing or changing some of the elements so that all of the elements are consistent.",
hasPublishedDocs: true,
);
@@ -461,7 +462,7 @@
CompileTimeErrorCode(
'AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER',
"This literal must be either a map or a set, but the elements don't have enough information for type inference to work.",
- correction:
+ correctionMessage:
"Try adding type arguments to the literal (one for sets, two for maps).",
hasPublishedDocs: true,
);
@@ -634,7 +635,7 @@
static const CompileTimeErrorCode ASSIGNMENT_TO_CONST = CompileTimeErrorCode(
'ASSIGNMENT_TO_CONST',
"Constant variables can't be assigned a value.",
- correction:
+ correctionMessage:
"Try removing the assignment, or remove the modifier 'const' from the variable.",
hasPublishedDocs: true,
);
@@ -680,7 +681,8 @@
static const CompileTimeErrorCode ASSIGNMENT_TO_FINAL = CompileTimeErrorCode(
'ASSIGNMENT_TO_FINAL',
"'{0}' can't be used as a setter because it's final.",
- correction: "Try finding a different setter, or making '{0}' non-final.",
+ correctionMessage:
+ "Try finding a different setter, or making '{0}' non-final.",
hasPublishedDocs: true,
);
@@ -721,7 +723,7 @@
CompileTimeErrorCode(
'ASSIGNMENT_TO_FINAL_LOCAL',
"The final variable '{0}' can only be set once.",
- correction: "Try making '{0}' non-final.",
+ correctionMessage: "Try making '{0}' non-final.",
hasPublishedDocs: true,
);
@@ -783,7 +785,7 @@
CompileTimeErrorCode(
'ASSIGNMENT_TO_FINAL_NO_SETTER',
"There isn’t a setter named '{0}' in class '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to reference an existing setter, or declare the setter.",
hasPublishedDocs: true,
);
@@ -972,7 +974,7 @@
CompileTimeErrorCode(
'ASYNC_FOR_IN_WRONG_CONTEXT',
"The async for-in loop can only be used in an async function.",
- correction:
+ correctionMessage:
"Try marking the function body with either 'async' or 'async*', or removing the 'await' before the for-in loop.",
hasPublishedDocs: true,
);
@@ -1020,7 +1022,7 @@
CompileTimeErrorCode(
'AWAIT_IN_LATE_LOCAL_VARIABLE_INITIALIZER',
"The 'await' expression can't be used in a 'late' local variable's initializer.",
- correction:
+ correctionMessage:
"Try removing the 'late' modifier, or rewriting the initializer without using the 'await' expression.",
hasPublishedDocs: true,
);
@@ -1034,7 +1036,7 @@
CompileTimeErrorCode(
'AWAIT_IN_WRONG_CONTEXT',
"The await expression can only be used in an async function.",
- correction:
+ correctionMessage:
"Try marking the function body with either 'async' or 'async*'.",
);
@@ -1114,7 +1116,8 @@
CompileTimeErrorCode(
'BODY_MIGHT_COMPLETE_NORMALLY',
"The body might complete normally, causing 'null' to be returned, but the return type is a potentially non-nullable type.",
- correction: "Try adding either a return or a throw statement at the end.",
+ correctionMessage:
+ "Try adding either a return or a throw statement at the end.",
hasPublishedDocs: true,
);
@@ -1205,7 +1208,7 @@
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as an extension name.",
- correction: "Try choosing a different name for the extension.",
+ correctionMessage: "Try choosing a different name for the extension.",
hasPublishedDocs: true,
uniqueName: 'BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME',
);
@@ -1218,7 +1221,7 @@
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a prefix name.",
- correction: "Try choosing a different name for the prefix.",
+ correctionMessage: "Try choosing a different name for the prefix.",
hasPublishedDocs: true,
uniqueName: 'BUILT_IN_IDENTIFIER_AS_PREFIX_NAME',
);
@@ -1252,7 +1255,7 @@
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_AS_TYPE',
"The built-in identifier '{0}' can't be used as a type.",
- correction: "Try correcting the name to match an existing type.",
+ correctionMessage: "Try correcting the name to match an existing type.",
hasPublishedDocs: true,
);
@@ -1264,7 +1267,7 @@
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a typedef name.",
- correction: "Try choosing a different name for the typedef.",
+ correctionMessage: "Try choosing a different name for the typedef.",
hasPublishedDocs: true,
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME',
);
@@ -1277,7 +1280,7 @@
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a type name.",
- correction: "Try choosing a different name for the type.",
+ correctionMessage: "Try choosing a different name for the type.",
hasPublishedDocs: true,
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_NAME',
);
@@ -1290,7 +1293,7 @@
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a type parameter name.",
- correction: "Try choosing a different name for the type parameter.",
+ correctionMessage: "Try choosing a different name for the type parameter.",
hasPublishedDocs: true,
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME',
);
@@ -1341,7 +1344,7 @@
CompileTimeErrorCode(
'CASE_BLOCK_NOT_TERMINATED',
"The last statement of the 'case' should be 'break', 'continue', 'rethrow', 'return', or 'throw'.",
- correction: "Try adding one of the required statements.",
+ correctionMessage: "Try adding one of the required statements.",
hasPublishedDocs: true,
);
@@ -1537,7 +1540,7 @@
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.",
- correction:
+ correctionMessage:
"Try changing the name to the name of an existing type, or creating a type with the name '{0}'.",
hasPublishedDocs: true,
);
@@ -1550,7 +1553,8 @@
CLASS_INSTANTIATION_ACCESS_TO_INSTANCE_MEMBER = CompileTimeErrorCode(
'CLASS_INSTANTIATION_ACCESS_TO_MEMBER',
"The instance member '{0}' can't be accessed on a class instantiation.",
- correction: "Try changing the member name to the name of a constructor.",
+ correctionMessage:
+ "Try changing the member name to the name of a constructor.",
uniqueName: 'CLASS_INSTANTIATION_ACCESS_TO_INSTANCE_MEMBER',
);
@@ -1562,7 +1566,7 @@
CLASS_INSTANTIATION_ACCESS_TO_STATIC_MEMBER = CompileTimeErrorCode(
'CLASS_INSTANTIATION_ACCESS_TO_MEMBER',
"The static member '{0}' can't be accessed on a class instantiation.",
- correction:
+ correctionMessage:
"Try removing the type arguments from the class name, or changing the member name to the name of a constructor.",
uniqueName: 'CLASS_INSTANTIATION_ACCESS_TO_STATIC_MEMBER',
);
@@ -1575,7 +1579,7 @@
CLASS_INSTANTIATION_ACCESS_TO_UNKNOWN_MEMBER = CompileTimeErrorCode(
'CLASS_INSTANTIATION_ACCESS_TO_MEMBER',
"The class '{0} doesn't have a constructor named '{1}.",
- correction:
+ correctionMessage:
"Try invoking a different constructor, or defining a constructor named '{1}'.",
uniqueName: 'CLASS_INSTANTIATION_ACCESS_TO_UNKNOWN_MEMBER',
);
@@ -1625,7 +1629,7 @@
CompileTimeErrorCode(
'CONCRETE_CLASS_WITH_ABSTRACT_MEMBER',
"'{0}' must have a method body because '{1}' isn't abstract.",
- correction: "Try making '{1}' abstract, or adding a body to '{0}'.",
+ correctionMessage: "Try making '{1}' abstract, or adding a body to '{0}'.",
hasPublishedDocs: true,
);
@@ -1669,7 +1673,7 @@
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
"'{0}' can't be used to name both a constructor and a static field in this class.",
- correction: "Try renaming either the constructor or the field.",
+ correctionMessage: "Try renaming either the constructor or the field.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD',
);
@@ -1682,7 +1686,7 @@
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
"'{0}' can't be used to name both a constructor and a static getter in this class.",
- correction: "Try renaming either the constructor or the getter.",
+ correctionMessage: "Try renaming either the constructor or the getter.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_GETTER',
);
@@ -1695,7 +1699,7 @@
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
"'{0}' can't be used to name both a constructor and a static method in this class.",
- correction: "Try renaming either the constructor or the method.",
+ correctionMessage: "Try renaming either the constructor or the method.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_METHOD',
);
@@ -1708,7 +1712,7 @@
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
"'{0}' can't be used to name both a constructor and a static setter in this class.",
- correction: "Try renaming either the constructor or the setter.",
+ correctionMessage: "Try renaming either the constructor or the setter.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_SETTER',
);
@@ -1727,7 +1731,7 @@
CompileTimeErrorCode(
'CONFLICTING_FIELD_AND_METHOD',
"Class '{0}' can't define field '{1}' and have method '{2}.{1}' with the same name.",
- correction:
+ correctionMessage:
"Try converting the getter to a method, or renaming the field to a name that doesn't conflict.",
);
@@ -1789,7 +1793,7 @@
CompileTimeErrorCode(
'CONFLICTING_METHOD_AND_FIELD',
"Class '{0}' can't define method '{1}' and have field '{2}.{1}' with the same name.",
- correction:
+ correctionMessage:
"Try converting the method to a getter, or renaming the method to a name that doesn't conflict.",
);
@@ -1807,7 +1811,8 @@
CompileTimeErrorCode(
'CONFLICTING_STATIC_AND_INSTANCE',
"Class '{0}' can't define static member '{1}' and have instance member '{2}.{1}' with the same name.",
- correction: "Try renaming the member to a name that doesn't conflict.",
+ correctionMessage:
+ "Try renaming the member to a name that doesn't conflict.",
);
/**
@@ -1840,7 +1845,7 @@
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
"'{0}' can't be used to name both a type variable and the class in which the type variable is defined.",
- correction: "Try renaming either the type variable or the class.",
+ correctionMessage: "Try renaming either the type variable or the class.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_CLASS',
);
@@ -1853,7 +1858,8 @@
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
"'{0}' can't be used to name both a type variable and the extension in which the type variable is defined.",
- correction: "Try renaming either the type variable or the extension.",
+ correctionMessage:
+ "Try renaming either the type variable or the extension.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_EXTENSION',
);
@@ -1892,7 +1898,7 @@
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
"'{0}' can't be used to name both a type variable and a member in this class.",
- correction: "Try renaming either the type variable or the member.",
+ correctionMessage: "Try renaming either the type variable or the member.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS',
);
@@ -1905,7 +1911,7 @@
CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION = CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
"'{0}' can't be used to name both a type variable and a member in this extension.",
- correction: "Try renaming either the type variable or the member.",
+ correctionMessage: "Try renaming either the type variable or the member.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION',
);
@@ -1918,7 +1924,7 @@
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
"'{0}' can't be used to name both a type variable and a member in this mixin.",
- correction: "Try renaming either the type variable or the member.",
+ correctionMessage: "Try renaming either the type variable or the member.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_MIXIN',
);
@@ -1931,7 +1937,7 @@
CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
"'{0}' can't be used to name both a type variable and the mixin in which the type variable is defined.",
- correction: "Try renaming either the type variable or the mixin.",
+ correctionMessage: "Try renaming either the type variable or the mixin.",
hasPublishedDocs: true,
uniqueName: 'CONFLICTING_TYPE_VARIABLE_AND_MIXIN',
);
@@ -1944,7 +1950,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH',
"In a const constructor, a value of type '{0}' can't be assigned to the field '{1}', which has type '{2}'.",
- correction: "Try using a subtype, or removing the keyword 'const'.",
+ correctionMessage: "Try using a subtype, or removing the keyword 'const'.",
);
/**
@@ -1998,7 +2004,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH',
"A value of type '{0}' can't be assigned to a parameter of type '{1}' in a const constructor.",
- correction: "Try using a subtype, or removing the keyword 'const'.",
+ correctionMessage: "Try using a subtype, or removing the keyword 'const'.",
hasPublishedDocs: true,
);
@@ -2010,7 +2016,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_THROWS_EXCEPTION',
"Const constructors can't throw exceptions.",
- correction:
+ correctionMessage:
"Try removing the throw statement, or removing the keyword 'const'.",
);
@@ -2061,7 +2067,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST',
"Can't define the 'const' constructor because the field '{0}' is initialized with a non-constant value.",
- correction:
+ correctionMessage:
"Try initializing the field to a constant value, or removing the keyword 'const' from the constructor.",
hasPublishedDocs: true,
);
@@ -2084,7 +2090,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD',
"This constructor can't be declared 'const' because a mixin adds the instance field: {0}.",
- correction:
+ correctionMessage:
"Try removing the 'const' keyword or removing the 'with' clause from the class declaration, or removing the field from the mixin class.",
);
@@ -2106,7 +2112,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD',
"This constructor can't be declared 'const' because the mixins add the instance fields: {0}.",
- correction:
+ correctionMessage:
"Try removing the 'const' keyword or removing the 'with' clause from the class declaration, or removing the fields from the mixin classes.",
uniqueName: 'CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELDS',
);
@@ -2186,7 +2192,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER',
"A constant constructor can't call a non-constant super constructor of '{0}'.",
- correction:
+ correctionMessage:
"Try calling a constant constructor in the superclass, or removing the keyword 'const' from the constructor.",
hasPublishedDocs: true,
);
@@ -2239,7 +2245,7 @@
CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD',
"Can't define a const constructor for a class with non-final fields.",
- correction:
+ correctionMessage:
"Try making all of the fields final, or removing the keyword 'const' from the constructor.",
hasPublishedDocs: true,
);
@@ -2290,7 +2296,7 @@
static const CompileTimeErrorCode CONST_DEFERRED_CLASS = CompileTimeErrorCode(
'CONST_DEFERRED_CLASS',
"Deferred classes can't be created with 'const'.",
- correction:
+ correctionMessage:
"Try using 'new' to create the instance, or changing the import to not be deferred.",
hasPublishedDocs: true,
);
@@ -2382,7 +2388,7 @@
CompileTimeErrorCode(
'FIELD_INITIALIZER_NOT_ASSIGNABLE',
"The initializer type '{0}' can't be assigned to the field type '{1}' in a const constructor.",
- correction: "Try using a subtype, or removing the 'const' keyword",
+ correctionMessage: "Try using a subtype, or removing the 'const' keyword",
hasPublishedDocs: true,
uniqueName: 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE',
);
@@ -2427,7 +2433,8 @@
CompileTimeErrorCode(
'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE',
"Const variables must be initialized with a constant value.",
- correction: "Try changing the initializer to be a constant expression.",
+ correctionMessage:
+ "Try changing the initializer to be a constant expression.",
hasPublishedDocs: true,
);
@@ -2478,7 +2485,7 @@
CompileTimeErrorCode(
'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used to initialize a 'const' variable.",
- correction:
+ correctionMessage:
"Try initializing the variable without referencing members of the deferred library, or changing the import to not be deferred.",
hasPublishedDocs: true,
);
@@ -2523,7 +2530,7 @@
static const CompileTimeErrorCode CONST_INSTANCE_FIELD = CompileTimeErrorCode(
'CONST_INSTANCE_FIELD',
"Only static fields can be declared as const.",
- correction:
+ correctionMessage:
"Try declaring the field as final, or adding the keyword 'static'.",
hasPublishedDocs: true,
);
@@ -2584,7 +2591,7 @@
CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = CompileTimeErrorCode(
'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS',
"The type of a key in a constant map can't override the '==' operator, but the class '{0}' does.",
- correction:
+ correctionMessage:
"Try using a different value for the key, or removing the keyword 'const' from the map.",
hasPublishedDocs: true,
);
@@ -2617,7 +2624,7 @@
CompileTimeErrorCode(
'CONST_NOT_INITIALIZED',
"The constant '{0}' must be initialized.",
- correction: "Try adding an initialization to the declaration.",
+ correctionMessage: "Try adding an initialization to the declaration.",
hasPublishedDocs: true,
);
@@ -2677,7 +2684,7 @@
CompileTimeErrorCode(
'CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS',
"The type of an element in a constant set can't override the '==' operator, but the type '{0}' does.",
- correction:
+ correctionMessage:
"Try using a different value for the element, or removing the keyword 'const' from the set.",
hasPublishedDocs: true,
);
@@ -2801,7 +2808,7 @@
static const CompileTimeErrorCode CONST_WITH_NON_CONST = CompileTimeErrorCode(
'CONST_WITH_NON_CONST',
"The constructor being called isn't a const constructor.",
- correction: "Try removing 'const' from the constructor invocation.",
+ correctionMessage: "Try removing 'const' from the constructor invocation.",
hasPublishedDocs: true,
);
@@ -2841,7 +2848,7 @@
CompileTimeErrorCode(
'CONST_WITH_NON_CONSTANT_ARGUMENT',
"Arguments of a constant creation must be constant expressions.",
- correction:
+ correctionMessage:
"Try making the argument a valid constant, or use 'new' to call the constructor.",
hasPublishedDocs: true,
);
@@ -2853,7 +2860,7 @@
static const CompileTimeErrorCode CONST_WITH_NON_TYPE = CompileTimeErrorCode(
'CREATION_WITH_NON_TYPE',
"The name '{0}' isn't a class.",
- correction: "Try correcting the name to match an existing class.",
+ correctionMessage: "Try correcting the name to match an existing class.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
uniqueName: 'CONST_WITH_NON_TYPE',
@@ -2909,7 +2916,8 @@
CompileTimeErrorCode(
'CONST_WITH_TYPE_PARAMETERS',
"A constant creation can't use a type parameter as a type argument.",
- correction: "Try replacing the type parameter with a different type.",
+ correctionMessage:
+ "Try replacing the type parameter with a different type.",
hasPublishedDocs: true,
);
@@ -2920,7 +2928,8 @@
CONST_WITH_TYPE_PARAMETERS_CONSTRUCTOR_TEAROFF = CompileTimeErrorCode(
'CONST_WITH_TYPE_PARAMETERS',
"A constant constructor tearoff can't use a type parameter as a type argument.",
- correction: "Try replacing the type parameter with a different type.",
+ correctionMessage:
+ "Try replacing the type parameter with a different type.",
hasPublishedDocs: true,
uniqueName: 'CONST_WITH_TYPE_PARAMETERS_CONSTRUCTOR_TEAROFF',
);
@@ -2932,7 +2941,8 @@
CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF = CompileTimeErrorCode(
'CONST_WITH_TYPE_PARAMETERS',
"A constant function tearoff can't use a type parameter as a type argument.",
- correction: "Try replacing the type parameter with a different type.",
+ correctionMessage:
+ "Try replacing the type parameter with a different type.",
hasPublishedDocs: true,
uniqueName: 'CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF',
);
@@ -2949,7 +2959,7 @@
CompileTimeErrorCode(
'CONST_WITH_UNDEFINED_CONSTRUCTOR',
"The class '{0}' doesn't have a constant constructor '{1}'.",
- correction: "Try calling a different constructor.",
+ correctionMessage: "Try calling a different constructor.",
);
/**
@@ -2963,7 +2973,7 @@
CompileTimeErrorCode(
'CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
"The class '{0}' doesn't have an unnamed constant constructor.",
- correction: "Try calling a different constructor.",
+ correctionMessage: "Try calling a different constructor.",
);
static const CompileTimeErrorCode CONTINUE_LABEL_ON_SWITCH =
@@ -3025,7 +3035,8 @@
CompileTimeErrorCode(
'DEFAULT_LIST_CONSTRUCTOR',
"The default 'List' constructor isn't available when null safety is enabled.",
- correction: "Try using a list literal, 'List.filled' or 'List.generate'.",
+ correctionMessage:
+ "Try using a list literal, 'List.filled' or 'List.generate'.",
hasPublishedDocs: true,
);
@@ -3084,7 +3095,7 @@
DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR = CompileTimeErrorCode(
'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR',
"Default values aren't allowed in factory constructors that redirect to another constructor.",
- correction: "Try removing the default value.",
+ correctionMessage: "Try removing the default value.",
hasPublishedDocs: true,
);
@@ -3124,7 +3135,7 @@
CompileTimeErrorCode(
'DEFAULT_VALUE_ON_REQUIRED_PARAMETER',
"Required named parameters can't have a default value.",
- correction:
+ correctionMessage:
"Try removing either the default value or the 'required' modifier.",
);
@@ -3208,7 +3219,7 @@
CompileTimeErrorCode(
'DEFERRED_IMPORT_OF_EXTENSION',
"Imports of deferred libraries must hide all extensions.",
- correction:
+ correctionMessage:
"Try adding either a show combinator listing the names you need to reference or a hide combinator listing all of the extensions.",
hasPublishedDocs: true,
);
@@ -3250,7 +3261,8 @@
CompileTimeErrorCode(
'DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE',
"The late local variable '{0}' is definitely unassigned at this point.",
- correction: "Ensure that it is assigned on necessary execution paths.",
+ correctionMessage:
+ "Ensure that it is assigned on necessary execution paths.",
hasPublishedDocs: true,
);
@@ -3261,7 +3273,7 @@
CompileTimeErrorCode(
'DISALLOWED_TYPE_INSTANTIATION_EXPRESSION',
"Only a generic type, generic function, generic instance method, or generic constructor can be type instantiated.",
- correction:
+ correctionMessage:
"Try instantiating the type(s) of a generic type, generic function, generic instance method, or generic constructor.",
);
@@ -3343,7 +3355,7 @@
CompileTimeErrorCode(
'DUPLICATE_CONSTRUCTOR',
"The unnamed constructor is already defined.",
- correction: "Try giving one of the constructors a name.",
+ correctionMessage: "Try giving one of the constructors a name.",
hasPublishedDocs: true,
uniqueName: 'DUPLICATE_CONSTRUCTOR_DEFAULT',
);
@@ -3356,7 +3368,7 @@
CompileTimeErrorCode(
'DUPLICATE_CONSTRUCTOR',
"The constructor with name '{0}' is already defined.",
- correction: "Try renaming one of the constructors.",
+ correctionMessage: "Try renaming one of the constructors.",
hasPublishedDocs: true,
uniqueName: 'DUPLICATE_CONSTRUCTOR_NAME',
);
@@ -3391,7 +3403,7 @@
static const CompileTimeErrorCode DUPLICATE_DEFINITION = CompileTimeErrorCode(
'DUPLICATE_DEFINITION',
"The name '{0}' is already defined.",
- correction: "Try renaming one of the declarations.",
+ correctionMessage: "Try renaming one of the declarations.",
hasPublishedDocs: true,
);
@@ -3433,7 +3445,7 @@
CompileTimeErrorCode(
'DUPLICATE_FIELD_FORMAL_PARAMETER',
"The field '{0}' can't be initialized by multiple parameters in the same constructor.",
- correction:
+ correctionMessage:
"Try removing one of the parameters, or using different fields.",
hasPublishedDocs: true,
);
@@ -3494,7 +3506,7 @@
CompileTimeErrorCode(
'DUPLICATE_NAMED_ARGUMENT',
"The argument for the named parameter '{0}' was already specified.",
- correction:
+ correctionMessage:
"Try removing one of the named arguments, or correcting one of the names to reference a different named parameter.",
hasPublishedDocs: true,
);
@@ -3539,7 +3551,7 @@
static const CompileTimeErrorCode DUPLICATE_PART = CompileTimeErrorCode(
'DUPLICATE_PART',
"The library already contains a part with the URI '{0}'.",
- correction:
+ correctionMessage:
"Try removing all except one of the duplicated part directives.",
hasPublishedDocs: true,
);
@@ -3548,7 +3560,7 @@
CompileTimeErrorCode(
'ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING',
"The name of the enum constant can't be the same as the enum's name.",
- correction: "Try renaming the constant.",
+ correctionMessage: "Try renaming the constant.",
);
/**
@@ -3584,7 +3596,7 @@
CompileTimeErrorCode(
'EQUAL_ELEMENTS_IN_CONST_SET',
"Two elements in a constant set literal can't be equal.",
- correction: "Change or remove the duplicate element.",
+ correctionMessage: "Change or remove the duplicate element.",
hasPublishedDocs: true,
);
@@ -3630,7 +3642,7 @@
CompileTimeErrorCode(
'EQUAL_KEYS_IN_CONST_MAP',
"Two keys in a constant map literal can't be equal.",
- correction: "Change or remove the duplicate key.",
+ correctionMessage: "Change or remove the duplicate key.",
hasPublishedDocs: true,
);
@@ -3663,7 +3675,7 @@
CompileTimeErrorCode(
'EXPECTED_ONE_LIST_TYPE_ARGUMENTS',
"List literals require one type argument or none, but {0} found.",
- correction: "Try adjusting the number of type arguments.",
+ correctionMessage: "Try adjusting the number of type arguments.",
hasPublishedDocs: true,
);
@@ -3696,7 +3708,7 @@
CompileTimeErrorCode(
'EXPECTED_ONE_SET_TYPE_ARGUMENTS',
"Set literals require one type argument or none, but {0} were found.",
- correction: "Try adjusting the number of type arguments.",
+ correctionMessage: "Try adjusting the number of type arguments.",
hasPublishedDocs: true,
);
@@ -3729,7 +3741,7 @@
CompileTimeErrorCode(
'EXPECTED_TWO_MAP_TYPE_ARGUMENTS',
"Map literals require two type arguments or none, but {0} found.",
- correction: "Try adjusting the number of type arguments.",
+ correctionMessage: "Try adjusting the number of type arguments.",
hasPublishedDocs: true,
);
@@ -3813,7 +3825,8 @@
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 from a library with null safety enabled.",
- correction: "Try removing the export or migrating the legacy library.",
+ correctionMessage:
+ "Try removing the export or migrating the legacy library.",
hasPublishedDocs: true,
);
@@ -3852,7 +3865,7 @@
CompileTimeErrorCode(
'EXPORT_OF_NON_LIBRARY',
"The exported library '{0}' can't have a part-of directive.",
- correction: "Try exporting the library that the part is a part of.",
+ correctionMessage: "Try exporting the library that the part is a part of.",
hasPublishedDocs: true,
);
@@ -3884,7 +3897,7 @@
static const CompileTimeErrorCode EXPRESSION_IN_MAP = CompileTimeErrorCode(
'EXPRESSION_IN_MAP',
"Expressions can't be used in a map literal.",
- correction:
+ correctionMessage:
"Try removing the expression or converting it to be a map entry.",
hasPublishedDocs: true,
);
@@ -3935,7 +3948,7 @@
CompileTimeErrorCode(
'SUBTYPE_OF_DEFERRED_CLASS',
"Classes can't extend deferred classes.",
- correction:
+ correctionMessage:
"Try specifying a different superclass, or removing the extends clause.",
hasPublishedDocs: true,
uniqueName: 'EXTENDS_DEFERRED_CLASS',
@@ -4001,7 +4014,7 @@
CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
"Classes can't extend '{0}'.",
- correction:
+ correctionMessage:
"Try specifying a different superclass, or removing the extends clause.",
hasPublishedDocs: true,
uniqueName: 'EXTENDS_DISALLOWED_CLASS',
@@ -4050,7 +4063,7 @@
static const CompileTimeErrorCode EXTENDS_NON_CLASS = CompileTimeErrorCode(
'EXTENDS_NON_CLASS',
"Classes can only extend other classes.",
- correction:
+ correctionMessage:
"Try specifying a different superclass, or removing the extends clause.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
@@ -4090,7 +4103,7 @@
EXTENDS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
"A type alias that expands to a type parameter can't be used as a superclass.",
- correction:
+ correctionMessage:
"Try specifying a different superclass, or removing the extends clause.",
hasPublishedDocs: true,
uniqueName: 'EXTENDS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
@@ -4137,7 +4150,7 @@
CompileTimeErrorCode(
'EXTENSION_AS_EXPRESSION',
"Extension '{0}' can't be used as an expression.",
- correction: "Try replacing it with a valid expression.",
+ correctionMessage: "Try replacing it with a valid expression.",
hasPublishedDocs: true,
);
@@ -4180,7 +4193,8 @@
CompileTimeErrorCode(
'EXTENSION_CONFLICTING_STATIC_AND_INSTANCE',
"Extension '{0}' can't define static member '{1}' and an instance member with the same name.",
- correction: "Try renaming the member to a name that doesn't conflict.",
+ correctionMessage:
+ "Try renaming the member to a name that doesn't conflict.",
hasPublishedDocs: true,
);
@@ -4219,7 +4233,7 @@
CompileTimeErrorCode(
'EXTENSION_DECLARES_MEMBER_OF_OBJECT',
"Extensions can't declare members with the same name as a member declared by 'Object'.",
- correction: "Try specifying a different name for the member.",
+ correctionMessage: "Try specifying a different name for the member.",
hasPublishedDocs: true,
);
@@ -4264,7 +4278,7 @@
CompileTimeErrorCode(
'EXTENSION_OVERRIDE_ACCESS_TO_STATIC_MEMBER',
"An extension override can't be used to access a static member from an extension.",
- correction: "Try using just the name of the extension.",
+ correctionMessage: "Try using just the name of the extension.",
hasPublishedDocs: true,
);
@@ -4372,7 +4386,7 @@
CompileTimeErrorCode(
'EXTENSION_OVERRIDE_WITHOUT_ACCESS',
"An extension override can only be used to access instance members.",
- correction: "Consider adding an access to an instance member.",
+ correctionMessage: "Consider adding an access to an instance member.",
hasPublishedDocs: true,
);
@@ -4419,7 +4433,7 @@
CompileTimeErrorCode(
'EXTENSION_OVERRIDE_WITH_CASCADE',
"Extension overrides have no value so they can't be used as the receiver of a cascade expression.",
- correction: "Try using '.' instead of '..'.",
+ correctionMessage: "Try using '.' instead of '..'.",
hasPublishedDocs: true,
);
@@ -4427,7 +4441,7 @@
CompileTimeErrorCode(
'EXTERNAL_FIELD_CONSTRUCTOR_INITIALIZER',
"External fields cannot have initializers.",
- correction:
+ correctionMessage:
"Try removing the field initializer or the 'external' keyword from the field declaration.",
);
@@ -4435,14 +4449,16 @@
CompileTimeErrorCode(
'EXTERNAL_FIELD_INITIALIZER',
"External fields cannot have initializers.",
- correction: "Try removing the initializer or the 'external' keyword.",
+ correctionMessage:
+ "Try removing the initializer or the 'external' keyword.",
);
static const CompileTimeErrorCode EXTERNAL_VARIABLE_INITIALIZER =
CompileTimeErrorCode(
'EXTERNAL_VARIABLE_INITIALIZER',
"External variables cannot have initializers.",
- correction: "Try removing the initializer or the 'external' keyword.",
+ correctionMessage:
+ "Try removing the initializer or the 'external' keyword.",
);
/**
@@ -4481,7 +4497,7 @@
CompileTimeErrorCode(
'EXTRA_POSITIONAL_ARGUMENTS',
"Too many positional arguments: {0} expected, but {1} found.",
- correction: "Try removing the extra arguments.",
+ correctionMessage: "Try removing the extra arguments.",
hasPublishedDocs: true,
);
@@ -4537,7 +4553,7 @@
CompileTimeErrorCode(
'EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED',
"Too many positional arguments: {0} expected, but {1} found.",
- correction:
+ correctionMessage:
"Try removing the extra positional arguments, or specifying the name for named arguments.",
hasPublishedDocs: true,
);
@@ -4580,7 +4596,7 @@
CompileTimeErrorCode(
'FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS',
"The field '{0}' can't be initialized twice in the same constructor.",
- correction: "Try removing one of the initializations.",
+ correctionMessage: "Try removing one of the initializations.",
hasPublishedDocs: true,
);
@@ -4632,7 +4648,7 @@
FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = CompileTimeErrorCode(
'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION',
"Fields can't be initialized in the constructor if they are final and were already initialized at their declaration.",
- correction: "Try removing one of the initializations.",
+ correctionMessage: "Try removing one of the initializations.",
hasPublishedDocs: true,
);
@@ -4695,7 +4711,7 @@
FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = CompileTimeErrorCode(
'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER',
"Fields can't be initialized in both the parameter list and the initializers.",
- correction: "Try removing one of the initializations.",
+ correctionMessage: "Try removing one of the initializations.",
hasPublishedDocs: true,
);
@@ -4736,7 +4752,7 @@
CompileTimeErrorCode(
'FIELD_INITIALIZER_FACTORY_CONSTRUCTOR',
"Initializing formal parameters can't be used in factory constructors.",
- correction: "Try using a normal parameter.",
+ correctionMessage: "Try using a normal parameter.",
hasPublishedDocs: true,
);
@@ -4803,7 +4819,7 @@
CompileTimeErrorCode(
'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR',
"Initializing formal parameters can only be used in constructors.",
- correction: "Try using a normal parameter.",
+ correctionMessage: "Try using a normal parameter.",
);
/**
@@ -4877,7 +4893,7 @@
CompileTimeErrorCode(
'FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR',
"The redirecting constructor can't have a field initializer.",
- correction:
+ correctionMessage:
"Try initializing the field in the constructor being redirected to.",
hasPublishedDocs: true,
);
@@ -4946,7 +4962,7 @@
CompileTimeErrorCode(
'FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE',
"The parameter type '{0}' is incompatible with the field type '{1}'.",
- correction:
+ correctionMessage:
"Try changing or removing the parameter's type, or changing the field's type.",
hasPublishedDocs: true,
);
@@ -5000,7 +5016,7 @@
FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = CompileTimeErrorCode(
'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR',
"'{0}' is final and was given a value when it was declared, so it can't be set to a new value.",
- correction: "Try removing one of the initializations.",
+ correctionMessage: "Try removing one of the initializations.",
hasPublishedDocs: true,
);
@@ -5054,7 +5070,7 @@
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED',
"The final variable '{0}' must be initialized.",
- correction: "Try initializing the variable.",
+ correctionMessage: "Try initializing the variable.",
hasPublishedDocs: true,
);
@@ -5147,7 +5163,7 @@
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR',
"All final variables must be initialized, but '{0}' isn't.",
- correction: "Try adding an initializer for the field.",
+ correctionMessage: "Try adding an initializer for the field.",
hasPublishedDocs: true,
uniqueName: 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_1',
);
@@ -5161,7 +5177,7 @@
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR',
"All final variables must be initialized, but '{0}' and '{1}' aren't.",
- correction: "Try adding initializers for the fields.",
+ correctionMessage: "Try adding initializers for the fields.",
hasPublishedDocs: true,
uniqueName: 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_2',
);
@@ -5176,7 +5192,7 @@
CompileTimeErrorCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR',
"All final variables must be initialized, but '{0}', '{1}', and {2} others aren't.",
- correction: "Try adding initializers for the fields.",
+ correctionMessage: "Try adding initializers for the fields.",
hasPublishedDocs: true,
uniqueName: 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS',
);
@@ -5319,7 +5335,7 @@
CompileTimeErrorCode(
'FOR_IN_WITH_CONST_VARIABLE',
"A for-in loop variable can't be a 'const'.",
- correction:
+ correctionMessage:
"Try removing the 'const' modifier from the variable, or use a different variable.",
hasPublishedDocs: true,
);
@@ -5332,7 +5348,7 @@
CompileTimeErrorCode(
'GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND',
"Generic function types can't be used as type parameter bounds",
- correction:
+ correctionMessage:
"Try making the free variable in the function type part of the larger declaration signature",
);
@@ -5344,7 +5360,7 @@
GENERIC_FUNCTION_TYPE_CANNOT_BE_TYPE_ARGUMENT = CompileTimeErrorCode(
'GENERIC_FUNCTION_TYPE_CANNOT_BE_TYPE_ARGUMENT',
"A generic function type can't be a type argument.",
- correction:
+ correctionMessage:
"Try removing type parameters from the generic function type, or using 'dynamic' as the type argument here.",
);
@@ -5393,7 +5409,7 @@
GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC = CompileTimeErrorCode(
'GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC',
"A method tear-off on a receiver whose type is 'dynamic' can't have type arguments.",
- correction:
+ correctionMessage:
"Specify the type of the receiver, or remove the type arguments from the method tear-off.",
);
@@ -5408,7 +5424,7 @@
CompileTimeErrorCode(
'GETTER_NOT_ASSIGNABLE_SETTER_TYPES',
"The return type of getter '{0}' is '{1}' which isn't assignable to the type '{2}' of its setter '{3}'.",
- correction: "Try changing the types so that they are compatible.",
+ correctionMessage: "Try changing the types so that they are compatible.",
);
/**
@@ -5466,7 +5482,7 @@
CompileTimeErrorCode(
'GETTER_NOT_SUBTYPE_SETTER_TYPES',
"The return type of getter '{0}' is '{1}' which isn't a subtype of the type '{2}' of its setter '{3}'.",
- correction: "Try changing the types so that they are compatible.",
+ correctionMessage: "Try changing the types so that they are compatible.",
hasPublishedDocs: true,
);
@@ -5474,7 +5490,7 @@
CompileTimeErrorCode(
'IF_ELEMENT_CONDITION_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as values in an if condition inside a const collection literal.",
- correction: "Try making the deferred import non-deferred.",
+ correctionMessage: "Try making the deferred import non-deferred.",
);
/**
@@ -5514,7 +5530,7 @@
CompileTimeErrorCode(
'ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE',
"Functions marked 'async*' must have a return type that is a supertype of 'Stream<T>' for some type 'T'.",
- correction:
+ correctionMessage:
"Try fixing the return type of the function, or removing the modifier 'async*' from the function body.",
hasPublishedDocs: true,
);
@@ -5560,7 +5576,7 @@
CompileTimeErrorCode(
'ILLEGAL_ASYNC_RETURN_TYPE',
"Functions marked 'async' must have a return type assignable to 'Future'.",
- correction:
+ correctionMessage:
"Try fixing the return type of the function, or removing the modifier 'async' from the function body.",
hasPublishedDocs: true,
);
@@ -5603,7 +5619,7 @@
CompileTimeErrorCode(
'ILLEGAL_SYNC_GENERATOR_RETURN_TYPE',
"Functions marked 'sync*' must have a return type that is a supertype of 'Iterable<T>' for some type 'T'.",
- correction:
+ correctionMessage:
"Try fixing the return type of the function, or removing the modifier 'sync*' from the function body.",
hasPublishedDocs: true,
);
@@ -5615,7 +5631,7 @@
CompileTimeErrorCode(
'SUBTYPE_OF_DEFERRED_CLASS',
"Classes and mixins can't implement deferred classes.",
- correction:
+ correctionMessage:
"Try specifying a different interface, removing the class from the list, or changing the import to not be deferred.",
hasPublishedDocs: true,
uniqueName: 'IMPLEMENTS_DEFERRED_CLASS',
@@ -5629,7 +5645,7 @@
CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
"Classes and mixins can't implement '{0}'.",
- correction:
+ correctionMessage:
"Try specifying a different interface, or remove the class from the list.",
hasPublishedDocs: true,
uniqueName: 'IMPLEMENTS_DISALLOWED_CLASS',
@@ -5671,7 +5687,7 @@
static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = CompileTimeErrorCode(
'IMPLEMENTS_NON_CLASS',
"Classes and mixins can only implement other classes and mixins.",
- correction:
+ correctionMessage:
"Try specifying a class or mixin, or remove the name from the list.",
hasPublishedDocs: true,
);
@@ -5706,7 +5722,7 @@
static const CompileTimeErrorCode IMPLEMENTS_REPEATED = CompileTimeErrorCode(
'IMPLEMENTS_REPEATED',
"'{0}' can only be implemented once.",
- correction: "Try removing all but one occurrence of the class name.",
+ correctionMessage: "Try removing all but one occurrence of the class name.",
hasPublishedDocs: true,
);
@@ -5754,7 +5770,7 @@
CompileTimeErrorCode(
'IMPLEMENTS_SUPER_CLASS',
"'{0}' can't be used in both the 'extends' and 'implements' clauses.",
- correction: "Try removing one of the occurrences.",
+ correctionMessage: "Try removing one of the occurrences.",
hasPublishedDocs: true,
);
@@ -5765,7 +5781,7 @@
IMPLEMENTS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
"A type alias that expands to a type parameter can't be implemented.",
- correction: "Try specifying a class or mixin, or removing the list.",
+ correctionMessage: "Try specifying a class or mixin, or removing the list.",
hasPublishedDocs: true,
uniqueName: 'IMPLEMENTS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
);
@@ -5824,7 +5840,7 @@
CompileTimeErrorCode(
'IMPLICIT_THIS_REFERENCE_IN_INITIALIZER',
"The instance member '{0}' can't be accessed in an initializer.",
- correction:
+ correctionMessage:
"Try replacing the reference to the instance member with a different expression",
hasPublishedDocs: true,
);
@@ -5868,7 +5884,7 @@
CompileTimeErrorCode(
'IMPORT_OF_NON_LIBRARY',
"The imported library '{0}' can't have a part-of directive.",
- correction: "Try importing the library that the part is a part of.",
+ correctionMessage: "Try importing the library that the part is a part of.",
);
/**
@@ -5940,7 +5956,7 @@
CompileTimeErrorCode(
'INCONSISTENT_INHERITANCE',
"Superinterfaces don't have a valid override for '{0}': {1}.",
- correction:
+ correctionMessage:
"Try adding an explicit override that is consistent with all of the inherited members.",
hasPublishedDocs: true,
);
@@ -5961,7 +5977,7 @@
CompileTimeErrorCode(
'INCONSISTENT_INHERITANCE_GETTER_AND_METHOD',
"'{0}' is inherited as a getter (from '{1}') and also a method (from '{2}').",
- correction:
+ correctionMessage:
"Try adjusting the supertypes of this class to remove the inconsistency.",
);
@@ -6034,7 +6050,7 @@
CompileTimeErrorCode(
'INITIALIZER_FOR_NON_EXISTENT_FIELD',
"'{0}' isn't a field in the enclosing class.",
- correction:
+ correctionMessage:
"Try correcting the name to match an existing field, or defining a field named '{0}'.",
hasPublishedDocs: true,
);
@@ -6099,7 +6115,7 @@
CompileTimeErrorCode(
'INITIALIZER_FOR_STATIC_FIELD',
"'{0}' is a static field in the enclosing class. Fields initialized in a constructor can't be static.",
- correction: "Try removing the initialization.",
+ correctionMessage: "Try removing the initialization.",
hasPublishedDocs: true,
);
@@ -6182,7 +6198,7 @@
CompileTimeErrorCode(
'INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD',
"'{0}' isn't a field in the enclosing class.",
- correction:
+ correctionMessage:
"Try correcting the name to match an existing field, or defining a field named '{0}'.",
hasPublishedDocs: true,
);
@@ -6230,7 +6246,7 @@
CompileTimeErrorCode(
'INSTANCE_ACCESS_TO_STATIC_MEMBER',
"Static {1} '{0}' can't be accessed through an instance.",
- correction: "Try using the class '{2}' to access the {1}.",
+ correctionMessage: "Try using the class '{2}' to access the {1}.",
hasPublishedDocs: true,
);
@@ -6279,7 +6295,7 @@
CompileTimeErrorCode(
'INSTANCE_MEMBER_ACCESS_FROM_FACTORY',
"Instance members can't be accessed from a factory constructor.",
- correction: "Try removing the reference to the instance member.",
+ correctionMessage: "Try removing the reference to the instance member.",
hasPublishedDocs: true,
);
@@ -6340,7 +6356,7 @@
CompileTimeErrorCode(
'INSTANCE_MEMBER_ACCESS_FROM_STATIC',
"Instance members can't be accessed from a static method.",
- correction:
+ correctionMessage:
"Try removing the reference to the instance member, or removing the keyword 'static' from the method.",
hasPublishedDocs: true,
);
@@ -6374,7 +6390,7 @@
CompileTimeErrorCode(
'INSTANTIATE_ABSTRACT_CLASS',
"Abstract classes can't be instantiated.",
- correction: "Try creating an instance of a concrete subtype.",
+ correctionMessage: "Try creating an instance of a concrete subtype.",
hasPublishedDocs: true,
);
@@ -6413,7 +6429,7 @@
static const CompileTimeErrorCode INSTANTIATE_ENUM = CompileTimeErrorCode(
'INSTANTIATE_ENUM',
"Enums can't be instantiated.",
- correction: "Try using one of the defined constants.",
+ correctionMessage: "Try using one of the defined constants.",
hasPublishedDocs: true,
);
@@ -6461,7 +6477,7 @@
INSTANTIATE_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'INSTANTIATE_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
"Type aliases that expand to a type parameter can't be instantiated.",
- correction: "Try replacing it with a class.",
+ correctionMessage: "Try replacing it with a class.",
);
/**
@@ -6503,7 +6519,7 @@
CompileTimeErrorCode(
'INTEGER_LITERAL_IMPRECISE_AS_DOUBLE',
"The integer literal is being used as a double, but can't be represented as a 64-bit double without overflow or loss of precision: '{0}'.",
- correction:
+ correctionMessage:
"Try using the class 'BigInt', or switch to the closest valid double: '{1}'.",
hasPublishedDocs: true,
);
@@ -6538,7 +6554,7 @@
CompileTimeErrorCode(
'INTEGER_LITERAL_OUT_OF_RANGE',
"The integer literal {0} can't be represented in 64 bits.",
- correction:
+ correctionMessage:
"Try using the 'BigInt' class if you need an integer larger than 9,223,372,036,854,775,807 or less than -9,223,372,036,854,775,808.",
hasPublishedDocs: true,
);
@@ -6672,7 +6688,7 @@
CompileTimeErrorCode(
'INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used in annotations.",
- correction:
+ correctionMessage:
"Try moving the constant from the deferred library, or removing 'deferred' from the import.",
);
@@ -6725,7 +6741,7 @@
CompileTimeErrorCode(
'INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as annotations.",
- correction:
+ correctionMessage:
"Try removing the annotation, or changing the import to not be deferred.",
hasPublishedDocs: true,
);
@@ -6775,7 +6791,7 @@
static const CompileTimeErrorCode INVALID_ASSIGNMENT = CompileTimeErrorCode(
'INVALID_ASSIGNMENT',
"A value of type '{0}' can't be assigned to a variable of type '{1}'.",
- correction:
+ correctionMessage:
"Try changing the type of the variable, or casting the right-hand type to '{1}'.",
hasPublishedDocs: true,
);
@@ -6942,7 +6958,7 @@
CompileTimeErrorCode(
'INVALID_EXTENSION_ARGUMENT_COUNT',
"Extension overrides must have exactly one argument: the value of 'this' in the extension method.",
- correction: "Try specifying exactly one argument.",
+ correctionMessage: "Try specifying exactly one argument.",
hasPublishedDocs: true,
);
@@ -7137,7 +7153,7 @@
CompileTimeErrorCode(
'INVALID_INLINE_FUNCTION_TYPE',
"Inline function types can't be used for parameters in a generic function type.",
- correction:
+ correctionMessage:
"Try using a generic function type (returnType 'Function(' parameters ')').",
hasPublishedDocs: true,
);
@@ -7188,7 +7204,7 @@
CompileTimeErrorCode(
'INVALID_MODIFIER_ON_CONSTRUCTOR',
"The modifier '{0}' can't be applied to the body of a constructor.",
- correction: "Try removing the modifier.",
+ correctionMessage: "Try removing the modifier.",
hasPublishedDocs: true,
);
@@ -7235,7 +7251,7 @@
CompileTimeErrorCode(
'INVALID_MODIFIER_ON_SETTER',
"Setters can't use 'async', 'async*', or 'sync*'.",
- correction: "Try removing the modifier.",
+ correctionMessage: "Try removing the modifier.",
hasPublishedDocs: true,
);
@@ -7445,7 +7461,8 @@
CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL',
"Constant list literals can't include a type parameter as a type argument, such as '{0}'.",
- correction: "Try replacing the type parameter with a different type.",
+ correctionMessage:
+ "Try replacing the type parameter with a different type.",
hasPublishedDocs: true,
uniqueName: 'INVALID_TYPE_ARGUMENT_IN_CONST_LIST',
);
@@ -7458,7 +7475,8 @@
CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL',
"Constant map literals can't include a type parameter as a type argument, such as '{0}'.",
- correction: "Try replacing the type parameter with a different type.",
+ correctionMessage:
+ "Try replacing the type parameter with a different type.",
hasPublishedDocs: true,
uniqueName: 'INVALID_TYPE_ARGUMENT_IN_CONST_MAP',
);
@@ -7471,7 +7489,8 @@
CompileTimeErrorCode(
'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL',
"Constant set literals can't include a type parameter as a type argument, such as '{0}'.",
- correction: "Try replacing the type parameter with a different type.",
+ correctionMessage:
+ "Try replacing the type parameter with a different type.",
hasPublishedDocs: true,
uniqueName: 'INVALID_TYPE_ARGUMENT_IN_CONST_SET',
);
@@ -7510,7 +7529,7 @@
CompileTimeErrorCode(
'INVALID_USE_OF_COVARIANT',
"The 'covariant' keyword can only be used for parameters in instance methods or before non-final instance fields.",
- correction: "Try removing the 'covariant' keyword.",
+ correctionMessage: "Try removing the 'covariant' keyword.",
);
/**
@@ -7546,7 +7565,7 @@
CompileTimeErrorCode(
'INVALID_USE_OF_NULL_VALUE',
"An expression whose value is always 'null' can't be dereferenced.",
- correction: "Try changing the type of the expression.",
+ correctionMessage: "Try changing the type of the expression.",
hasPublishedDocs: true,
);
@@ -7628,7 +7647,7 @@
CompileTimeErrorCode(
'INVOCATION_OF_NON_FUNCTION',
"'{0}' isn't a function.",
- correction:
+ correctionMessage:
"Try correcting the name to match an existing function, or define a method or function named '{0}'.",
hasPublishedDocs: true,
);
@@ -7807,7 +7826,7 @@
static const CompileTimeErrorCode LABEL_UNDEFINED = CompileTimeErrorCode(
'LABEL_UNDEFINED',
"Can't reference an undefined label '{0}'.",
- correction:
+ correctionMessage:
"Try defining the label, or correcting the name to match an existing label.",
hasPublishedDocs: true,
);
@@ -7860,7 +7879,7 @@
CompileTimeErrorCode(
'LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR',
"Can't have a late final field in a class with a generative const constructor.",
- correction:
+ correctionMessage:
"Try removing the 'late' modifier, or don't declare 'const' constructors.",
hasPublishedDocs: true,
);
@@ -7919,7 +7938,7 @@
CompileTimeErrorCode(
'LATE_FINAL_LOCAL_ALREADY_ASSIGNED',
"The late final local variable is already assigned.",
- correction:
+ correctionMessage:
"Try removing the 'final' modifier, or don't reassign the value.",
hasPublishedDocs: true,
);
@@ -8006,7 +8025,7 @@
CompileTimeErrorCode(
'MAIN_FIRST_POSITIONAL_PARAMETER_TYPE',
"The type of the first positional parameter of the 'main' function must be a supertype of 'List<String>'.",
- correction: "Try changing the type of the parameter.",
+ correctionMessage: "Try changing the type of the parameter.",
hasPublishedDocs: true,
);
@@ -8044,7 +8063,7 @@
CompileTimeErrorCode(
'MAIN_HAS_REQUIRED_NAMED_PARAMETERS',
"The function 'main' can't have any required named parameters.",
- correction:
+ correctionMessage:
"Try using a different name for the function, or removing the 'required' modifier.",
hasPublishedDocs: true,
);
@@ -8092,7 +8111,7 @@
MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS = CompileTimeErrorCode(
'MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS',
"The function 'main' can't have more than two required positional parameters.",
- correction:
+ correctionMessage:
"Try using a different name for the function, or removing extra parameters.",
hasPublishedDocs: true,
);
@@ -8124,7 +8143,7 @@
static const CompileTimeErrorCode MAIN_IS_NOT_FUNCTION = CompileTimeErrorCode(
'MAIN_IS_NOT_FUNCTION',
"The declaration named 'main' must be a function.",
- correction: "Try using a different name for this declaration.",
+ correctionMessage: "Try using a different name for this declaration.",
hasPublishedDocs: true,
);
@@ -8168,7 +8187,7 @@
static const CompileTimeErrorCode MAP_ENTRY_NOT_IN_MAP = CompileTimeErrorCode(
'MAP_ENTRY_NOT_IN_MAP',
"Map entries can only be used in a map literal.",
- correction:
+ correctionMessage:
"Try converting the collection to a map or removing the map entry.",
hasPublishedDocs: true,
);
@@ -8261,7 +8280,7 @@
CompileTimeErrorCode(
'MISSING_CONST_IN_LIST_LITERAL',
"List literals must be prefixed with 'const' when used as a constant expression.",
- correction: "Try adding the keyword 'const' before the literal.",
+ correctionMessage: "Try adding the keyword 'const' before the literal.",
);
/**
@@ -8271,7 +8290,7 @@
CompileTimeErrorCode(
'MISSING_CONST_IN_MAP_LITERAL',
"Map literals must be prefixed with 'const' when used as a constant expression.",
- correction: "Try adding the keyword 'const' before the literal.",
+ correctionMessage: "Try adding the keyword 'const' before the literal.",
);
/**
@@ -8281,7 +8300,7 @@
CompileTimeErrorCode(
'MISSING_CONST_IN_SET_LITERAL',
"Set literals must be prefixed with 'const' when used as a constant expression.",
- correction: "Try adding the keyword 'const' before the literal.",
+ correctionMessage: "Try adding the keyword 'const' before the literal.",
);
/**
@@ -8299,7 +8318,7 @@
static const CompileTimeErrorCode MISSING_DART_LIBRARY = CompileTimeErrorCode(
'MISSING_DART_LIBRARY',
"Required library '{0}' is missing.",
- correction: "Re-install the Dart or Flutter SDK.",
+ correctionMessage: "Re-install the Dart or Flutter SDK.",
hasPublishedDocs: true,
);
@@ -8357,7 +8376,7 @@
CompileTimeErrorCode(
'MISSING_DEFAULT_VALUE_FOR_PARAMETER',
"The parameter '{0}' can't have a value of 'null' because of its type, but the implicit default value is 'null'.",
- correction:
+ correctionMessage:
"Try adding either an explicit non-'null' default value or the 'required' modifier.",
hasPublishedDocs: true,
);
@@ -8397,7 +8416,7 @@
CompileTimeErrorCode(
'MISSING_REQUIRED_ARGUMENT',
"The named parameter '{0}' is required, but there's no corresponding argument.",
- correction: "Try adding the required argument.",
+ correctionMessage: "Try adding the required argument.",
hasPublishedDocs: true,
);
@@ -8411,7 +8430,7 @@
static const CompileTimeErrorCode MIXINS_SUPER_CLASS = CompileTimeErrorCode(
'MIXINS_SUPER_CLASS',
"'{0}' can't be used in both 'extends' and 'with' clauses.",
- correction: "Try removing one of the occurrences.",
+ correctionMessage: "Try removing one of the occurrences.",
);
/**
@@ -8565,7 +8584,7 @@
MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE = CompileTimeErrorCode(
'MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE',
"'{0}' can't be mixed onto '{1}' because '{1}' doesn't implement '{2}'.",
- correction: "Try extending the class '{0}'.",
+ correctionMessage: "Try extending the class '{0}'.",
hasPublishedDocs: true,
);
@@ -8723,7 +8742,7 @@
static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = CompileTimeErrorCode(
'SUBTYPE_OF_DEFERRED_CLASS',
"Classes can't mixin deferred classes.",
- correction: "Try changing the import to not be deferred.",
+ correctionMessage: "Try changing the import to not be deferred.",
hasPublishedDocs: true,
uniqueName: 'MIXIN_DEFERRED_CLASS',
);
@@ -8847,7 +8866,7 @@
CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
"Classes can't mixin '{0}'.",
- correction:
+ correctionMessage:
"Try specifying a different class or mixin, or remove the class or mixin from the list.",
hasPublishedDocs: true,
uniqueName: 'MIXIN_OF_DISALLOWED_CLASS',
@@ -8917,7 +8936,7 @@
MIXIN_SUPER_CLASS_CONSTRAINT_DEFERRED_CLASS = CompileTimeErrorCode(
'MIXIN_SUPER_CLASS_CONSTRAINT_DEFERRED_CLASS',
"Deferred classes can't be used as super-class constraints.",
- correction: "Try changing the import to not be deferred.",
+ correctionMessage: "Try changing the import to not be deferred.",
);
/**
@@ -8928,7 +8947,7 @@
MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS = CompileTimeErrorCode(
'SUBTYPE_OF_DISALLOWED_TYPE',
"''{0}' can't be used as a superclass constraint.",
- correction:
+ correctionMessage:
"Try specifying a different super-class constraint, or remove the 'on' clause.",
hasPublishedDocs: true,
uniqueName: 'MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS',
@@ -8984,7 +9003,7 @@
MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = CompileTimeErrorCode(
'MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS',
"Constructors can have at most one 'this' redirection.",
- correction: "Try removing all but one of the redirections.",
+ correctionMessage: "Try removing all but one of the redirections.",
);
/**
@@ -9075,7 +9094,7 @@
CompileTimeErrorCode(
'MULTIPLE_SUPER_INITIALIZERS',
"A constructor can have at most one 'super' initializer.",
- correction: "Try removing all but one of the 'super' initializers.",
+ correctionMessage: "Try removing all but one of the 'super' initializers.",
hasPublishedDocs: true,
);
@@ -9127,7 +9146,7 @@
static const CompileTimeErrorCode NEW_WITH_NON_TYPE = CompileTimeErrorCode(
'CREATION_WITH_NON_TYPE',
"The name '{0}' isn't a class.",
- correction: "Try correcting the name to match an existing class.",
+ correctionMessage: "Try correcting the name to match an existing class.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
uniqueName: 'NEW_WITH_NON_TYPE',
@@ -9150,7 +9169,7 @@
CompileTimeErrorCode(
'NEW_WITH_UNDEFINED_CONSTRUCTOR',
"The class '{0}' doesn't have a constructor named '{1}'.",
- correction:
+ correctionMessage:
"Try invoking a different constructor, or define a constructor named '{1}'.",
);
@@ -9204,7 +9223,8 @@
CompileTimeErrorCode(
'NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
"The class '{0}' doesn't have an unnamed constructor.",
- correction: "Try using one of the named constructors defined in '{0}'.",
+ correctionMessage:
+ "Try using one of the named constructors defined in '{0}'.",
hasPublishedDocs: true,
);
@@ -9221,7 +9241,7 @@
CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
"Missing concrete implementations of '{0}', '{1}', '{2}', '{3}', and {4} more.",
- correction:
+ correctionMessage:
"Try implementing the missing methods, or make the class abstract.",
hasPublishedDocs: true,
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS',
@@ -9238,7 +9258,7 @@
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
"Missing concrete implementations of '{0}', '{1}', '{2}', and '{3}'.",
- correction:
+ correctionMessage:
"Try implementing the missing methods, or make the class abstract.",
hasPublishedDocs: true,
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR',
@@ -9311,7 +9331,7 @@
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
"Missing concrete implementation of '{0}'.",
- correction:
+ correctionMessage:
"Try implementing the missing method, or make the class abstract.",
hasPublishedDocs: true,
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE',
@@ -9327,7 +9347,7 @@
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
"Missing concrete implementations of '{0}', '{1}', and '{2}'.",
- correction:
+ correctionMessage:
"Try implementing the missing methods, or make the class abstract.",
hasPublishedDocs: true,
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE',
@@ -9342,7 +9362,7 @@
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = CompileTimeErrorCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER',
"Missing concrete implementations of '{0}' and '{1}'.",
- correction:
+ correctionMessage:
"Try implementing the missing methods, or make the class abstract.",
hasPublishedDocs: true,
uniqueName: 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO',
@@ -9383,7 +9403,7 @@
static const CompileTimeErrorCode NON_BOOL_CONDITION = CompileTimeErrorCode(
'NON_BOOL_CONDITION',
"Conditions must have a static type of 'bool'.",
- correction: "Try changing the condition.",
+ correctionMessage: "Try changing the condition.",
hasPublishedDocs: true,
);
@@ -9418,7 +9438,7 @@
static const CompileTimeErrorCode NON_BOOL_EXPRESSION = CompileTimeErrorCode(
'NON_BOOL_EXPRESSION',
"The expression in an assert must be of type 'bool'.",
- correction: "Try changing the expression.",
+ correctionMessage: "Try changing the expression.",
hasPublishedDocs: true,
);
@@ -9452,7 +9472,7 @@
CompileTimeErrorCode(
'NON_BOOL_NEGATION_EXPRESSION',
"A negation operand must have a static type of 'bool'.",
- correction: "Try changing the operand to the '!' operator.",
+ correctionMessage: "Try changing the operand to the '!' operator.",
hasPublishedDocs: true,
);
@@ -9664,7 +9684,7 @@
NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as a case expression.",
- correction:
+ correctionMessage:
"Try re-writing the switch as a series of if statements, or changing the import to not be deferred.",
hasPublishedDocs: true,
);
@@ -9770,7 +9790,7 @@
NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as a default parameter value.",
- correction:
+ correctionMessage:
"Try leaving the default as null and initializing the parameter inside the function body.",
hasPublishedDocs: true,
);
@@ -9819,7 +9839,8 @@
CompileTimeErrorCode(
'NON_CONSTANT_LIST_ELEMENT',
"The values in a const list literal must be constants.",
- correction: "Try removing the keyword 'const' from the list literal.",
+ correctionMessage:
+ "Try removing the keyword 'const' from the list literal.",
hasPublishedDocs: true,
);
@@ -9886,7 +9907,7 @@
NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as values in a 'const' list literal.",
- correction:
+ correctionMessage:
"Try removing the keyword 'const' from the list literal or removing the keyword 'deferred' from the import.",
hasPublishedDocs: true,
uniqueName: 'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY',
@@ -9940,7 +9961,7 @@
CompileTimeErrorCode(
'NON_CONSTANT_MAP_ELEMENT',
"The elements in a const map literal must be constant.",
- correction: "Try removing the keyword 'const' from the map literal.",
+ correctionMessage: "Try removing the keyword 'const' from the map literal.",
hasPublishedDocs: true,
);
@@ -9980,7 +10001,7 @@
static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = CompileTimeErrorCode(
'NON_CONSTANT_MAP_KEY',
"The keys in a const map literal must be constant.",
- correction: "Try removing the keyword 'const' from the map literal.",
+ correctionMessage: "Try removing the keyword 'const' from the map literal.",
hasPublishedDocs: true,
);
@@ -9991,7 +10012,7 @@
CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as keys in a 'const' map literal.",
- correction:
+ correctionMessage:
"Try removing the keyword 'const' from the map literal or removing the keyword 'deferred' from the import.",
hasPublishedDocs: true,
uniqueName: 'NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY',
@@ -10034,7 +10055,7 @@
CompileTimeErrorCode(
'NON_CONSTANT_MAP_VALUE',
"The values in a const map literal must be constant.",
- correction: "Try removing the keyword 'const' from the map literal.",
+ correctionMessage: "Try removing the keyword 'const' from the map literal.",
hasPublishedDocs: true,
);
@@ -10045,7 +10066,7 @@
NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY = CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as values in a 'const' map literal.",
- correction:
+ correctionMessage:
"Try removing the keyword 'const' from the map literal or removing the keyword 'deferred' from the import.",
hasPublishedDocs: true,
uniqueName: 'NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY',
@@ -10090,7 +10111,7 @@
CompileTimeErrorCode(
'NON_CONSTANT_SET_ELEMENT',
"The values in a const set literal must be constants.",
- correction: "Try removing the keyword 'const' from the set literal.",
+ correctionMessage: "Try removing the keyword 'const' from the set literal.",
hasPublishedDocs: true,
);
@@ -10153,7 +10174,7 @@
CompileTimeErrorCode(
'NON_GENERATIVE_CONSTRUCTOR',
"The generative constructor '{0}' is expected, but a factory was found.",
- correction:
+ correctionMessage:
"Try calling a different constructor of the superclass, or making the called constructor not be a factory constructor.",
hasPublishedDocs: true,
);
@@ -10172,7 +10193,7 @@
CompileTimeErrorCode(
'NON_GENERATIVE_IMPLICIT_CONSTRUCTOR',
"The unnamed constructor of superclass '{0}' (called by the default constructor of '{1}') must be a generative constructor, but factory found.",
- correction:
+ correctionMessage:
"Try adding an explicit constructor that has a different superinitializer or changing the superclass constructor '{2}' to not be a factory constructor.",
);
@@ -10262,7 +10283,7 @@
CompileTimeErrorCode(
'NON_TYPE_AS_TYPE_ARGUMENT',
"The name '{0}' isn't a type so it can't be used as a type argument.",
- correction:
+ correctionMessage:
"Try correcting the name to an existing type, or defining a type named '{0}'.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
@@ -10311,7 +10332,7 @@
CompileTimeErrorCode(
'NON_TYPE_IN_CATCH_CLAUSE',
"The name '{0}' isn't a type and can't be used in an on-catch clause.",
- correction: "Try correcting the name to match an existing class.",
+ correctionMessage: "Try correcting the name to match an existing class.",
hasPublishedDocs: true,
);
@@ -10347,7 +10368,7 @@
CompileTimeErrorCode(
'NON_VOID_RETURN_FOR_OPERATOR',
"The return type of the operator []= must be 'void'.",
- correction: "Try changing the return type to 'void'.",
+ correctionMessage: "Try changing the return type to 'void'.",
hasPublishedDocs: true,
);
@@ -10383,7 +10404,7 @@
CompileTimeErrorCode(
'NON_VOID_RETURN_FOR_SETTER',
"The return type of the setter must be 'void' or absent.",
- correction:
+ correctionMessage:
"Try removing the return type, or define a method rather than a setter.",
hasPublishedDocs: true,
);
@@ -10506,7 +10527,7 @@
CompileTimeErrorCode(
'NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE',
"The non-nullable local variable '{0}' must be assigned before it can be used.",
- correction:
+ correctionMessage:
"Try giving it an initializer expression, or ensure that it's assigned on every execution path.",
hasPublishedDocs: true,
);
@@ -10535,7 +10556,7 @@
static const CompileTimeErrorCode NOT_A_TYPE = CompileTimeErrorCode(
'NOT_A_TYPE',
"{0} isn't a type.",
- correction: "Try correcting the name to match an existing type.",
+ correctionMessage: "Try correcting the name to match an existing type.",
hasPublishedDocs: true,
);
@@ -10606,7 +10627,7 @@
CompileTimeErrorCode(
'NOT_ENOUGH_POSITIONAL_ARGUMENTS',
"{0} positional argument(s) expected, but {1} found.",
- correction: "Try adding the missing arguments.",
+ correctionMessage: "Try adding the missing arguments.",
hasPublishedDocs: true,
);
@@ -10685,7 +10706,7 @@
NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD = CompileTimeErrorCode(
'NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD',
"Non-nullable instance field '{0}' must be initialized.",
- correction:
+ correctionMessage:
"Try adding an initializer expression, or a generative constructor that initializes it, or mark it 'late'.",
hasPublishedDocs: true,
);
@@ -10699,7 +10720,7 @@
CompileTimeErrorCode(
'NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD',
"Non-nullable instance field '{0}' must be initialized.",
- correction:
+ correctionMessage:
"Try adding an initializer expression, or add a field initializer in this constructor, or mark it 'late'.",
hasPublishedDocs: true,
uniqueName: 'NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD_CONSTRUCTOR',
@@ -10765,7 +10786,7 @@
CompileTimeErrorCode(
'NOT_INITIALIZED_NON_NULLABLE_VARIABLE',
"The non-nullable variable '{0}' must be initialized.",
- correction: "Try adding an initializer expression.",
+ correctionMessage: "Try adding an initializer expression.",
hasPublishedDocs: true,
);
@@ -10776,7 +10797,7 @@
CompileTimeErrorCode(
'NOT_INSTANTIATED_BOUND',
"Type parameter bound types must be instantiated.",
- correction: "Try adding type arguments to the type parameter bound.",
+ correctionMessage: "Try adding type arguments to the type parameter bound.",
);
/**
@@ -10895,7 +10916,7 @@
CompileTimeErrorCode(
'NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS',
"Annotation creation must have arguments.",
- correction: "Try adding an empty argument list.",
+ correctionMessage: "Try adding an empty argument list.",
hasPublishedDocs: true,
);
@@ -10959,7 +10980,7 @@
CompileTimeErrorCode(
'NO_COMBINED_SUPER_SIGNATURE',
"Can't infer missing types in '{0}' from overridden methods: {1}.",
- correction:
+ correctionMessage:
"Try providing explicit types for this method's parameters and return type.",
hasPublishedDocs: true,
);
@@ -10973,7 +10994,7 @@
CompileTimeErrorCode(
'NO_DEFAULT_SUPER_CONSTRUCTOR',
"The superclass '{0}' doesn't have a zero argument constructor.",
- correction:
+ correctionMessage:
"Try declaring a zero argument constructor in '{0}', or explicitly invoking a different constructor in '{0}'.",
uniqueName: 'NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT',
);
@@ -10988,7 +11009,7 @@
CompileTimeErrorCode(
'NO_DEFAULT_SUPER_CONSTRUCTOR',
"The superclass '{0}' doesn't have a zero argument constructor.",
- correction:
+ correctionMessage:
"Try declaring a zero argument constructor in '{0}', or declaring a constructor in {1} that explicitly invokes a constructor in '{0}'.",
uniqueName: 'NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT',
);
@@ -11006,7 +11027,7 @@
CompileTimeErrorCode(
'NO_GENERATIVE_CONSTRUCTORS_IN_SUPERCLASS',
"The class '{0}' cannot extend '{1}' because '{1}' only has factory constructors (no generative constructors), and '{0}' has at least one generative constructor.",
- correction:
+ correctionMessage:
"Try implementing the class instead, adding a generative (not factory) constructor to the superclass {0}, or a factory constructor to the subclass.",
);
@@ -11048,7 +11069,7 @@
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_EXTENDS_CLAUSE',
"A class can't extend a nullable type.",
- correction: "Try removing the question mark.",
+ correctionMessage: "Try removing the question mark.",
hasPublishedDocs: true,
);
@@ -11090,7 +11111,7 @@
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE',
"A class or mixin can't implement a nullable type.",
- correction: "Try removing the question mark.",
+ correctionMessage: "Try removing the question mark.",
hasPublishedDocs: true,
);
@@ -11133,7 +11154,7 @@
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_ON_CLAUSE',
"A mixin can't have a nullable type as a superclass constraint.",
- correction: "Try removing the question mark.",
+ correctionMessage: "Try removing the question mark.",
hasPublishedDocs: true,
);
@@ -11174,7 +11195,7 @@
CompileTimeErrorCode(
'NULLABLE_TYPE_IN_WITH_CLAUSE',
"A class or mixin can't mix in a nullable type.",
- correction: "Try removing the question mark.",
+ correctionMessage: "Try removing the question mark.",
hasPublishedDocs: true,
);
@@ -11235,7 +11256,8 @@
static const CompileTimeErrorCode ON_REPEATED = CompileTimeErrorCode(
'ON_REPEATED',
"The type '{0}' can be included in the superclass constraints only once.",
- correction: "Try removing all except one occurrence of the type name.",
+ correctionMessage:
+ "Try removing all except one occurrence of the type name.",
hasPublishedDocs: true,
);
@@ -11271,7 +11293,7 @@
CompileTimeErrorCode(
'OPTIONAL_PARAMETER_IN_OPERATOR',
"Optional parameters aren't allowed when defining an operator.",
- correction: "Try removing the optional parameters.",
+ correctionMessage: "Try removing the optional parameters.",
hasPublishedDocs: true,
);
@@ -11315,7 +11337,7 @@
CompileTimeErrorCode(
'PART_OF_DIFFERENT_LIBRARY',
"Expected this library to be part of '{0}', not '{1}'.",
- correction:
+ correctionMessage:
"Try including a different part, or changing the name of the library in the part's part-of directive.",
hasPublishedDocs: true,
);
@@ -11365,7 +11387,7 @@
static const CompileTimeErrorCode PART_OF_NON_PART = CompileTimeErrorCode(
'PART_OF_NON_PART',
"The included part '{0}' must have a part-of directive.",
- correction: "Try adding a part-of directive to '{0}'.",
+ correctionMessage: "Try adding a part-of directive to '{0}'.",
hasPublishedDocs: true,
);
@@ -11410,7 +11432,7 @@
CompileTimeErrorCode(
'PART_OF_UNNAMED_LIBRARY',
"The library is unnamed. A URI is expected, not a library name '{0}', in the part-of directive.",
- correction:
+ correctionMessage:
"Try changing the part-of directive to a URI, or try including a different part.",
hasPublishedDocs: true,
);
@@ -11458,7 +11480,8 @@
CompileTimeErrorCode(
'PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER',
"The name '{0}' is already used as an import prefix and can't be used to name a top-level element.",
- correction: "Try renaming either the top-level element or the prefix.",
+ correctionMessage:
+ "Try renaming either the top-level element or the prefix.",
hasPublishedDocs: true,
);
@@ -11504,7 +11527,7 @@
CompileTimeErrorCode(
'PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT',
"The name '{0}' refers to an import prefix, so it must be followed by '.'.",
- correction:
+ correctionMessage:
"Try correcting the name to refer to something other than a prefix, or renaming the prefix.",
hasPublishedDocs: true,
);
@@ -11523,7 +11546,8 @@
CompileTimeErrorCode(
'PREFIX_SHADOWED_BY_LOCAL_DECLARATION',
"The prefix '{0}' can't be used here because it is shadowed by a local declaration.",
- correction: "Try renaming either the prefix or the local declaration.",
+ correctionMessage:
+ "Try renaming either the prefix or the local declaration.",
);
/**
@@ -11579,7 +11603,7 @@
CompileTimeErrorCode(
'PRIVATE_COLLISION_IN_MIXIN_APPLICATION',
"The private name '{0}', defined by '{1}', conflicts with the same name defined by '{2}'.",
- correction: "Try removing '{1}' from the 'with' clause.",
+ correctionMessage: "Try removing '{1}' from the 'with' clause.",
hasPublishedDocs: true,
);
@@ -11621,14 +11645,15 @@
static const CompileTimeErrorCode PRIVATE_SETTER = CompileTimeErrorCode(
'PRIVATE_SETTER',
"The setter '{0}' is private and can't be accessed outside of the library that declares it.",
- correction: "Try making it public.",
+ correctionMessage: "Try making it public.",
);
static const CompileTimeErrorCode READ_POTENTIALLY_UNASSIGNED_FINAL =
CompileTimeErrorCode(
'READ_POTENTIALLY_UNASSIGNED_FINAL',
"The final variable '{0}' can't be read because it is potentially unassigned at this point.",
- correction: "Ensure that it is assigned on necessary execution paths.",
+ correctionMessage:
+ "Ensure that it is assigned on necessary execution paths.",
);
/**
@@ -11762,7 +11787,7 @@
CompileTimeErrorCode(
'RECURSIVE_CONSTRUCTOR_REDIRECT',
"Constructors can't redirect to themselves either directly or indirectly.",
- correction:
+ correctionMessage:
"Try changing one of the constructors in the loop to not redirect.",
hasPublishedDocs: true,
);
@@ -11774,7 +11799,7 @@
CompileTimeErrorCode(
'RECURSIVE_CONSTRUCTOR_REDIRECT',
"Constructors can't redirect to themselves either directly or indirectly.",
- correction:
+ correctionMessage:
"Try changing one of the constructors in the loop to not redirect.",
hasPublishedDocs: true,
uniqueName: 'RECURSIVE_FACTORY_REDIRECT',
@@ -11928,7 +11953,7 @@
CompileTimeErrorCode(
'REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR',
"The constructor '{0}' couldn't be found in '{1}'.",
- correction:
+ correctionMessage:
"Try redirecting to a different constructor, or defining the constructor named '{0}'.",
hasPublishedDocs: true,
);
@@ -11978,7 +12003,7 @@
REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR = CompileTimeErrorCode(
'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR',
"Generative constructors can't redirect to a factory constructor.",
- correction: "Try redirecting to a different constructor.",
+ correctionMessage: "Try redirecting to a different constructor.",
hasPublishedDocs: true,
);
@@ -11990,7 +12015,7 @@
CompileTimeErrorCode(
'REDIRECT_TO_ABSTRACT_CLASS_CONSTRUCTOR',
"The redirecting constructor '{0}' can't redirect to a constructor of the abstract class '{1}'.",
- correction: "Try redirecting to a constructor of a different class.",
+ correctionMessage: "Try redirecting to a constructor of a different class.",
);
/**
@@ -12068,7 +12093,7 @@
CompileTimeErrorCode(
'REDIRECT_TO_INVALID_FUNCTION_TYPE',
"The redirected constructor '{0}' has incompatible parameters with '{1}'.",
- correction: "Try redirecting to a different constructor.",
+ correctionMessage: "Try redirecting to a different constructor.",
hasPublishedDocs: true,
);
@@ -12131,7 +12156,7 @@
CompileTimeErrorCode(
'REDIRECT_TO_INVALID_RETURN_TYPE',
"The return type '{0}' of the redirected constructor isn't a subtype of '{1}'.",
- correction: "Try redirecting to a different constructor.",
+ correctionMessage: "Try redirecting to a different constructor.",
hasPublishedDocs: true,
);
@@ -12143,7 +12168,7 @@
CompileTimeErrorCode(
'REDIRECT_TO_MISSING_CONSTRUCTOR',
"The constructor '{0}' couldn't be found in '{1}'.",
- correction:
+ correctionMessage:
"Try redirecting to a different constructor, or define the constructor named '{0}'.",
);
@@ -12192,7 +12217,7 @@
CompileTimeErrorCode(
'REDIRECT_TO_NON_CLASS',
"The name '{0}' isn't a type and can't be used in a redirected constructor.",
- correction: "Try redirecting to a different constructor.",
+ correctionMessage: "Try redirecting to a different constructor.",
hasPublishedDocs: true,
);
@@ -12241,7 +12266,7 @@
CompileTimeErrorCode(
'REDIRECT_TO_NON_CONST_CONSTRUCTOR',
"A constant redirecting constructor can't redirect to a non-constant constructor.",
- correction: "Try redirecting to a different constructor.",
+ correctionMessage: "Try redirecting to a different constructor.",
hasPublishedDocs: true,
);
@@ -12287,7 +12312,7 @@
REDIRECT_TO_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'REDIRECT_TO_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER',
"A redirecting constructor can't redirect to a type alias that expands to a type parameter.",
- correction: "Try replacing it with a class.",
+ correctionMessage: "Try replacing it with a class.",
);
/**
@@ -12345,7 +12370,7 @@
CompileTimeErrorCode(
'REFERENCED_BEFORE_DECLARATION',
"Local variable '{0}' can't be referenced before it is declared.",
- correction:
+ correctionMessage:
"Try moving the declaration to before the first use, or renaming the local variable so that it doesn't hide a name from an enclosing scope.",
hasPublishedDocs: true,
);
@@ -12398,7 +12423,7 @@
CompileTimeErrorCode(
'RETHROW_OUTSIDE_CATCH',
"A rethrow must be inside of a catch clause.",
- correction:
+ correctionMessage:
"Try moving the expression into a catch clause, or using a 'throw' expression.",
hasPublishedDocs: true,
);
@@ -12455,7 +12480,7 @@
CompileTimeErrorCode(
'RETURN_IN_GENERATIVE_CONSTRUCTOR',
"Constructors can't return values.",
- correction:
+ correctionMessage:
"Try removing the return statement or using a factory constructor.",
hasPublishedDocs: true,
);
@@ -12519,7 +12544,7 @@
static const CompileTimeErrorCode RETURN_IN_GENERATOR = CompileTimeErrorCode(
'RETURN_IN_GENERATOR',
"Can't return a value from a generator function that uses the 'async*' or 'sync*' modifier.",
- correction:
+ correctionMessage:
"Try replacing 'return' with 'yield', using a block function body, or changing the method body modifier.",
hasPublishedDocs: true,
);
@@ -12671,7 +12696,7 @@
CompileTimeErrorCode(
'COLLECTION_ELEMENT_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used as values in a 'const' set literal.",
- correction:
+ correctionMessage:
"Try removing the keyword 'const' from the set literal or removing the keyword 'deferred' from the import.",
hasPublishedDocs: true,
uniqueName: 'SET_ELEMENT_FROM_DEFERRED_LIBRARY',
@@ -12763,7 +12788,7 @@
CompileTimeErrorCode(
'SHARED_DEFERRED_PREFIX',
"The prefix of a deferred import can't be used in other import directives.",
- correction: "Try renaming one of the prefixes.",
+ correctionMessage: "Try renaming one of the prefixes.",
hasPublishedDocs: true,
);
@@ -12771,7 +12796,7 @@
CompileTimeErrorCode(
'SPREAD_EXPRESSION_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be spread into a const literal.",
- correction: "Try making the deferred import non-deferred.",
+ correctionMessage: "Try making the deferred import non-deferred.",
);
/**
@@ -12961,7 +12986,7 @@
CompileTimeErrorCode(
'SWITCH_CASE_COMPLETES_NORMALLY',
"The 'case' should not complete normally.",
- correction: "Try adding 'break', or 'return', etc.",
+ correctionMessage: "Try adding 'break', or 'return', etc.",
);
/**
@@ -13057,7 +13082,7 @@
CompileTimeErrorCode(
'TEAROFF_OF_GENERATIVE_CONSTRUCTOR_OF_ABSTRACT_CLASS',
"A generative constructor of an abstract class can't be torn off.",
- correction:
+ correctionMessage:
"Try tearing off a constructor of a concrete class, or a non-generative constructor.",
);
@@ -13145,7 +13170,7 @@
static const CompileTimeErrorCode TOP_LEVEL_CYCLE = CompileTimeErrorCode(
'TOP_LEVEL_CYCLE',
"The type of '{0}' can't be inferred because it depends on itself through the cycle: {1}.",
- correction:
+ correctionMessage:
"Try adding an explicit type to one or more of the variables in the cycle in order to break the cycle.",
hasPublishedDocs: true,
);
@@ -13228,7 +13253,7 @@
CompileTimeErrorCode(
'TYPE_ANNOTATION_DEFERRED_CLASS',
"The deferred type '{0}' can't be used in a declaration, cast, or type test.",
- correction:
+ correctionMessage:
"Try using a different type, or changing the import to not be deferred.",
hasPublishedDocs: true,
);
@@ -13269,7 +13294,7 @@
CompileTimeErrorCode(
'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS',
"'{0}' doesn't conform to the bound '{2}' of the type parameter '{1}'.",
- correction: "Try using a type that is or is a subclass of '{2}'.",
+ correctionMessage: "Try using a type that is or is a subclass of '{2}'.",
hasPublishedDocs: true,
);
@@ -13317,7 +13342,7 @@
CompileTimeErrorCode(
'TYPE_PARAMETER_REFERENCED_BY_STATIC',
"Static members can't reference type parameters of the class.",
- correction:
+ correctionMessage:
"Try removing the reference to the type parameter, or making the member an instance member.",
hasPublishedDocs: true,
);
@@ -13372,7 +13397,8 @@
CompileTimeErrorCode(
'TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND',
"'{0}' can't be a supertype of its upper bound.",
- correction: "Try using a type that is the same as or a subclass of '{1}'.",
+ correctionMessage:
+ "Try using a type that is the same as or a subclass of '{1}'.",
hasPublishedDocs: true,
);
@@ -13429,7 +13455,7 @@
CompileTimeErrorCode(
'TYPE_TEST_WITH_NON_TYPE',
"The name '{0}' isn't a type and can't be used in an 'is' expression.",
- correction: "Try correcting the name to match an existing type.",
+ correctionMessage: "Try correcting the name to match an existing type.",
hasPublishedDocs: true,
);
@@ -13469,7 +13495,7 @@
CompileTimeErrorCode(
'TYPE_TEST_WITH_UNDEFINED_NAME',
"The name '{0}' isn't defined, so it can't be used in an 'is' expression.",
- correction:
+ correctionMessage:
"Try changing the name to the name of an existing type, or creating a type with the name '{0}'.",
hasPublishedDocs: true,
);
@@ -13478,7 +13504,7 @@
CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"The function can't be unconditionally invoked because it can be 'null'.",
- correction: "Try adding a null check ('!').",
+ correctionMessage: "Try adding a null check ('!').",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_INVOCATION_OF_NULLABLE_VALUE',
);
@@ -13487,7 +13513,7 @@
UNCHECKED_METHOD_INVOCATION_OF_NULLABLE_VALUE = CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"The method '{0}' can't be unconditionally invoked because the receiver can be 'null'.",
- correction:
+ correctionMessage:
"Try making the call conditional (using '?.') or adding a null check to the target ('!').",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_METHOD_INVOCATION_OF_NULLABLE_VALUE',
@@ -13497,7 +13523,7 @@
UNCHECKED_OPERATOR_INVOCATION_OF_NULLABLE_VALUE = CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"The operator '{0}' can't be unconditionally invoked because the receiver can be 'null'.",
- correction: "Try adding a null check to the target ('!').",
+ correctionMessage: "Try adding a null check to the target ('!').",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_OPERATOR_INVOCATION_OF_NULLABLE_VALUE',
);
@@ -13506,7 +13532,7 @@
UNCHECKED_PROPERTY_ACCESS_OF_NULLABLE_VALUE = CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"The property '{0}' can't be unconditionally accessed because the receiver can be 'null'.",
- correction:
+ correctionMessage:
"Try making the access conditional (using '?.') or adding a null check to the target ('!').",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_PROPERTY_ACCESS_OF_NULLABLE_VALUE',
@@ -13571,7 +13597,7 @@
UNCHECKED_USE_OF_NULLABLE_VALUE_AS_CONDITION = CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"A nullable expression can't be used as a condition.",
- correction:
+ correctionMessage:
"Try checking that the value isn't 'null' before using it as a condition.",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_USE_OF_NULLABLE_VALUE_AS_CONDITION',
@@ -13581,7 +13607,7 @@
UNCHECKED_USE_OF_NULLABLE_VALUE_AS_ITERATOR = CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"A nullable expression can't be used as an iterator in a for-in loop.",
- correction:
+ correctionMessage:
"Try checking that the value isn't 'null' before using it as an iterator.",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_USE_OF_NULLABLE_VALUE_AS_ITERATOR',
@@ -13591,7 +13617,7 @@
CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"A nullable expression can't be used in a spread.",
- correction:
+ correctionMessage:
"Try checking that the value isn't 'null' before using it in a spread, or use a null-aware spread.",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_USE_OF_NULLABLE_VALUE_IN_SPREAD',
@@ -13601,7 +13627,7 @@
UNCHECKED_USE_OF_NULLABLE_VALUE_IN_YIELD_EACH = CompileTimeErrorCode(
'UNCHECKED_USE_OF_NULLABLE_VALUE',
"A nullable expression can't be used in a yield-each statement.",
- correction:
+ correctionMessage:
"Try checking that the value isn't 'null' before using it in a yield-each statement.",
hasPublishedDocs: true,
uniqueName: 'UNCHECKED_USE_OF_NULLABLE_VALUE_IN_YIELD_EACH',
@@ -13648,7 +13674,8 @@
static const CompileTimeErrorCode UNDEFINED_ANNOTATION = CompileTimeErrorCode(
'UNDEFINED_ANNOTATION',
"Undefined name '{0}' used as an annotation.",
- correction: "Try defining the name or importing it from another library.",
+ correctionMessage:
+ "Try defining the name or importing it from another library.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
);
@@ -13690,7 +13717,7 @@
static const CompileTimeErrorCode UNDEFINED_CLASS = CompileTimeErrorCode(
'UNDEFINED_CLASS',
"Undefined class '{0}'.",
- correction:
+ correctionMessage:
"Try changing the name to the name of an existing class, or creating a class with the name '{0}'.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
@@ -13707,7 +13734,7 @@
CompileTimeErrorCode(
'UNDEFINED_CLASS',
"Undefined class '{0}'.",
- correction: "Try using the type 'bool'.",
+ correctionMessage: "Try using the type 'bool'.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
uniqueName: 'UNDEFINED_CLASS_BOOLEAN',
@@ -13780,7 +13807,7 @@
CompileTimeErrorCode(
'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER',
"The class '{0}' doesn't have a constructor named '{1}'.",
- correction:
+ correctionMessage:
"Try defining a constructor named '{1}' in '{0}', or invoking a different constructor.",
hasPublishedDocs: true,
);
@@ -13793,7 +13820,7 @@
UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = CompileTimeErrorCode(
'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER',
"The class '{0}' doesn't have an unnamed constructor.",
- correction:
+ correctionMessage:
"Try defining an unnamed constructor in '{0}', or invoking a different constructor.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT',
@@ -13844,7 +13871,7 @@
CompileTimeErrorCode(
'UNDEFINED_ENUM_CONSTANT',
"There's no constant named '{0}' in '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing constant, or defining a constant named '{0}'.",
hasPublishedDocs: true,
);
@@ -13946,7 +13973,7 @@
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_GETTER',
"The getter '{0}' isn't defined for the extension '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing getter, or defining a getter named '{0}'.",
hasPublishedDocs: true,
);
@@ -14048,7 +14075,7 @@
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_METHOD',
"The method '{0}' isn't defined for the extension '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing method, or defining a method named '{0}'.",
hasPublishedDocs: true,
);
@@ -14102,7 +14129,7 @@
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_OPERATOR',
"The operator '{0}' isn't defined for the extension '{1}'.",
- correction: "Try defining the operator '{0}'.",
+ correctionMessage: "Try defining the operator '{0}'.",
hasPublishedDocs: true,
);
@@ -14205,7 +14232,7 @@
CompileTimeErrorCode(
'UNDEFINED_EXTENSION_SETTER',
"The setter '{0}' isn't defined for the extension '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing setter, or defining a setter named '{0}'.",
hasPublishedDocs: true,
);
@@ -14252,7 +14279,7 @@
static const CompileTimeErrorCode UNDEFINED_FUNCTION = CompileTimeErrorCode(
'UNDEFINED_FUNCTION',
"The function '{0}' isn't defined.",
- correction:
+ correctionMessage:
"Try importing the library that defines '{0}', correcting the name to the name of an existing function, or defining a function named '{0}'.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
@@ -14290,7 +14317,7 @@
static const CompileTimeErrorCode UNDEFINED_GETTER = CompileTimeErrorCode(
'UNDEFINED_GETTER',
"The getter '{0}' isn't defined for the type '{1}'.",
- correction:
+ correctionMessage:
"Try importing the library that defines '{0}', correcting the name to the name of an existing getter, or defining a getter or field named '{0}'.",
hasPublishedDocs: true,
);
@@ -14304,7 +14331,7 @@
CompileTimeErrorCode(
'UNDEFINED_GETTER',
"The getter '{0}' isn't defined for the '{1}' function type.",
- correction:
+ correctionMessage:
"Try wrapping the function type alias in parentheses in order to access '{0}' as an extension getter on 'Type'.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_GETTER_ON_FUNCTION_TYPE',
@@ -14344,7 +14371,7 @@
static const CompileTimeErrorCode UNDEFINED_IDENTIFIER = CompileTimeErrorCode(
'UNDEFINED_IDENTIFIER',
"Undefined name '{0}'.",
- correction:
+ correctionMessage:
"Try correcting the name to one that is defined, or defining the name.",
hasPublishedDocs: true,
isUnresolvedIdentifier: true,
@@ -14381,7 +14408,7 @@
CompileTimeErrorCode(
'UNDEFINED_IDENTIFIER_AWAIT',
"Undefined name 'await' in function body not marked with 'async'.",
- correction:
+ correctionMessage:
"Try correcting the name to one that is defined, defining the name, or adding 'async' to the enclosing function body.",
hasPublishedDocs: true,
);
@@ -14418,7 +14445,7 @@
static const CompileTimeErrorCode UNDEFINED_METHOD = CompileTimeErrorCode(
'UNDEFINED_METHOD',
"The method '{0}' isn't defined for the type '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing method, or defining a method named '{0}'.",
hasPublishedDocs: true,
);
@@ -14432,7 +14459,7 @@
CompileTimeErrorCode(
'UNDEFINED_METHOD',
"The method '{0}' isn't defined for the '{1}' function type.",
- correction:
+ correctionMessage:
"Try wrapping the function type alias in parentheses in order to access '{0}' as an extension method on 'Type'.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_METHOD_ON_FUNCTION_TYPE',
@@ -14514,7 +14541,7 @@
CompileTimeErrorCode(
'UNDEFINED_NAMED_PARAMETER',
"The named parameter '{0}' isn't defined.",
- correction:
+ correctionMessage:
"Try correcting the name to an existing named parameter's name, or defining a named parameter with the name '{0}'.",
hasPublishedDocs: true,
);
@@ -14554,7 +14581,7 @@
static const CompileTimeErrorCode UNDEFINED_OPERATOR = CompileTimeErrorCode(
'UNDEFINED_OPERATOR',
"The operator '{0}' isn't defined for the type '{1}'.",
- correction: "Try defining the operator '{0}'.",
+ correctionMessage: "Try defining the operator '{0}'.",
hasPublishedDocs: true,
);
@@ -14591,7 +14618,7 @@
CompileTimeErrorCode(
'UNDEFINED_PREFIXED_NAME',
"The name '{0}' is being referenced through the prefix '{1}', but it isn't defined in any of the libraries imported using that prefix.",
- correction:
+ correctionMessage:
"Try correcting the prefix or importing the library that defines '{0}'.",
hasPublishedDocs: true,
);
@@ -14638,7 +14665,7 @@
static const CompileTimeErrorCode UNDEFINED_SETTER = CompileTimeErrorCode(
'UNDEFINED_SETTER',
"The setter '{0}' isn't defined for the type '{1}'.",
- correction:
+ correctionMessage:
"Try importing the library that defines '{0}', correcting the name to the name of an existing setter, or defining a setter or field named '{0}'.",
hasPublishedDocs: true,
);
@@ -14652,7 +14679,7 @@
CompileTimeErrorCode(
'UNDEFINED_SETTER',
"The setter '{0}' isn't defined for the '{1}' function type.",
- correction:
+ correctionMessage:
"Try wrapping the function type alias in parentheses in order to access '{0}' as an extension getter on 'Type'.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_SETTER_ON_FUNCTION_TYPE',
@@ -14667,7 +14694,7 @@
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
"The getter '{0}' isn't defined in a superclass of '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing getter, or defining a getter or field named '{0}' in a superclass.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_SUPER_GETTER',
@@ -14722,7 +14749,7 @@
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
"The method '{0}' isn't defined in a superclass of '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing method, or defining a method named '{0}' in a superclass.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_SUPER_METHOD',
@@ -14737,7 +14764,7 @@
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
"The operator '{0}' isn't defined in a superclass of '{1}'.",
- correction: "Try defining the operator '{0}' in a superclass.",
+ correctionMessage: "Try defining the operator '{0}' in a superclass.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_SUPER_OPERATOR',
);
@@ -14751,7 +14778,7 @@
CompileTimeErrorCode(
'UNDEFINED_SUPER_MEMBER',
"The setter '{0}' isn't defined in a superclass of '{1}'.",
- correction:
+ correctionMessage:
"Try correcting the name to the name of an existing setter, or defining a setter or field named '{0}' in a superclass.",
hasPublishedDocs: true,
uniqueName: 'UNDEFINED_SUPER_SETTER',
@@ -14805,7 +14832,7 @@
UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = CompileTimeErrorCode(
'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER',
"Static members from supertypes must be qualified by the name of the defining type.",
- correction: "Try adding '{0}.' before the name.",
+ correctionMessage: "Try adding '{0}.' before the name.",
hasPublishedDocs: true,
);
@@ -14874,7 +14901,7 @@
CompileTimeErrorCode(
'UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE',
"Static members from the extended type or one of its superclasses must be qualified by the name of the defining type.",
- correction: "Try adding '{0}.' before the name.",
+ correctionMessage: "Try adding '{0}.' before the name.",
hasPublishedDocs: true,
);
@@ -14904,7 +14931,7 @@
static const CompileTimeErrorCode URI_DOES_NOT_EXIST = CompileTimeErrorCode(
'URI_DOES_NOT_EXIST',
"Target of URI doesn't exist: '{0}'.",
- correction:
+ correctionMessage:
"Try creating the file referenced by the URI, or Try using a URI for a file that does exist.",
hasPublishedDocs: true,
);
@@ -14946,7 +14973,7 @@
CompileTimeErrorCode(
'URI_HAS_NOT_BEEN_GENERATED',
"Target of URI hasn't been generated: '{0}'.",
- correction:
+ correctionMessage:
"Try running the generator that will generate the file referenced by the URI.",
hasPublishedDocs: true,
);
@@ -15019,7 +15046,7 @@
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.",
- correction:
+ correctionMessage:
"Try checking to see if you're using the correct API; there might be a function or call that returns void you didn't expect. Also check type parameters and variables which might also be void.",
hasPublishedDocs: true,
);
@@ -15068,7 +15095,7 @@
CompileTimeErrorCode(
'VARIABLE_TYPE_MISMATCH',
"A value of type '{0}' can't be assigned to a const variable of type '{1}'.",
- correction: "Try using a subtype, or removing the 'const' keyword",
+ correctionMessage: "Try using a subtype, or removing the 'const' keyword",
hasPublishedDocs: true,
);
@@ -15094,7 +15121,7 @@
CompileTimeErrorCode(
'WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE',
"'{0}' is an '{1}' type parameter and can't be used in an '{2}' position in '{3}'.",
- correction:
+ correctionMessage:
"Try using 'in' type parameters in 'in' positions and 'out' type parameters in 'out' positions in the superinterface.",
);
@@ -15253,7 +15280,7 @@
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS',
"The type '{0}' is declared with {1} type parameters, but {2} type arguments were given.",
- correction:
+ correctionMessage:
"Try adjusting the number of type arguments to match the number of type parameters.",
hasPublishedDocs: true,
);
@@ -15267,7 +15294,7 @@
WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION = CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION',
"This function is declared with {0} type parameters, but {1} type arguments were given.",
- correction:
+ correctionMessage:
"Try adjusting the number of type arguments to match the number of type parameters.",
uniqueName: 'WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION',
);
@@ -15323,7 +15350,7 @@
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR',
"The constructor '{0}.{1}' doesn't have type parameters.",
- correction: "Try moving type arguments to after the type name.",
+ correctionMessage: "Try moving type arguments to after the type name.",
hasPublishedDocs: true,
);
@@ -15373,7 +15400,7 @@
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_EXTENSION',
"The extension '{0}' is declared with {1} type parameters, but {2} type arguments were given.",
- correction: "Try adjusting the number of type arguments.",
+ correctionMessage: "Try adjusting the number of type arguments.",
hasPublishedDocs: true,
);
@@ -15387,7 +15414,7 @@
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION',
"The function '{0}' is declared with {1} type parameters, but {2} type arguments were given.",
- correction:
+ correctionMessage:
"Try adjusting the number of type arguments to match the number of type parameters.",
);
@@ -15444,7 +15471,7 @@
CompileTimeErrorCode(
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD',
"The method '{0}' is declared with {1} type parameters, but {2} type arguments are given.",
- correction: "Try adjusting the number of type arguments.",
+ correctionMessage: "Try adjusting the number of type arguments.",
hasPublishedDocs: true,
);
@@ -15457,7 +15484,7 @@
WRONG_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE = CompileTimeErrorCode(
'WRONG_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE',
"'{0}' can't be used contravariantly or invariantly in '{1}'.",
- correction:
+ correctionMessage:
"Try not using class type parameters in types of formal parameters of function types, nor in explicitly contravariant or invariant superinterfaces.",
);
@@ -15483,7 +15510,7 @@
CompileTimeErrorCode(
'WRONG_TYPE_PARAMETER_VARIANCE_POSITION',
"The '{0}' type parameter '{1}' can't be used in an '{2}' position.",
- correction:
+ correctionMessage:
"Try removing the type parameter or change the explicit variance modifier declaration for the type parameter to another one of 'in', 'out', or 'inout'.",
);
@@ -15531,7 +15558,8 @@
CompileTimeErrorCode(
'YIELD_IN_NON_GENERATOR',
"Yield-each statements must be in a generator function (one marked with either 'async*' or 'sync*').",
- correction: "Try adding 'async*' or 'sync*' to the enclosing function.",
+ correctionMessage:
+ "Try adding 'async*' or 'sync*' to the enclosing function.",
hasPublishedDocs: true,
uniqueName: 'YIELD_EACH_IN_NON_GENERATOR',
);
@@ -15546,7 +15574,8 @@
CompileTimeErrorCode(
'YIELD_IN_NON_GENERATOR',
"Yield statements must be in a generator function (one marked with either 'async*' or 'sync*').",
- correction: "Try adding 'async*' or 'sync*' to the enclosing function.",
+ correctionMessage:
+ "Try adding 'async*' or 'sync*' to the enclosing function.",
hasPublishedDocs: true,
);
@@ -15603,17 +15632,17 @@
/// Initialize a newly created error code to have the given [name].
const CompileTimeErrorCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'CompileTimeErrorCode.${uniqueName ?? name}',
);
@@ -15628,87 +15657,87 @@
static const LanguageCode IMPLICIT_DYNAMIC_FIELD = LanguageCode(
'IMPLICIT_DYNAMIC_FIELD',
"Missing field type for '{0}'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_FUNCTION = LanguageCode(
'IMPLICIT_DYNAMIC_FUNCTION',
"Missing type arguments for generic function '{0}<{1}>'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_INVOKE = LanguageCode(
'IMPLICIT_DYNAMIC_INVOKE',
"Missing type arguments for calling generic function type '{0}'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_LIST_LITERAL = LanguageCode(
'IMPLICIT_DYNAMIC_LIST_LITERAL',
"Missing type argument for list literal.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_MAP_LITERAL = LanguageCode(
'IMPLICIT_DYNAMIC_MAP_LITERAL',
"Missing type arguments for map literal.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_METHOD = LanguageCode(
'IMPLICIT_DYNAMIC_METHOD',
"Missing type arguments for generic method '{0}<{1}>'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_PARAMETER = LanguageCode(
'IMPLICIT_DYNAMIC_PARAMETER',
"Missing parameter type for '{0}'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_RETURN = LanguageCode(
'IMPLICIT_DYNAMIC_RETURN',
"Missing return type for '{0}'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_TYPE = LanguageCode(
'IMPLICIT_DYNAMIC_TYPE',
"Missing type arguments for generic type '{0}'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
static const LanguageCode IMPLICIT_DYNAMIC_VARIABLE = LanguageCode(
'IMPLICIT_DYNAMIC_VARIABLE',
"Missing variable type for '{0}'.",
- correction:
+ correctionMessage:
"Try adding an explicit type, or remove implicit-dynamic from your analysis options file.",
);
/// Initialize a newly created error code to have the given [name].
const LanguageCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'LanguageCode.${uniqueName ?? name}',
);
@@ -15799,7 +15828,7 @@
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.",
- correction: "Try removing the operator and the right operand.",
+ correctionMessage: "Try removing the operator and the right operand.",
hasPublishedDocs: true,
);
@@ -15880,7 +15909,7 @@
StaticWarningCode(
'INVALID_NULL_AWARE_OPERATOR',
"The receiver can't be null, so the null-aware operator '{0}' is unnecessary.",
- correction: "Try replacing the operator '{0}' with '{1}'.",
+ correctionMessage: "Try replacing the operator '{0}' with '{1}'.",
hasPublishedDocs: true,
);
@@ -15893,7 +15922,7 @@
INVALID_NULL_AWARE_OPERATOR_AFTER_SHORT_CIRCUIT = StaticWarningCode(
'INVALID_NULL_AWARE_OPERATOR',
"The receiver can't be null because of short-circuiting, so the null-aware operator '{0}' can't be used.",
- correction: "Try replacing the operator '{0}' with '{1}'.",
+ correctionMessage: "Try replacing the operator '{0}' with '{1}'.",
hasPublishedDocs: true,
uniqueName: 'INVALID_NULL_AWARE_OPERATOR_AFTER_SHORT_CIRCUIT',
);
@@ -15909,7 +15938,7 @@
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED',
"Parameters can't override default values, this method overrides '{0}.{1}' where '{2}' has a different value.",
- correction: "Try using the same default value in both methods.",
+ correctionMessage: "Try using the same default value in both methods.",
);
/**
@@ -15923,7 +15952,7 @@
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL = StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL',
"Parameters can't override default values, this method overrides '{0}.{1}' where this positional parameter has a different value.",
- correction: "Try using the same default value in both methods.",
+ correctionMessage: "Try using the same default value in both methods.",
);
/**
@@ -15993,7 +16022,7 @@
StaticWarningCode(
'MISSING_ENUM_CONSTANT_IN_SWITCH',
"Missing case clause for '{0}'.",
- correction:
+ correctionMessage:
"Try adding a case clause for the missing constant, or adding a default clause.",
hasPublishedDocs: true,
);
@@ -16029,24 +16058,24 @@
StaticWarningCode(
'UNNECESSARY_NON_NULL_ASSERTION',
"The '!' will have no effect because the receiver can't be null.",
- correction: "Try removing the '!' operator.",
+ correctionMessage: "Try removing the '!' operator.",
hasPublishedDocs: true,
);
/// Initialize a newly created error code to have the given [name].
const StaticWarningCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'StaticWarningCode.${uniqueName ?? name}',
);
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index 83fbc88..3c3ce2d 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -8,12 +8,14 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/type_algebra.dart';
import 'package:analyzer/src/dart/element/type_schema.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
+import 'package:analyzer/src/diagnostic/diagnostic.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
import 'package:analyzer/src/generated/resolver.dart';
@@ -265,18 +267,21 @@
/// Verify that the type arguments in the given [namedType] are all within
/// their bounds.
void _checkForTypeArgumentNotMatchingBounds(NamedType namedType) {
- var type = namedType.type;
+ final type = namedType.type;
if (type == null) {
return;
}
- List<TypeParameterElement> typeParameters;
- List<DartType> typeArguments;
- var alias = type.alias;
+ final List<TypeParameterElement> typeParameters;
+ final String elementName;
+ final List<DartType> typeArguments;
+ final alias = type.alias;
if (alias != null) {
+ elementName = alias.element.name;
typeParameters = alias.element.typeParameters;
typeArguments = alias.typeArguments;
} else if (type is InterfaceType) {
+ elementName = type.element.name;
typeParameters = type.element.typeParameters;
typeArguments = type.typeArguments;
} else {
@@ -289,7 +294,7 @@
// Check for regular-bounded.
List<_TypeArgumentIssue>? issues;
- var substitution = Substitution.fromPairs(typeParameters, typeArguments);
+ final substitution = Substitution.fromPairs(typeParameters, typeArguments);
for (var i = 0; i < typeArguments.length; i++) {
var typeParameter = typeParameters[i];
var typeArgument = typeArguments[i];
@@ -325,6 +330,49 @@
return;
}
+ List<DiagnosticMessage>? buildContextMessages({
+ List<DartType>? invertedTypeArguments,
+ }) {
+ final messages = <DiagnosticMessage>[];
+
+ void addMessage(String message) {
+ messages.add(
+ DiagnosticMessageImpl(
+ filePath: _errorReporter.source.fullName,
+ length: namedType.length,
+ message: message,
+ offset: namedType.offset,
+ url: null,
+ ),
+ );
+ }
+
+ String typeArgumentsToString(List<DartType> typeArguments) {
+ return typeArguments
+ .map((e) => e.getDisplayString(withNullability: true))
+ .join(', ');
+ }
+
+ if (namedType.typeArguments == null) {
+ var typeStr = '$elementName<${typeArgumentsToString(typeArguments)}>';
+ addMessage(
+ "The raw type was instantiated as '$typeStr', "
+ "and is not regular-bounded.",
+ );
+ }
+
+ if (invertedTypeArguments != null) {
+ var invertedTypeStr =
+ '$elementName<${typeArgumentsToString(invertedTypeArguments)}>';
+ addMessage(
+ "The inverted type '$invertedTypeStr' is also not regular-bounded, "
+ "so the type is not well-bounded.",
+ );
+ }
+
+ return messages.isNotEmpty ? messages : null;
+ }
+
// If not allowed to be super-bounded, report issues.
if (!_shouldAllowSuperBoundedTypes(namedType)) {
for (var issue in issues) {
@@ -332,27 +380,32 @@
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
_typeArgumentErrorNode(namedType, issue.index),
[issue.argument, issue.parameter.name, issue.parameterBound],
+ buildContextMessages(),
);
}
return;
}
// Prepare type arguments for checking for super-bounded.
- type = _typeSystem.replaceTopAndBottom(type);
- alias = type.alias;
- if (alias != null) {
- typeArguments = alias.typeArguments;
- } else if (type is InterfaceType) {
- typeArguments = type.typeArguments;
+ final invertedType = _typeSystem.replaceTopAndBottom(type);
+ final List<DartType> invertedTypeArguments;
+ final invertedAlias = invertedType.alias;
+ if (invertedAlias != null) {
+ invertedTypeArguments = invertedAlias.typeArguments;
+ } else if (invertedType is InterfaceType) {
+ invertedTypeArguments = invertedType.typeArguments;
} else {
return;
}
// Check for super-bounded.
- substitution = Substitution.fromPairs(typeParameters, typeArguments);
- for (var i = 0; i < typeArguments.length; i++) {
+ final invertedSubstitution = Substitution.fromPairs(
+ typeParameters,
+ invertedTypeArguments,
+ );
+ for (var i = 0; i < invertedTypeArguments.length; i++) {
var typeParameter = typeParameters[i];
- var typeArgument = typeArguments[i];
+ var typeArgument = invertedTypeArguments[i];
var bound = typeParameter.bound;
if (bound == null) {
@@ -360,13 +413,16 @@
}
bound = _libraryElement.toLegacyTypeIfOptOut(bound);
- bound = substitution.substituteType(bound);
+ bound = invertedSubstitution.substituteType(bound);
if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
_typeArgumentErrorNode(namedType, i),
[typeArgument, typeParameter.name, bound],
+ buildContextMessages(
+ invertedTypeArguments: invertedTypeArguments,
+ ),
);
}
}
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index d1b9366..9ffdfb3 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -56,7 +56,7 @@
set enableSetLiterals(bool value) {
// TODO(danrubel): Remove this method once the reference to this flag
- // has been removed from dartfmt.
+ // has been removed from dart format.
}
set parseFunctionBodies(bool parseFunctionBodies) {
diff --git a/pkg/analyzer/lib/src/lint/options_rule_validator.dart b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
index 6f326b1..f4d536b 100644
--- a/pkg/analyzer/lib/src/lint/options_rule_validator.dart
+++ b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
@@ -29,7 +29,7 @@
const AnalysisOptionsHintCode DUPLICATE_RULE_HINT = AnalysisOptionsHintCode(
'DUPLICATE_RULE',
"The rule {0} is already specified and doesn't need to be specified again.",
- correction: "Try removing all but one specification of the rule.");
+ correctionMessage: "Try removing all but one specification of the rule.");
/// An error code indicating an incompatible rule.
///
@@ -39,7 +39,7 @@
const AnalysisOptionsWarningCode INCOMPATIBLE_LINT_WARNING =
AnalysisOptionsWarningCode('INCOMPATIBLE_LINT_WARNING',
"The rule '{0}' is incompatible with the rule '{1}'",
- correction: "Try removing one of the incompatible rules.");
+ correctionMessage: "Try removing one of the incompatible rules.");
/// An error code indicating an undefined lint rule.
///
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 73c4915..d988a94 100644
--- a/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
+++ b/pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
@@ -22,7 +22,7 @@
ManifestWarningCode(
'CAMERA_PERMISSIONS_INCOMPATIBLE',
"Camera permissions make app incompatible for Chrome OS, consider adding optional features \"android.hardware.camera\" and \"android.hardware.camera.autofocus\".",
- correction:
+ correctionMessage:
"Try adding `<uses-feature android:name=\"android.hardware.camera\" android:required=\"false\">` `<uses-feature android:name=\"android.hardware.camera.autofocus\" android:required=\"false\">`.",
);
@@ -32,7 +32,7 @@
static const ManifestWarningCode NON_RESIZABLE_ACTIVITY = ManifestWarningCode(
'NON_RESIZABLE_ACTIVITY',
"The `<activity>` element should be allowed to be resized to allow users to take advantage of the multi-window environment on Chrome OS",
- correction:
+ correctionMessage:
"Consider declaring the corresponding activity element with `resizableActivity=\"true\"` attribute.",
);
@@ -43,7 +43,7 @@
static const ManifestWarningCode NO_TOUCHSCREEN_FEATURE = ManifestWarningCode(
'NO_TOUCHSCREEN_FEATURE',
"The default \"android.hardware.touchscreen\" needs to be optional for Chrome OS. ",
- correction:
+ correctionMessage:
"Consider adding <uses-feature android:name=\"android.hardware.touchscreen\" android:required=\"false\" /> to the manifest.",
);
@@ -55,7 +55,7 @@
ManifestWarningCode(
'PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE',
"Permission makes app incompatible for Chrome OS, consider adding optional {0} feature tag, ",
- correction:
+ correctionMessage:
" Try adding `<uses-feature android:name=\"{0}\" android:required=\"false\">`.",
);
@@ -66,7 +66,7 @@
ManifestWarningCode(
'SETTING_ORIENTATION_ON_ACTIVITY',
"The `<activity>` element should not be locked to any orientation so that users can take advantage of the multi-window environments and larger screens on Chrome OS",
- correction:
+ correctionMessage:
"Consider declaring the corresponding activity element with `screenOrientation=\"unspecified\"` or `\"fullSensor\"` attribute.",
);
@@ -77,7 +77,7 @@
ManifestWarningCode(
'UNSUPPORTED_CHROME_OS_FEATURE',
"The feature {0} is not supported on Chrome OS, consider making it optional.",
- correction:
+ correctionMessage:
"Try changing to `android:required=\"false\"` for this feature.",
);
@@ -89,23 +89,24 @@
ManifestWarningCode(
'UNSUPPORTED_CHROME_OS_HARDWARE',
"The feature {0} is not supported on Chrome OS, consider making it optional.",
- correction: "Try adding `android:required=\"false\"` for this feature.",
+ correctionMessage:
+ "Try adding `android:required=\"false\"` for this feature.",
);
/// Initialize a newly created error code to have the given [name].
const ManifestWarningCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'ManifestWarningCode.${uniqueName ?? name}',
);
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 fe4471c..c093216 100644
--- a/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
+++ b/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
@@ -47,7 +47,7 @@
PubspecWarningCode(
'ASSET_DIRECTORY_DOES_NOT_EXIST',
"The asset directory '{0}' doesn't exist.",
- correction:
+ correctionMessage:
"Try creating the directory or fixing the path to the directory.",
hasPublishedDocs: true,
);
@@ -83,7 +83,7 @@
static const PubspecWarningCode ASSET_DOES_NOT_EXIST = PubspecWarningCode(
'ASSET_DOES_NOT_EXIST',
"The asset file '{0}' doesn't exist.",
- correction: "Try creating the file or fixing the path to the file.",
+ correctionMessage: "Try creating the file or fixing the path to the file.",
hasPublishedDocs: true,
);
@@ -121,7 +121,8 @@
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 paths.",
- correction: "Try converting the value to be a list of relative file paths.",
+ correctionMessage:
+ "Try converting the value to be a list of relative file paths.",
hasPublishedDocs: true,
);
@@ -161,7 +162,7 @@
static const PubspecWarningCode ASSET_NOT_STRING = PubspecWarningCode(
'ASSET_NOT_STRING',
"Assets are required to be file paths (strings).",
- correction: "Try converting the value to be a string.",
+ correctionMessage: "Try converting the value to be a string.",
hasPublishedDocs: true,
);
@@ -199,7 +200,7 @@
PubspecWarningCode(
'DEPENDENCIES_FIELD_NOT_MAP',
"The value of the '{0}' field is expected to be a map.",
- correction: "Try converting the value to be a map.",
+ correctionMessage: "Try converting the value to be a map.",
hasPublishedDocs: true,
);
@@ -234,7 +235,7 @@
static const PubspecWarningCode DEPRECATED_FIELD = PubspecWarningCode(
'DEPRECATED_FIELD',
"The '{0}' field is no longer used and can be removed.",
- correction: "Try removing the field.",
+ correctionMessage: "Try removing the field.",
hasPublishedDocs: true,
);
@@ -279,7 +280,7 @@
static const PubspecWarningCode FLUTTER_FIELD_NOT_MAP = PubspecWarningCode(
'FLUTTER_FIELD_NOT_MAP',
"The value of the 'flutter' field is expected to be a map.",
- correction: "Try converting the value to be a map.",
+ correctionMessage: "Try converting the value to be a map.",
hasPublishedDocs: true,
);
@@ -335,7 +336,7 @@
static const PubspecWarningCode INVALID_DEPENDENCY = PubspecWarningCode(
'INVALID_DEPENDENCY',
"Publishable packages can't have '{0}' dependencies.",
- correction:
+ correctionMessage:
"Try adding a 'publish_to: none' entry to mark the package as not for publishing or remove the {0} dependency.",
hasPublishedDocs: true,
);
@@ -372,7 +373,7 @@
static const PubspecWarningCode MISSING_NAME = PubspecWarningCode(
'MISSING_NAME',
"The 'name' field is required but missing.",
- correction: "Try adding a field named 'name'.",
+ correctionMessage: "Try adding a field named 'name'.",
hasPublishedDocs: true,
);
@@ -406,7 +407,7 @@
static const PubspecWarningCode NAME_NOT_STRING = PubspecWarningCode(
'NAME_NOT_STRING',
"The value of the 'name' field is required to be a string.",
- correction: "Try converting the value to be a string.",
+ correctionMessage: "Try converting the value to be a string.",
hasPublishedDocs: true,
);
@@ -441,7 +442,8 @@
static const PubspecWarningCode PATH_DOES_NOT_EXIST = PubspecWarningCode(
'PATH_DOES_NOT_EXIST',
"The path '{0}' doesn't exist.",
- correction: "Try creating the referenced path or using a path that exists.",
+ correctionMessage:
+ "Try creating the referenced path or using a path that exists.",
hasPublishedDocs: true,
);
@@ -473,7 +475,7 @@
static const PubspecWarningCode PATH_NOT_POSIX = PubspecWarningCode(
'PATH_NOT_POSIX',
"The path '{0}' isn't a POSIX-style path.",
- correction: "Try converting the value to a POSIX-style path.",
+ correctionMessage: "Try converting the value to a POSIX-style path.",
hasPublishedDocs: true,
);
@@ -515,7 +517,7 @@
PubspecWarningCode(
'PATH_PUBSPEC_DOES_NOT_EXIST',
"The directory '{0}' doesn't contain a pubspec.",
- correction:
+ correctionMessage:
"Try creating a pubspec in the referenced directory or using a path that has a pubspec.",
hasPublishedDocs: true,
);
@@ -560,24 +562,24 @@
PubspecWarningCode(
'UNNECESSARY_DEV_DEPENDENCY',
"The dev dependency on {0} is unnecessary because there is also a normal dependency on that package.",
- correction: "Try removing the dev dependency.",
+ correctionMessage: "Try removing the dev dependency.",
hasPublishedDocs: true,
);
/// Initialize a newly created error code to have the given [name].
const PubspecWarningCode(
String name,
- String message, {
- String? correction,
+ String problemMessage, {
+ String? correctionMessage,
bool hasPublishedDocs = false,
bool isUnresolvedIdentifier = false,
String? uniqueName,
}) : super(
- correction: correction,
+ correctionMessage: correctionMessage,
hasPublishedDocs: hasPublishedDocs,
isUnresolvedIdentifier: isUnresolvedIdentifier,
- message: message,
name: name,
+ problemMessage: problemMessage,
uniqueName: 'PubspecWarningCode.${uniqueName ?? name}',
);
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 11b6ce1..e23271d 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -3508,8 +3508,10 @@
class C<T0 extends List<T1>, T1 extends List<T0>> {}
class D extends C {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 69, 1),
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 69, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 69, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 69, 1)]),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 69, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 69, 1)]),
]);
}
@@ -3523,8 +3525,9 @@
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 73, 1),
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 81, 1),
error(CompileTimeErrorCode.COULD_NOT_INFER, 81, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 81, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 81, 1)]),
]);
_assertLocalVarType('c', 'C<List<dynamic>, List<List<dynamic>>>');
}
@@ -3560,7 +3563,11 @@
class C<T extends F<T>> {}
C c;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 48, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 48, 1,
+ contextMessages: [
+ message('/home/test/lib/test.dart', 48, 1),
+ message('/home/test/lib/test.dart', 48, 1)
+ ]),
]);
_assertTopVarType('c', 'C<dynamic Function(dynamic)>');
}
diff --git a/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart b/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart
index 21f09c6..46d6e0d 100644
--- a/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart
@@ -562,7 +562,8 @@
return A.foo;
}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 41, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 41, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 39, 9)]),
]);
var classElement = findElement.class_('A');
diff --git a/pkg/analyzer/test/src/dart/resolution/type_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_literal_test.dart
index 8172670..866b8c3 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_literal_test.dart
@@ -75,7 +75,8 @@
class C<T extends num> {}
var t = C<String>;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 36, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 36, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 34, 9)]),
]);
var typeLiteral = findNode.typeLiteral('C<String>;');
@@ -142,7 +143,8 @@
typedef CA<T extends num> = C<T>;
var t = CA<String>;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 59, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 59, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 56, 10)]),
]);
var typeLiteral = findNode.typeLiteral('CA<String>;');
@@ -374,7 +376,8 @@
typedef Fn<T extends num> = void Function(T);
var t = Fn<String>;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 57, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 57, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 54, 10)]),
]);
var typeLiteral = findNode.typeLiteral('Fn<String>;');
diff --git a/pkg/analyzer/test/src/diagnostics/could_not_infer_test.dart b/pkg/analyzer/test/src/diagnostics/could_not_infer_test.dart
index 40b9bce..3e89e8f 100644
--- a/pkg/analyzer/test/src/diagnostics/could_not_infer_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/could_not_infer_test.dart
@@ -33,10 +33,12 @@
P._();
}
''', [
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 154, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 154, 1)]),
error(CompileTimeErrorCode.COULD_NOT_INFER, 154, 3),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 154, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 154, 1)]),
error(CompileTimeErrorCode.COULD_NOT_INFER, 154, 3),
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 154, 1),
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 154, 1),
]);
}
@@ -58,8 +60,9 @@
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 120, 1),
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 124, 1),
error(CompileTimeErrorCode.COULD_NOT_INFER, 124, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 124, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 124, 1)]),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart b/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart
index 79ab24a..3149899 100644
--- a/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart
@@ -129,7 +129,8 @@
C(G<B> this.f) {}
}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 71, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 71, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 69, 4)]),
]);
}
@@ -140,7 +141,8 @@
class G<E extends A> {}
G<B> f() => throw 0;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 48, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 48, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 46, 4)]),
]);
}
@@ -151,7 +153,8 @@
class G<E extends A> {}
typedef G<B> f();
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 56, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 56, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 54, 4)]),
]);
}
@@ -162,7 +165,8 @@
class G<E extends A> {}
f(G<B> h()) {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 50, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 50, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 48, 4)]),
]);
}
@@ -184,7 +188,8 @@
class G<E extends A> {}
var b = 1 is G<B>;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 61, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 61, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 59, 4)]),
]);
}
@@ -252,7 +257,8 @@
G<B> m() => throw 0;
}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 60, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 60, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 58, 4)]),
]);
}
@@ -297,7 +303,8 @@
class Baz extends Bar {}
void main() {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 65, 3),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 65, 3,
+ contextMessages: [message('/home/test/lib/test.dart', 65, 3)]),
]);
// Instantiate-to-bounds should have instantiated "Bar" to "Bar<Foo>".
assertType(result.unit.declaredElement!.getType('Baz')!.supertype,
@@ -311,7 +318,8 @@
typedef F<T extends A>();
F<B> fff = (throw 42);
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 50, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 50, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 48, 4)]),
]);
}
@@ -350,7 +358,8 @@
class G<E extends A> {}
f(G<B> g) {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 50, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 50, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 48, 4)]),
]);
}
@@ -376,7 +385,8 @@
class D<E extends A> {}
C<D<B>> c = (throw 0);
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 64, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 64, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 62, 4)]),
]);
}
@@ -388,7 +398,8 @@
class G<E extends A> {}
class D<F extends G<B>> {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 77, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 77, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 75, 4)]),
]);
}
@@ -399,7 +410,8 @@
class G<E extends A> {}
G<B> g = (throw 0);
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 48, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 48, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 46, 4)]),
]);
}
@@ -487,7 +499,8 @@
class CB<T extends F> {}
void f(CB<FB<F>> a) {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 119, 5),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 119, 5,
+ contextMessages: [message('/home/test/lib/test.dart', 116, 9)]),
]);
}
@@ -613,7 +626,8 @@
class A<T extends A<T>> {}
typedef X<T> = A;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 42, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 42, 1,
+ contextMessages: [message('/home/test/lib/test.dart', 42, 1)]),
]);
}
@@ -623,7 +637,8 @@
typedef X<T extends A> = Map<int, T>;
void f(X<String> a) {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 58, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 58, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 56, 9)]),
]);
}
@@ -642,7 +657,11 @@
typedef G<X extends A<X>> = void Function<Y extends X>();
foo(G g) {}
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 92, 1),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 92, 1,
+ contextMessages: [
+ message('/home/test/lib/test.dart', 92, 1),
+ message('/home/test/lib/test.dart', 92, 1)
+ ]),
]);
}
@@ -698,7 +717,8 @@
class C<T extends int> {}
var t = C<String>;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 36, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 36, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 34, 9)]),
]);
}
@@ -707,7 +727,8 @@
typedef Cb<T extends int> = void Function();
var t = Cb<String>;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 56, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 56, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 53, 10)]),
]);
}
@@ -717,7 +738,8 @@
typedef D<T extends int> = C;
var t = D<String>;
''', [
- error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 51, 6),
+ error(CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, 51, 6,
+ contextMessages: [message('/home/test/lib/test.dart', 49, 9)]),
]);
}
}
diff --git a/pkg/analyzer/test/src/lint/lint_rule_test.dart b/pkg/analyzer/test/src/lint/lint_rule_test.dart
index 9298033..e87f18a 100644
--- a/pkg/analyzer/test/src/lint/lint_rule_test.dart
+++ b/pkg/analyzer/test/src/lint/lint_rule_test.dart
@@ -65,7 +65,7 @@
const LintCode customCode = LintCode(
'hash_and_equals', 'Override `==` if overriding `hashCode`.',
- correction: 'Implement `==`.');
+ correctionMessage: 'Implement `==`.');
class CollectingReporter extends ErrorReporter {
ErrorCode? code;
diff --git a/pkg/analyzer/tool/messages/error_code_info.dart b/pkg/analyzer/tool/messages/error_code_info.dart
index 83a511e..2097815 100644
--- a/pkg/analyzer/tool/messages/error_code_info.dart
+++ b/pkg/analyzer/tool/messages/error_code_info.dart
@@ -192,7 +192,7 @@
',');
final correctionMessage = this.correctionMessage;
if (correctionMessage is String) {
- out.write('correction: ');
+ out.write('correctionMessage: ');
out.writeln(json.encode(
_convertTemplate(placeholderToIndexMap, correctionMessage)) +
',');
diff --git a/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart b/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart
index b1374d2..75b6f60 100644
--- a/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart
+++ b/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart
@@ -223,8 +223,8 @@
var otherComment = commentInfo.otherComment;
yamlCodes[uniqueNameSuffix] = ErrorCodeInfo(
sharedName: uniqueNameSuffix == name ? null : name,
- problemMessage: code.message,
- correctionMessage: code.correction,
+ problemMessage: code.problemMessage,
+ correctionMessage: code.correctionMessage,
isUnresolvedIdentifier: code.isUnresolvedIdentifier,
hasPublishedDocs: code.hasPublishedDocs,
comment: documentationComment,
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart
index f41653c..7f70d5c 100644
--- a/pkg/analyzer/tool/messages/generate.dart
+++ b/pkg/analyzer/tool/messages/generate.dart
@@ -207,17 +207,18 @@
out.writeln();
out.writeln('/// Initialize a newly created error code to have the given '
'[name].');
- out.writeln('const ${errorClass.name}(String name, String message, {');
- out.writeln('String? correction,');
+ out.writeln(
+ 'const ${errorClass.name}(String name, String problemMessage, {');
+ out.writeln('String? correctionMessage,');
out.writeln('bool hasPublishedDocs = false,');
out.writeln('bool isUnresolvedIdentifier = false,');
out.writeln('String? uniqueName,');
out.writeln('}) : super(');
- out.writeln('correction: correction,');
+ out.writeln('correctionMessage: correctionMessage,');
out.writeln('hasPublishedDocs: hasPublishedDocs,');
out.writeln('isUnresolvedIdentifier: isUnresolvedIdentifier,');
- out.writeln('message: message,');
out.writeln('name: name,');
+ out.writeln('problemMessage: problemMessage,');
out.writeln("uniqueName: '${errorClass.name}.\${uniqueName ?? name}',");
out.writeln(');');
out.writeln();
diff --git a/pkg/analyzer_cli/test/mocks.dart b/pkg/analyzer_cli/test/mocks.dart
index 70fd581..0115b91 100644
--- a/pkg/analyzer_cli/test/mocks.dart
+++ b/pkg/analyzer_cli/test/mocks.dart
@@ -92,7 +92,7 @@
MockErrorCode(this.type, this.errorSeverity, this.name);
@override
- String get correction {
+ String get correctionMessage {
throw StateError('Unexpected invocation of correction');
}
@@ -106,7 +106,7 @@
bool get isUnresolvedIdentifier => false;
@override
- String get message {
+ String get problemMessage {
throw StateError('Unexpected invocation of message');
}
diff --git a/pkg/analyzer_plugin/test/utilities/analyzer_converter_test.dart b/pkg/analyzer_plugin/test/utilities/analyzer_converter_test.dart
index 6b5ada3..2c17b0a 100644
--- a/pkg/analyzer_plugin/test/utilities/analyzer_converter_test.dart
+++ b/pkg/analyzer_plugin/test/utilities/analyzer_converter_test.dart
@@ -35,14 +35,14 @@
expect(pluginError, isNotNull);
var location = pluginError.location;
expect(pluginError.code, errorCode.name.toLowerCase());
- expect(pluginError.correction, errorCode.correction);
+ expect(pluginError.correction, errorCode.correctionMessage);
expect(location, isNotNull);
expect(location.file, analyzerError.source.fullName);
expect(location.length, analyzerError.length);
expect(location.offset, analyzerError.offset);
expect(location.startColumn, startColumn);
expect(location.startLine, startLine);
- expect(pluginError.message, errorCode.message);
+ expect(pluginError.message, errorCode.problemMessage);
expect(pluginError.severity,
converter.convertErrorSeverity(severity ?? errorCode.errorSeverity));
expect(pluginError.type, converter.convertErrorType(errorCode.type));
diff --git a/runtime/vm/heap/heap.cc b/runtime/vm/heap/heap.cc
index 97850c6..903803a 100644
--- a/runtime/vm/heap/heap.cc
+++ b/runtime/vm/heap/heap.cc
@@ -128,7 +128,7 @@
return addr;
}
// Before throwing an out-of-memory error try a synchronous GC.
- CollectAllGarbage(kLowMemory);
+ CollectAllGarbage(GCReason::kLowMemory);
WaitForSweeperTasks(thread);
}
uword addr = old_space_.TryAllocate(size, type, PageSpace::kForceGrowth);
@@ -160,7 +160,7 @@
}
// Attempt to free some external allocation by a scavenge. (If the total
// remains above the limit, next external alloc will trigger another.)
- CollectGarbage(kScavenge, kExternal);
+ CollectGarbage(GCType::kScavenge, GCReason::kExternal);
// Promotion may have pushed old space over its limit. Fall through for old
// space GC check.
} else {
@@ -170,11 +170,11 @@
if (old_space_.ReachedHardThreshold()) {
if (last_gc_was_old_space_) {
- CollectNewSpaceGarbage(Thread::Current(), kFull);
+ CollectNewSpaceGarbage(Thread::Current(), GCReason::kFull);
}
- CollectGarbage(kMarkSweep, kExternal);
+ CollectGarbage(GCType::kMarkSweep, GCReason::kExternal);
} else {
- CheckStartConcurrentMarking(Thread::Current(), kExternal);
+ CheckStartConcurrentMarking(Thread::Current(), GCReason::kExternal);
}
}
@@ -247,8 +247,8 @@
(old_space_->phase() != PageSpace::kDone)) {
if (old_space_->phase() == PageSpace::kAwaitingFinalization) {
ml.Exit();
- heap_->CollectOldSpaceGarbage(thread, Heap::kMarkSweep,
- Heap::kFinalize);
+ heap_->CollectOldSpaceGarbage(thread, GCType::kMarkSweep,
+ GCReason::kFinalize);
ml.Enter();
}
while (old_space_->tasks() > 0) {
@@ -372,7 +372,7 @@
// to shrink the root set (make old-space GC faster) and avoid
// intergenerational garbage (make old-space GC free more memory).
if (new_space_.ShouldPerformIdleScavenge(deadline)) {
- CollectNewSpaceGarbage(thread, kIdle);
+ CollectNewSpaceGarbage(thread, GCReason::kIdle);
}
// Check if we want to collect old-space, in decreasing order of cost.
@@ -383,7 +383,7 @@
// We prefer mark-compact over other old space GCs if we have enough time,
// since it removes old space fragmentation and frees up most memory.
// Blocks for O(heap), roughtly twice as costly as mark-sweep.
- CollectOldSpaceGarbage(thread, kMarkCompact, kIdle);
+ CollectOldSpaceGarbage(thread, GCType::kMarkCompact, GCReason::kIdle);
} else if (old_space_.ReachedHardThreshold()) {
// Even though the following GC may exceed our idle deadline, we need to
// ensure than that promotions during idle scavenges do not lead to
@@ -392,7 +392,7 @@
// the only place that checks the old space allocation limit.
// Compare the tail end of Heap::CollectNewSpaceGarbage.
// Blocks for O(heap).
- CollectOldSpaceGarbage(thread, kMarkSweep, kIdle);
+ CollectOldSpaceGarbage(thread, GCType::kMarkSweep, GCReason::kIdle);
} else if (old_space_.ShouldStartIdleMarkSweep(deadline) ||
old_space_.ReachedSoftThreshold()) {
// If we have both work to do and enough time, start or finish GC.
@@ -406,7 +406,7 @@
phase = old_space_.phase();
}
if (phase == PageSpace::kAwaitingFinalization) {
- CollectOldSpaceGarbage(thread, Heap::kMarkSweep, Heap::kFinalize);
+ CollectOldSpaceGarbage(thread, GCType::kMarkSweep, GCReason::kFinalize);
} else if (phase == PageSpace::kDone) {
StartConcurrentMarking(thread);
}
@@ -415,11 +415,13 @@
void Heap::NotifyLowMemory() {
TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "NotifyLowMemory");
- CollectMostGarbage(kLowMemory);
+ CollectMostGarbage(GCReason::kLowMemory);
}
void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) {
- ASSERT((reason != kOldSpace) && (reason != kPromotion));
+ ASSERT(reason != GCReason::kOldSpace);
+ ASSERT(reason != GCReason::kPromotion);
+ ASSERT(reason != GCReason::kFinalize);
if (thread->isolate_group() == Dart::vm_isolate_group()) {
// The vm isolate cannot safely collect garbage due to unvisited read-only
// handles and slots bootstrapped with RAW_NULL. Ignore GC requests to
@@ -429,12 +431,13 @@
}
{
GcSafepointOperationScope safepoint_operation(thread);
- RecordBeforeGC(kScavenge, reason);
- VMTagScope tagScope(thread, reason == kIdle ? VMTag::kGCIdleTagId
- : VMTag::kGCNewSpaceTagId);
+ RecordBeforeGC(GCType::kScavenge, reason);
+ VMTagScope tagScope(thread, reason == GCReason::kIdle
+ ? VMTag::kGCIdleTagId
+ : VMTag::kGCNewSpaceTagId);
TIMELINE_FUNCTION_GC_DURATION(thread, "EvacuateNewGeneration");
- new_space_.Evacuate();
- RecordAfterGC(kScavenge);
+ new_space_.Evacuate(reason);
+ RecordAfterGC(GCType::kScavenge);
PrintStats();
NOT_IN_PRODUCT(PrintStatsToTimeline(&tbes, reason));
last_gc_was_old_space_ = false;
@@ -443,7 +446,9 @@
void Heap::CollectNewSpaceGarbage(Thread* thread, GCReason reason) {
NoActiveIsolateScope no_active_isolate_scope;
- ASSERT((reason != kOldSpace) && (reason != kPromotion));
+ ASSERT(reason != GCReason::kOldSpace);
+ ASSERT(reason != GCReason::kPromotion);
+ ASSERT(reason != GCReason::kFinalize);
if (thread->isolate_group() == Dart::vm_isolate_group()) {
// The vm isolate cannot safely collect garbage due to unvisited read-only
// handles and slots bootstrapped with RAW_NULL. Ignore GC requests to
@@ -453,22 +458,24 @@
}
{
GcSafepointOperationScope safepoint_operation(thread);
- RecordBeforeGC(kScavenge, reason);
+ RecordBeforeGC(GCType::kScavenge, reason);
{
- VMTagScope tagScope(thread, reason == kIdle ? VMTag::kGCIdleTagId
- : VMTag::kGCNewSpaceTagId);
+ VMTagScope tagScope(thread, reason == GCReason::kIdle
+ ? VMTag::kGCIdleTagId
+ : VMTag::kGCNewSpaceTagId);
TIMELINE_FUNCTION_GC_DURATION_BASIC(thread, "CollectNewGeneration");
- new_space_.Scavenge();
- RecordAfterGC(kScavenge);
+ new_space_.Scavenge(reason);
+ RecordAfterGC(GCType::kScavenge);
PrintStats();
NOT_IN_PRODUCT(PrintStatsToTimeline(&tbes, reason));
last_gc_was_old_space_ = false;
}
- if (reason == kNewSpace) {
+ if (reason == GCReason::kNewSpace) {
if (old_space_.ReachedHardThreshold()) {
- CollectOldSpaceGarbage(thread, kMarkSweep, kPromotion);
+ CollectOldSpaceGarbage(thread, GCType::kMarkSweep,
+ GCReason::kPromotion);
} else {
- CheckStartConcurrentMarking(thread, kPromotion);
+ CheckStartConcurrentMarking(thread, GCReason::kPromotion);
}
}
}
@@ -479,10 +486,11 @@
GCReason reason) {
NoActiveIsolateScope no_active_isolate_scope;
- ASSERT(reason != kNewSpace);
- ASSERT(type != kScavenge);
+ ASSERT(type != GCType::kScavenge);
+ ASSERT(reason != GCReason::kNewSpace);
+ ASSERT(reason != GCReason::kStoreBuffer);
if (FLAG_use_compactor) {
- type = kMarkCompact;
+ type = GCType::kMarkCompact;
}
if (thread->isolate_group() == Dart::vm_isolate_group()) {
// The vm isolate cannot safely collect garbage due to unvisited read-only
@@ -501,10 +509,11 @@
/*at_safepoint=*/true);
RecordBeforeGC(type, reason);
- VMTagScope tagScope(thread, reason == kIdle ? VMTag::kGCIdleTagId
- : VMTag::kGCOldSpaceTagId);
+ VMTagScope tagScope(thread, reason == GCReason::kIdle
+ ? VMTag::kGCIdleTagId
+ : VMTag::kGCOldSpaceTagId);
TIMELINE_FUNCTION_GC_DURATION_BASIC(thread, "CollectOldGeneration");
- old_space_.CollectGarbage(type == kMarkCompact, true /* finish */);
+ old_space_.CollectGarbage(type == GCType::kMarkCompact, true /* finish */);
RecordAfterGC(type);
PrintStats();
NOT_IN_PRODUCT(PrintStatsToTimeline(&tbes, reason));
@@ -524,11 +533,11 @@
void Heap::CollectGarbage(GCType type, GCReason reason) {
Thread* thread = Thread::Current();
switch (type) {
- case kScavenge:
+ case GCType::kScavenge:
CollectNewSpaceGarbage(thread, reason);
break;
- case kMarkSweep:
- case kMarkCompact:
+ case GCType::kMarkSweep:
+ case GCType::kMarkCompact:
CollectOldSpaceGarbage(thread, type, reason);
break;
default:
@@ -539,18 +548,20 @@
void Heap::CollectGarbage(Space space) {
Thread* thread = Thread::Current();
if (space == kOld) {
- CollectOldSpaceGarbage(thread, kMarkSweep, kOldSpace);
+ CollectOldSpaceGarbage(thread, GCType::kMarkSweep, GCReason::kOldSpace);
} else {
ASSERT(space == kNew);
- CollectNewSpaceGarbage(thread, kNewSpace);
+ CollectNewSpaceGarbage(thread, GCReason::kNewSpace);
}
}
void Heap::CollectMostGarbage(GCReason reason) {
Thread* thread = Thread::Current();
CollectNewSpaceGarbage(thread, reason);
- CollectOldSpaceGarbage(
- thread, reason == kLowMemory ? kMarkCompact : kMarkSweep, reason);
+ CollectOldSpaceGarbage(thread,
+ reason == GCReason::kLowMemory ? GCType::kMarkCompact
+ : GCType::kMarkSweep,
+ reason);
}
void Heap::CollectAllGarbage(GCReason reason) {
@@ -563,10 +574,12 @@
// If incremental marking is happening, we need to finish the GC cycle
// and perform a follow-up GC to purge any "floating garbage" that may be
// retained by the incremental barrier.
- CollectOldSpaceGarbage(thread, kMarkSweep, reason);
+ CollectOldSpaceGarbage(thread, GCType::kMarkSweep, reason);
}
- CollectOldSpaceGarbage(
- thread, reason == kLowMemory ? kMarkCompact : kMarkSweep, reason);
+ CollectOldSpaceGarbage(thread,
+ reason == GCReason::kLowMemory ? GCType::kMarkCompact
+ : GCType::kMarkSweep,
+ reason);
WaitForSweeperTasks(thread);
}
@@ -589,7 +602,7 @@
// new-space GC. This check is the concurrent-marking equivalent to the
// new-space GC before synchronous-marking in CollectMostGarbage.
if (last_gc_was_old_space_) {
- CollectNewSpaceGarbage(thread, kFull);
+ CollectNewSpaceGarbage(thread, GCReason::kFull);
}
StartConcurrentMarking(thread);
@@ -608,7 +621,7 @@
ready = old_space_.phase() == PageSpace::kAwaitingFinalization;
}
if (ready) {
- CollectOldSpaceGarbage(thread, Heap::kMarkSweep, Heap::kFinalize);
+ CollectOldSpaceGarbage(thread, GCType::kMarkSweep, GCReason::kFinalize);
}
}
@@ -621,7 +634,7 @@
}
if (old_space_.phase() == PageSpace::kAwaitingFinalization) {
ml.Exit();
- CollectOldSpaceGarbage(thread, Heap::kMarkSweep, Heap::kFinalize);
+ CollectOldSpaceGarbage(thread, GCType::kMarkSweep, GCReason::kFinalize);
ml.Enter();
}
}
@@ -717,7 +730,7 @@
}
gc_on_nth_allocation_--;
if (gc_on_nth_allocation_ == 0) {
- CollectAllGarbage(kDebugging);
+ CollectAllGarbage(GCReason::kDebugging);
gc_on_nth_allocation_ = kNoForcedGarbageCollection;
} else {
// Prevent generated code from using the TLAB fast path on next allocation.
@@ -825,11 +838,11 @@
const char* Heap::GCTypeToString(GCType type) {
switch (type) {
- case kScavenge:
+ case GCType::kScavenge:
return "Scavenge";
- case kMarkSweep:
+ case GCType::kMarkSweep:
return "MarkSweep";
- case kMarkCompact:
+ case GCType::kMarkCompact:
return "MarkCompact";
default:
UNREACHABLE();
@@ -839,25 +852,27 @@
const char* Heap::GCReasonToString(GCReason gc_reason) {
switch (gc_reason) {
- case kNewSpace:
+ case GCReason::kNewSpace:
return "new space";
- case kPromotion:
+ case GCReason::kStoreBuffer:
+ return "store buffer";
+ case GCReason::kPromotion:
return "promotion";
- case kOldSpace:
+ case GCReason::kOldSpace:
return "old space";
- case kFinalize:
+ case GCReason::kFinalize:
return "finalize";
- case kFull:
+ case GCReason::kFull:
return "full";
- case kExternal:
+ case GCReason::kExternal:
return "external";
- case kIdle:
+ case GCReason::kIdle:
return "idle";
- case kLowMemory:
+ case GCReason::kLowMemory:
return "low memory";
- case kDebugging:
+ case GCReason::kDebugging:
return "debugging";
- case kSendAndExit:
+ case GCReason::kSendAndExit:
return "send_and_exit";
default:
UNREACHABLE();
@@ -1006,7 +1021,7 @@
void Heap::RecordAfterGC(GCType type) {
stats_.after_.micros_ = OS::GetCurrentMonotonicMicros();
int64_t delta = stats_.after_.micros_ - stats_.before_.micros_;
- if (stats_.type_ == kScavenge) {
+ if (stats_.type_ == GCType::kScavenge) {
new_space_.AddGCTime(delta);
new_space_.IncrementCollections();
} else {
diff --git a/runtime/vm/heap/heap.h b/runtime/vm/heap/heap.h
index a410336..a3973c1 100644
--- a/runtime/vm/heap/heap.h
+++ b/runtime/vm/heap/heap.h
@@ -51,25 +51,6 @@
kNumWeakSelectors
};
- enum GCType {
- kScavenge,
- kMarkSweep,
- kMarkCompact,
- };
-
- enum GCReason {
- kNewSpace, // New space is full.
- kPromotion, // Old space limit crossed after a scavenge.
- kOldSpace, // Old space limit crossed.
- kFinalize, // Concurrent marking finished.
- kFull, // Heap::CollectAllGarbage
- kExternal, // Dart_NewFinalizableHandle Dart_NewWeakPersistentHandle
- kIdle, // Dart_NotifyIdle
- kLowMemory, // Dart_NotifyLowMemory
- kDebugging, // service request, etc.
- kSendAndExit, // SendPort.sendAndExit
- };
-
// Pattern for unused new space and swept old space.
static const uint8_t kZapByte = 0xf3;
@@ -136,13 +117,13 @@
// mark-sweep treats new space as roots, a cycle between unreachable old and
// new objects will not be collected until the new objects are promoted.
// Verification based on heap iteration should instead use CollectAllGarbage.
- void CollectMostGarbage(GCReason reason = kFull);
+ void CollectMostGarbage(GCReason reason = GCReason::kFull);
// Collect both generations by performing an evacuation followed by a
// mark-sweep. If incremental marking was in progress, perform another
// mark-sweep. This function will collect all unreachable objects, including
// those in inter-generational cycles or stored during incremental marking.
- void CollectAllGarbage(GCReason reason = kFull);
+ void CollectAllGarbage(GCReason reason = GCReason::kFull);
void CheckStartConcurrentMarking(Thread* thread, GCReason reason);
void StartConcurrentMarking(Thread* thread);
@@ -331,8 +312,8 @@
public:
GCStats() {}
intptr_t num_;
- Heap::GCType type_;
- Heap::GCReason reason_;
+ GCType type_;
+ GCReason reason_;
class Data : public ValueObject {
public:
@@ -503,7 +484,7 @@
static void CollectNewSpace() {
Thread* thread = Thread::Current();
ASSERT(thread->execution_state() == Thread::kThreadInVM);
- thread->heap()->new_space()->Scavenge();
+ thread->heap()->new_space()->Scavenge(GCReason::kDebugging);
}
// Fully collect old gen and wait for the sweeper to finish. The normal call
@@ -514,16 +495,16 @@
Thread* thread = Thread::Current();
ASSERT(thread->execution_state() == Thread::kThreadInVM);
if (thread->is_marking()) {
- thread->heap()->CollectGarbage(Heap::kMarkSweep, Heap::kDebugging);
+ thread->heap()->CollectGarbage(GCType::kMarkSweep, GCReason::kDebugging);
}
- thread->heap()->CollectGarbage(Heap::kMarkSweep, Heap::kDebugging);
+ thread->heap()->CollectGarbage(GCType::kMarkSweep, GCReason::kDebugging);
WaitForGCTasks();
}
static void CollectAllGarbage() {
Thread* thread = Thread::Current();
ASSERT(thread->execution_state() == Thread::kThreadInVM);
- thread->heap()->CollectAllGarbage(Heap::kDebugging);
+ thread->heap()->CollectAllGarbage(GCReason::kDebugging);
}
static void WaitForGCTasks() {
diff --git a/runtime/vm/heap/heap_test.cc b/runtime/vm/heap/heap_test.cc
index e1f9c82..abbfc5d 100644
--- a/runtime/vm/heap/heap_test.cc
+++ b/runtime/vm/heap/heap_test.cc
@@ -512,11 +512,11 @@
class HeapTestHelper {
public:
static void Scavenge(Thread* thread) {
- thread->heap()->CollectNewSpaceGarbage(thread, Heap::kDebugging);
+ thread->heap()->CollectNewSpaceGarbage(thread, GCReason::kDebugging);
}
static void MarkSweep(Thread* thread) {
- thread->heap()->CollectOldSpaceGarbage(thread, Heap::kMarkSweep,
- Heap::kDebugging);
+ thread->heap()->CollectOldSpaceGarbage(thread, GCType::kMarkSweep,
+ GCReason::kDebugging);
thread->heap()->WaitForMarkerTasks(thread);
thread->heap()->WaitForSweeperTasks(thread);
}
diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc
index 0c8a740..db1541a 100644
--- a/runtime/vm/heap/pages.cc
+++ b/runtime/vm/heap/pages.cc
@@ -471,7 +471,7 @@
Thread* thread = Thread::Current();
if (thread->CanCollectGarbage()) {
heap_->CheckFinishConcurrentMarking(thread);
- heap_->CheckStartConcurrentMarking(thread, Heap::kOldSpace);
+ heap_->CheckStartConcurrentMarking(thread, GCReason::kOldSpace);
}
}
}
diff --git a/runtime/vm/heap/safepoint.cc b/runtime/vm/heap/safepoint.cc
index 52da48b..c2e8d9a 100644
--- a/runtime/vm/heap/safepoint.cc
+++ b/runtime/vm/heap/safepoint.cc
@@ -63,9 +63,9 @@
ASSERT(T->CanCollectGarbage());
// Check if we passed the growth limit during the scope.
if (heap->old_space()->ReachedHardThreshold()) {
- heap->CollectGarbage(Heap::kMarkSweep, Heap::kOldSpace);
+ heap->CollectGarbage(GCType::kMarkSweep, GCReason::kOldSpace);
} else {
- heap->CheckStartConcurrentMarking(T, Heap::kOldSpace);
+ heap->CheckStartConcurrentMarking(T, GCReason::kOldSpace);
}
}
}
diff --git a/runtime/vm/heap/scavenger.cc b/runtime/vm/heap/scavenger.cc
index d2652ba..af64d84 100644
--- a/runtime/vm/heap/scavenger.cc
+++ b/runtime/vm/heap/scavenger.cc
@@ -805,17 +805,26 @@
ASSERT(blocks_ == nullptr);
}
-intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words) const {
- if (stats_history_.Size() == 0) {
+intptr_t Scavenger::NewSizeInWords(intptr_t old_size_in_words,
+ GCReason reason) const {
+ if (reason != GCReason::kNewSpace) {
+ // If we GC for a reason other than new-space being full, that's not an
+ // indication that new-space is too small.
return old_size_in_words;
}
- double garbage = stats_history_.Get(0).ExpectedGarbageFraction();
- if (garbage < (FLAG_new_gen_garbage_threshold / 100.0)) {
- return Utils::Minimum(max_semi_capacity_in_words_,
- old_size_in_words * FLAG_new_gen_growth_factor);
- } else {
- return old_size_in_words;
+
+ if (stats_history_.Size() != 0) {
+ double garbage = stats_history_.Get(0).ExpectedGarbageFraction();
+ if (garbage < (FLAG_new_gen_garbage_threshold / 100.0)) {
+ // Too much survived last time; grow new-space in the hope that a greater
+ // fraction of objects will become unreachable before new-space becomes
+ // full.
+ return Utils::Minimum(max_semi_capacity_in_words_,
+ old_size_in_words * FLAG_new_gen_growth_factor);
+ }
}
+
+ return old_size_in_words;
}
class CollectStoreBufferVisitor : public ObjectPointerVisitor {
@@ -962,7 +971,7 @@
}
}
-SemiSpace* Scavenger::Prologue() {
+SemiSpace* Scavenger::Prologue(GCReason reason) {
TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "Prologue");
heap_->isolate_group()->ReleaseStoreBuffers();
@@ -984,7 +993,7 @@
{
MutexLocker ml(&space_lock_);
from = to_;
- to_ = new SemiSpace(NewSizeInWords(from->max_capacity_in_words()));
+ to_ = new SemiSpace(NewSizeInWords(from->max_capacity_in_words(), reason));
}
UpdateMaxHeapCapacity();
@@ -1562,7 +1571,7 @@
return tail_->TryAllocateGC(size);
}
-void Scavenger::Scavenge() {
+void Scavenger::Scavenge(GCReason reason) {
int64_t start = OS::GetCurrentMonotonicMicros();
// Ensure that all threads for this isolate are at a safepoint (either stopped
@@ -1601,7 +1610,7 @@
}
promo_candidate_words += page->promo_candidate_words();
}
- SemiSpace* from = Prologue();
+ SemiSpace* from = Prologue(reason);
intptr_t bytes_promoted;
if (FLAG_scavenger_tasks == 0) {
@@ -1805,7 +1814,7 @@
}
#endif // !PRODUCT
-void Scavenger::Evacuate() {
+void Scavenger::Evacuate(GCReason reason) {
// We need a safepoint here to prevent allocation right before or right after
// the scavenge.
// The former can introduce an object that we might fail to collect.
@@ -1817,7 +1826,7 @@
// Forces the next scavenge to promote all the objects in the new space.
early_tenure_ = true;
- Scavenge();
+ Scavenge(reason);
// It is possible for objects to stay in the new space
// if the VM cannot create more pages for these objects.
diff --git a/runtime/vm/heap/scavenger.h b/runtime/vm/heap/scavenger.h
index 4b73f85..414b62e 100644
--- a/runtime/vm/heap/scavenger.h
+++ b/runtime/vm/heap/scavenger.h
@@ -276,10 +276,10 @@
void AbandonRemainingTLABForDebugging(Thread* thread);
// Collect the garbage in this scavenger.
- void Scavenge();
+ void Scavenge(GCReason reason);
// Promote all live objects.
- void Evacuate();
+ void Evacuate(GCReason reason);
int64_t UsedInWords() const {
MutexLocker ml(&space_lock_);
@@ -389,7 +389,7 @@
}
void TryAllocateNewTLAB(Thread* thread, intptr_t size);
- SemiSpace* Prologue();
+ SemiSpace* Prologue(GCReason reason);
intptr_t ParallelScavenge(SemiSpace* from);
intptr_t SerialScavenge(SemiSpace* from);
void ReverseScavenge(SemiSpace** from);
@@ -413,7 +413,7 @@
void MournWeakTables();
- intptr_t NewSizeInWords(intptr_t old_size_in_words) const;
+ intptr_t NewSizeInWords(intptr_t old_size_in_words, GCReason reason) const;
Heap* heap_;
diff --git a/runtime/vm/heap/spaces.h b/runtime/vm/heap/spaces.h
index 2dc9a03..6b60e6c 100644
--- a/runtime/vm/heap/spaces.h
+++ b/runtime/vm/heap/spaces.h
@@ -29,6 +29,26 @@
}
};
+enum class GCType {
+ kScavenge,
+ kMarkSweep,
+ kMarkCompact,
+};
+
+enum class GCReason {
+ kNewSpace, // New space is full.
+ kStoreBuffer, // Store buffer is too big.
+ kPromotion, // Old space limit crossed after a scavenge.
+ kOldSpace, // Old space limit crossed.
+ kFinalize, // Concurrent marking finished.
+ kFull, // Heap::CollectAllGarbage
+ kExternal, // Dart_NewFinalizableHandle Dart_NewWeakPersistentHandle
+ kIdle, // Dart_NotifyIdle
+ kLowMemory, // Dart_NotifyLowMemory
+ kDebugging, // service request, etc.
+ kSendAndExit, // SendPort.sendAndExit
+};
+
} // namespace dart
#endif // RUNTIME_VM_HEAP_SPACES_H_
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 9ad8617..18a7bb6 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -669,7 +669,7 @@
// We use kLowMemory to force the GC to compact, which is more likely to
// discover untracked pointers (and other issues, like incorrect class
// table).
- heap->CollectAllGarbage(Heap::kLowMemory);
+ heap->CollectAllGarbage(GCReason::kLowMemory);
}
// Copy the size table for isolate group & class tables for each isolate.
@@ -683,7 +683,7 @@
// We use kLowMemory to force the GC to compact, which is more likely to
// discover untracked pointers (and other issues, like incorrect class
// table).
- heap->CollectAllGarbage(Heap::kLowMemory);
+ heap->CollectAllGarbage(GCReason::kLowMemory);
}
// We synchronously load the hot-reload kernel diff (which includes changed
@@ -714,7 +714,7 @@
// We use kLowMemory to force the GC to compact, which is more likely to
// discover untracked pointers (and other issues, like incorrect class
// table).
- heap->CollectAllGarbage(Heap::kLowMemory);
+ heap->CollectAllGarbage(GCReason::kLowMemory);
}
// If we use the CFE and performed a compilation, we need to notify that
@@ -745,7 +745,7 @@
// We use kLowMemory to force the GC to compact, which is more likely
// to discover untracked pointers (and other issues, like incorrect
// class table).
- heap->CollectAllGarbage(Heap::kLowMemory);
+ heap->CollectAllGarbage(GCReason::kLowMemory);
}
const intptr_t count = locator.count();
if (count > 0) {
@@ -786,7 +786,7 @@
// We use kLowMemory to force the GC to compact, which is more likely
// to discover untracked pointers (and other issues, like incorrect
// class table).
- heap->CollectAllGarbage(Heap::kLowMemory);
+ heap->CollectAllGarbage(GCReason::kLowMemory);
}
}
if (discard_class_tables) {
diff --git a/runtime/vm/metrics_test.cc b/runtime/vm/metrics_test.cc
index 2881c361..c5bd41c 100644
--- a/runtime/vm/metrics_test.cc
+++ b/runtime/vm/metrics_test.cc
@@ -89,8 +89,8 @@
// Ensure we've done new/old GCs to ensure max metrics are initialized.
String::New("<land-in-new-space>", Heap::kNew);
- IsolateGroup::Current()->heap()->new_space()->Scavenge();
- IsolateGroup::Current()->heap()->CollectAllGarbage(Heap::kLowMemory);
+ IsolateGroup::Current()->heap()->new_space()->Scavenge(GCReason::kLowMemory);
+ IsolateGroup::Current()->heap()->CollectAllGarbage(GCReason::kLowMemory);
// Ensure we've something live in new space.
String::New("<land-in-new-space2>", Heap::kNew);
@@ -118,7 +118,7 @@
class MetricsTestHelper {
public:
static void Scavenge(Thread* thread) {
- thread->heap()->CollectNewSpaceGarbage(thread, Heap::kDebugging);
+ thread->heap()->CollectNewSpaceGarbage(thread, GCReason::kDebugging);
}
};
@@ -159,7 +159,7 @@
EXPECT_STREQ("debugging", last_gcevent_reason);
// This call emits 2 or 3 events.
- IsolateGroup::Current()->heap()->CollectAllGarbage(Heap::kLowMemory);
+ IsolateGroup::Current()->heap()->CollectAllGarbage(GCReason::kLowMemory);
EXPECT_GE(event_counter, 3UL);
EXPECT_STREQ("MarkCompact", last_gcevent_type);
diff --git a/runtime/vm/object_graph_copy.cc b/runtime/vm/object_graph_copy.cc
index 45642c8..df0a9a1 100644
--- a/runtime/vm/object_graph_copy.cc
+++ b/runtime/vm/object_graph_copy.cc
@@ -1741,7 +1741,7 @@
// We use kLowMemory to force the GC to compact, which is more likely to
// discover untracked pointers (and other issues, like incorrect class
// table).
- thread_->heap()->CollectAllGarbage(Heap::kLowMemory);
+ thread_->heap()->CollectAllGarbage(GCReason::kLowMemory);
}
// Fast copy failed due to
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index 54e4108..ee69f28 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -2797,7 +2797,7 @@
}
}
if (do_gc) {
- isolate->group()->heap()->CollectAllGarbage(Heap::kDebugging);
+ isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
}
}
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 1cc5a5c..c082f2d 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -4228,7 +4228,7 @@
static void CollectAllGarbage(Thread* thread, JSONStream* js) {
auto heap = thread->isolate_group()->heap();
- heap->CollectAllGarbage(Heap::kDebugging);
+ heap->CollectAllGarbage(GCReason::kDebugging);
PrintSuccess(js);
}
@@ -4241,12 +4241,14 @@
auto isolate_group = thread->isolate_group();
if (js->HasParam("gc")) {
if (js->ParamIs("gc", "scavenge")) {
- isolate_group->heap()->CollectGarbage(Heap::kScavenge, Heap::kDebugging);
+ isolate_group->heap()->CollectGarbage(GCType::kScavenge,
+ GCReason::kDebugging);
} else if (js->ParamIs("gc", "mark-sweep")) {
- isolate_group->heap()->CollectGarbage(Heap::kMarkSweep, Heap::kDebugging);
+ isolate_group->heap()->CollectGarbage(GCType::kMarkSweep,
+ GCReason::kDebugging);
} else if (js->ParamIs("gc", "mark-compact")) {
- isolate_group->heap()->CollectGarbage(Heap::kMarkCompact,
- Heap::kDebugging);
+ isolate_group->heap()->CollectGarbage(GCType::kMarkCompact,
+ GCReason::kDebugging);
} else {
PrintInvalidParamError(js, "gc");
return;
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 8c41eee..78feea8 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -435,10 +435,7 @@
if ((interrupt_bits & kVMInterrupt) != 0) {
CheckForSafepoint();
if (isolate_group()->store_buffer()->Overflowed()) {
- if (FLAG_verbose_gc) {
- OS::PrintErr("Scavenge scheduled by store buffer overflow.\n");
- }
- heap()->CollectGarbage(Heap::kNew);
+ heap()->CollectGarbage(GCType::kScavenge, GCReason::kStoreBuffer);
}
#if !defined(PRODUCT)
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index a505d5c..849f375 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -36,7 +36,6 @@
# ......dart.lib (import library for VM native extensions on Windows)
# ......dartaotruntime or dartaotruntime.exe (executable)
# ......dartdoc
-# ......dartfmt
# ......dart2js
# ......dartanalyzer
# ......dartdevc
@@ -50,7 +49,6 @@
# ........dartdev.dill
# ........dartdevc.dart.snapshot
# ........dartdoc.dart.snapshot
-# ........dartfmt.dart.snapshot
# ........dds.dart.snapshot
# ........frontend_server.dart.snapshot
# ........gen_kernel.dart.snapshot (if not on ia32)
@@ -94,7 +92,6 @@
# Scripts that go under bin/
_platform_sdk_scripts = [
"dartanalyzer",
- "dartfmt",
"pub",
]
@@ -102,7 +99,6 @@
"dart2js",
"dartanalyzer",
"dartdevc",
- "dartfmt",
"pub",
]
@@ -128,10 +124,6 @@
"../utils/dartdoc",
],
[
- "dartfmt",
- "../utils/dartfmt",
- ],
- [
"dds",
"../utils/dds:dds",
],
diff --git a/sdk/bin/dartfmt b/sdk/bin/dartfmt
deleted file mode 100755
index 442833d..0000000
--- a/sdk/bin/dartfmt
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-# 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.
-
-# Run dart_style/bin/format.dart on the Dart VM. This script assumes the Dart
-# repo's directory structure.
-
-echo "Warning: 'dartfmt' is deprecated. Please use 'dart format'." 1>&2
-echo "(See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.)" 1>&2
-
-function follow_links() {
- file="$1"
- while [ -h "$file" ]; do
- # On Mac OS, readlink -f doesn't work.
- file="$(readlink "$file")"
- done
- echo "$file"
-}
-
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-
-# Handle the case where dart-sdk/bin has been symlinked to.
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
-
-DART="$BIN_DIR/dart"
-
-DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)"
-
-DARTFMT="$DART_ROOT/third_party/pkg_tested/dart_style/bin/format.dart"
-
-exec "$DART" "--packages=$DART_ROOT/.packages" "$DARTFMT" "$@"
diff --git a/sdk/bin/dartfmt.bat b/sdk/bin/dartfmt.bat
deleted file mode 100644
index b3aceb0..0000000
--- a/sdk/bin/dartfmt.bat
+++ /dev/null
@@ -1,60 +0,0 @@
-@echo off
-REM Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-REM for details. All rights reserved. Use of this source code is governed by a
-REM BSD-style license that can be found in the LICENSE file.
-
-echo Warning: 'dartfmt' is deprecated. Please use 'dart format'. 1>&2
-echo (See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.) 1>&2
-
-setlocal
-rem Handle the case where dart-sdk/bin has been symlinked to.
-set DIR_NAME_WITH_SLASH=%~dp0
-set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
-call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
-rem Get rid of surrounding quotes.
-for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
-
-set DART=%BIN_DIR%\dart
-
-rem Get absolute full name for SDK_DIR.
-for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
-
-rem Remove trailing backslash if there is one
-if %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
-
-rem Get absolute full name for DART_ROOT.
-for %%i in ("%SDK_DIR%\..\") do set DART_ROOT=%%~fi
-
-rem Remove trailing backslash if there is one
-if %DART_ROOT:~-1%==\ set DART_ROOT=%DART_ROOT:~0,-1%
-
-set DARTFMT=%DART_ROOT%\third_party\pkg_tested\dart_style\bin\format.dart
-
-"%DART%" "--packages=%DART_ROOT%\.packages" "%DARTFMT%" %*
-
-endlocal
-
-exit /b %errorlevel%
-
-rem Follow the symbolic links (junctions points) using `dir to determine the
-rem canonical path. Output with a link looks something like this
-rem
-rem 01/03/2013 10:11 PM <JUNCTION> abc def
-rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
-rem
-rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
-rem surrounded by right angle bracket and left square bracket. Once we get
-rem the filename, which is name of the link, we recursively follow that.
-:follow_links
-setlocal
-for %%i in (%1) do set result=%%~fi
-set current=
-for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
- ^| %SystemRoot%\System32\find.exe "> %~n1 [" 2^>nul`) do (
- set current=%%i
-)
-if not "%current%"=="" call :follow_links "%current%", result
-endlocal & set %~2=%result%
-goto :eof
-
-:end
diff --git a/sdk/bin/dartfmt_sdk b/sdk/bin/dartfmt_sdk
deleted file mode 100755
index 255fb43..0000000
--- a/sdk/bin/dartfmt_sdk
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-# 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.
-
-# Run dart_style/bin/format.dart on the Dart VM. This script assumes the Dart
-# SDK's directory structure.
-
-echo "Warning: 'dartfmt' is deprecated. Please use 'dart format'." 1>&2
-echo "(See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.)" 1>&2
-
-function follow_links() {
- file="$1"
- while [ -h "$file" ]; do
- # On Mac OS, readlink -f doesn't work.
- file="$(readlink "$file")"
- done
- echo "$file"
-}
-
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-
-# Handle the case where dart-sdk/bin has been symlinked to.
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
-
-SNAPSHOT="$BIN_DIR/snapshots/dartfmt.dart.snapshot"
-
-# We are running the snapshot in the built SDK.
-DART="$BIN_DIR/dart"
-exec "$DART" "$SNAPSHOT" "$@"
diff --git a/sdk/bin/dartfmt_sdk.bat b/sdk/bin/dartfmt_sdk.bat
deleted file mode 100644
index 7b64864..0000000
--- a/sdk/bin/dartfmt_sdk.bat
+++ /dev/null
@@ -1,47 +0,0 @@
-@echo off
-REM Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-REM for details. All rights reserved. Use of this source code is governed by a
-REM BSD-style license that can be found in the LICENSE file.
-
-echo Warning: 'dartfmt' is deprecated. Please use 'dart format'. 1>&2
-echo (See https://github.com/dart-lang/dart_style/wiki/CLI-Changes.) 1>&2
-
-setlocal
-rem Handle the case where dart-sdk/bin has been symlinked to.
-set DIR_NAME_WITH_SLASH=%~dp0
-set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
-call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
-rem Get rid of surrounding quotes.
-for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
-
-set DART=%BIN_DIR%\dart
-set SNAPSHOT=%BIN_DIR%\snapshots\dartfmt.dart.snapshot
-
-"%DART%" "%SNAPSHOT%" %*
-
-endlocal
-
-exit /b %errorlevel%
-
-rem Follow the symbolic links (junctions points) using `dir to determine the
-rem canonical path. Output with a link looks something like this
-rem
-rem 01/03/2013 10:11 PM <JUNCTION> abc def
-rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
-rem
-rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
-rem surrounded by right angle bracket and left square bracket. Once we get
-rem the filename, which is name of the link, we recursively follow that.
-:follow_links
-setlocal
-for %%i in (%1) do set result=%%~fi
-set current=
-for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
- ^| %SystemRoot%\System32\find.exe "> %~n1 ["`) do (
- set current=%%i
-)
-if not "%current%"=="" call :follow_links "%current%", result
-endlocal & set %~2=%result%
-goto :eof
-
-:end
diff --git a/tests/standalone/io/platform_locale_name_test.dart b/tests/standalone/io/platform_locale_name_test.dart
new file mode 100644
index 0000000..611623d
--- /dev/null
+++ b/tests/standalone/io/platform_locale_name_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+import "dart:io";
+
+import "package:expect/expect.dart";
+
+main() {
+ // Match patterns like:
+ // "en-US" (Android, iOS, MacOS, Windows)
+ // "en_US", "en_US.UTF-8" (Linux)
+ // "ESP-USA" (theoretically possible)
+ // Assumes that the platform has a reasonably configured locale.
+ var localePattern = RegExp(r"[A-Za-z]{2,4}[_-][A-Za-z]{2}");
+ var localeName = Platform.localeName;
+ Expect.isNotNull(
+ localePattern.matchAsPrefix(localeName),
+ "Platform.localeName: ${localeName} does not match "
+ "${localePattern.pattern}");
+}
diff --git a/tests/standalone_2/io/platform_locale_name_test.dart b/tests/standalone_2/io/platform_locale_name_test.dart
new file mode 100644
index 0000000..5ad27ed
--- /dev/null
+++ b/tests/standalone_2/io/platform_locale_name_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.9
+
+import "dart:io";
+
+import "package:expect/expect.dart";
+
+main() {
+ // Match patterns like:
+ // "en-US" (Android, iOS, MacOS, Windows)
+ // "en_US", "en_US.UTF-8" (Linux)
+ // "ESP-USA" (theoretically possible)
+ // Assumes that the platform has a reasonably configured locale.
+ var localePattern = RegExp(r"[A-Za-z]{2,4}[_-][A-Za-z]{2}");
+ var localeName = Platform.localeName;
+ Expect.isNotNull(
+ localePattern.matchAsPrefix(localeName),
+ "Platform.localeName: ${localeName} does not match "
+ "${localePattern.pattern}");
+}
diff --git a/tools/VERSION b/tools/VERSION
index b6ef0a3..438cf7b 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 181
+PRERELEASE 182
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/utils/dartfmt/.gitignore b/utils/dartfmt/.gitignore
deleted file mode 100644
index 357f6bb..0000000
--- a/utils/dartfmt/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/dartfmt.Makefile
-/dartfmt.target.mk
diff --git a/utils/dartfmt/BUILD.gn b/utils/dartfmt/BUILD.gn
deleted file mode 100644
index 466a1b8..0000000
--- a/utils/dartfmt/BUILD.gn
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-# 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.
-
-import("../application_snapshot.gni")
-
-application_snapshot("dartfmt") {
- main_dart = "../../third_party/pkg_tested/dart_style/bin/format.dart"
-
- # Train it on formatting its own source.
- training_args = [ "../../third_party/pkg_tested/dart_style" ]
-}