Skip to content

Commit cf8cb78

Browse files
jensjohaCommit Queue
authored andcommitted
[cfe/shared] Polish messages_suite; add more examples to messages.yaml
* No more "Fail" status in messages.status. * Removed unused messages. * Added examples for (almost?) all messages where it's possible. * Add messages suite to coverage suite and update coverage. == Additional notes === From the yaml spec (https://yaml.org/spec/1.2.2/) ``` 2.3. Scalars Scalar content can be written in block notation, using a literal style (indicated by “|”) where all line breaks are significant. Alternatively, they can be written with the folded style (denoted by “>”) where each line break is folded to a space unless it ends an empty or a more-indented line. ``` So we should probably use `|` and not `>` for code (especially if starting with a comment line (e.g. `// @Dart=3.1`)) - and the other way around for messages. === These three settings ``` exampleAllowOtherCodes: true exampleAllowMultipleReports: true includeErrorContext: true ``` (or some combination of them) closes #53634. (one already existed, but was renamed) Change-Id: I91a8ecee88d0600015252e289b068f60b1d1aeeb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444600 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent fff2466 commit cf8cb78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2225
-2495
lines changed

pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart

Lines changed: 3 additions & 643 deletions
Large diffs are not rendered by default.

pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,6 @@ abstract class AbstractScanner implements Scanner {
12021202
}
12031203

12041204
if (next == $BACKSLASH) {
1205-
// Coverage-ignore-block(suite): Not run.
12061205
// Hit when parsing doc comments in the analyzer.
12071206
appendPrecedenceToken(TokenType.BACKSLASH);
12081207
return advance();

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,10 +2794,6 @@ ParserErrorCode.EXTENSION_TYPE_WITH:
27942794
status: needsEvaluation
27952795
ParserErrorCode.EXTERNAL_CLASS:
27962796
status: hasFix
2797-
ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY:
2798-
status: needsFix
2799-
notes: |-
2800-
Remove the `external` keyword.
28012797
ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_FIELD_INITIALIZERS:
28022798
status: needsFix
28032799
notes: |-
@@ -2816,10 +2812,6 @@ ParserErrorCode.EXTERNAL_FACTORY_WITH_BODY:
28162812
status: needsFix
28172813
notes: |-
28182814
Remove the `external` keyword, or remove the body of the factory.
2819-
ParserErrorCode.EXTERNAL_FIELD:
2820-
status: needsFix
2821-
notes: |-
2822-
Remove the `external` keyword.
28232815
ParserErrorCode.EXTERNAL_GETTER_WITH_BODY:
28242816
status: needsFix
28252817
notes: |-

pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ final fastaAnalyzerErrorCodes = <DiagnosticCode?>[
7777
ParserErrorCode.invalidSuperInInitializer,
7878
ParserErrorCode.experimentNotEnabled,
7979
ParserErrorCode.externalMethodWithBody,
80-
ParserErrorCode.externalField,
80+
ParserErrorCode.abstractFinalInterfaceClass,
8181
ParserErrorCode.abstractClassMember,
8282
ParserErrorCode.breakOutsideOfLoop,
8383
ParserErrorCode.classInClass,
@@ -114,7 +114,7 @@ final fastaAnalyzerErrorCodes = <DiagnosticCode?>[
114114
ParserErrorCode.catchSyntax,
115115
ParserErrorCode.externalFactoryRedirection,
116116
ParserErrorCode.externalFactoryWithBody,
117-
ParserErrorCode.externalConstructorWithBody,
117+
ParserErrorCode.externalConstructorWithFieldInitializers,
118118
ParserErrorCode.fieldInitializedOutsideDeclaringClass,
119119
ParserErrorCode.varAndType,
120120
ParserErrorCode.invalidInitializer,
@@ -204,8 +204,6 @@ final fastaAnalyzerErrorCodes = <DiagnosticCode?>[
204204
ParserErrorCode.extraneousModifierInExtensionType,
205205
ParserErrorCode.extraneousModifierInPrimaryConstructor,
206206
ParserErrorCode.abstractFinalBaseClass,
207-
ParserErrorCode.abstractFinalInterfaceClass,
208-
ParserErrorCode.externalConstructorWithFieldInitializers,
209207
];
210208

211209
class ParserErrorCode extends DiagnosticCode {
@@ -789,14 +787,6 @@ class ParserErrorCode extends DiagnosticCode {
789787
correctionMessage: "Try removing the keyword 'external'.",
790788
);
791789

792-
static const ParserErrorCode externalConstructorWithBody = ParserErrorCode(
793-
'EXTERNAL_CONSTRUCTOR_WITH_BODY',
794-
"External constructors can't have a body.",
795-
correctionMessage:
796-
"Try removing the body of the constructor, or removing the keyword "
797-
"'external'.",
798-
);
799-
800790
static const ParserErrorCode externalConstructorWithFieldInitializers =
801791
ParserErrorCode(
802792
'EXTERNAL_CONSTRUCTOR_WITH_FIELD_INITIALIZERS',
@@ -832,14 +822,6 @@ class ParserErrorCode extends DiagnosticCode {
832822
"'external'.",
833823
);
834824

835-
static const ParserErrorCode externalField = ParserErrorCode(
836-
'EXTERNAL_FIELD',
837-
"Fields can't be declared to be 'external'.",
838-
correctionMessage:
839-
"Try removing the keyword 'external', or replacing the field by an "
840-
"external getter and/or setter.",
841-
);
842-
843825
/// No parameters.
844826
static const ParserErrorCode externalGetterWithBody = ParserErrorCode(
845827
'EXTERNAL_GETTER_WITH_BODY',

pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,13 +737,11 @@ const List<DiagnosticCode> diagnosticCodeValues = [
737737
ParserErrorCode.extensionTypeExtends,
738738
ParserErrorCode.extensionTypeWith,
739739
ParserErrorCode.externalClass,
740-
ParserErrorCode.externalConstructorWithBody,
741740
ParserErrorCode.externalConstructorWithFieldInitializers,
742741
ParserErrorCode.externalConstructorWithInitializer,
743742
ParserErrorCode.externalEnum,
744743
ParserErrorCode.externalFactoryRedirection,
745744
ParserErrorCode.externalFactoryWithBody,
746-
ParserErrorCode.externalField,
747745
ParserErrorCode.externalGetterWithBody,
748746
ParserErrorCode.externalLateField,
749747
ParserErrorCode.externalMethodWithBody,

pkg/front_end/lib/src/api_prototype/compiler_options.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ class CompilerOptions {
283283
experimentReleasedVersionForTesting);
284284
}
285285

286-
// Coverage-ignore(suite): Not run.
287286
bool equivalent(CompilerOptions other,
288287
{bool ignoreOnDiagnostic = true,
289288
bool ignoreVerbose = true,
@@ -294,9 +293,11 @@ class CompilerOptions {
294293
return false;
295294
}
296295
if (!ignoreOnDiagnostic) {
296+
// Coverage-ignore-block(suite): Not run.
297297
if (onDiagnostic != other.onDiagnostic) return false;
298298
}
299299
if (packagesFileUri != other.packagesFileUri) return false;
300+
// Coverage-ignore-block(suite): Not run.
300301
if (!equalLists(additionalDills, other.additionalDills)) return false;
301302
if (sdkSummary != other.sdkSummary) return false;
302303
if (dynamicInterfaceSpecificationUri !=

pkg/front_end/lib/src/api_prototype/memory_file_system.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class MemoryFileSystemEntity implements FileSystemEntity {
9292
Future<bool> existsAsyncIfPossible() => exists();
9393

9494
@override
95-
// Coverage-ignore(suite): Not run.
9695
Future<Uint8List> readAsBytes() {
9796
Uint8List? contents = _fileSystem._files[uri];
9897
if (contents == null) {
@@ -118,7 +117,6 @@ class MemoryFileSystemEntity implements FileSystemEntity {
118117
}
119118
}
120119

121-
// Coverage-ignore(suite): Not run.
122120
/// Writes the given raw bytes to this file system entity.
123121
///
124122
/// If no file exists, one is created. If a file exists already, it is
@@ -127,11 +125,11 @@ class MemoryFileSystemEntity implements FileSystemEntity {
127125
if (bytes is Uint8List) {
128126
_update(uri, bytes);
129127
} else {
128+
// Coverage-ignore-block(suite): Not run.
130129
_update(uri, new Uint8List.fromList(bytes));
131130
}
132131
}
133132

134-
// Coverage-ignore(suite): Not run.
135133
/// Writes the given string to this file system entity.
136134
///
137135
/// The string is encoded as UTF-8.
@@ -142,7 +140,6 @@ class MemoryFileSystemEntity implements FileSystemEntity {
142140
_update(uri, utf8.encode(s));
143141
}
144142

145-
// Coverage-ignore(suite): Not run.
146143
void _update(Uri uri, Uint8List data) {
147144
if (_fileSystem._directories.contains(uri)) {
148145
throw new FileSystemException(uri, 'Entry $uri is a directory.');

pkg/front_end/lib/src/base/command_line_reporting.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ PlainAndColorizedString formatNoSourceLine(
135135
_colorizeMessageText(severity, messageTextPlain);
136136

137137
if (message.uri != null) {
138-
// Coverage-ignore-block(suite): Not run.
139138
String path = relativizeUri(Uri.base, message.uri!, isWindows);
140139
return new PlainAndColorizedString(
141140
formatErrorMessage(null, null, length, path, messageTextPlain),

pkg/front_end/lib/src/base/get_dependencies.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import 'compiler_context.dart' show CompilerContext;
1717
import 'file_system_dependency_tracker.dart';
1818
import 'uri_translator.dart' show UriTranslator;
1919

20+
// Coverage-ignore(suite): Not run.
2021
Future<List<Uri>> getDependencies(Uri script,
2122
{Uri? sdk,
2223
Uri? packages,

pkg/front_end/lib/src/base/hybrid_file_system.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class HybridFileSystem implements FileSystem {
1919
final FileSystem physical;
2020

2121
HybridFileSystem(this.memory, [FileSystem? _physical])
22-
: physical = _physical ?? // Coverage-ignore(suite): Not run.
23-
StandardFileSystem.instance;
22+
: physical = _physical ?? StandardFileSystem.instance;
2423

2524
@override
2625
FileSystemEntity entityForUri(Uri uri) =>
@@ -43,21 +42,16 @@ class HybridFileSystemEntity implements FileSystemEntity {
4342
return _delegate!;
4443
}
4544
FileSystemEntity entity = _fs.memory.entityForUri(uri);
46-
if (((!uri.isScheme('file') &&
47-
// Coverage-ignore(suite): Not run.
48-
!uri.isScheme('data')) &&
49-
// Coverage-ignore(suite): Not run.
45+
if (((!uri.isScheme('file') && !uri.isScheme('data')) &&
5046
_fs.physical is StandardFileSystem) ||
5147
await entity.exists()) {
52-
// Coverage-ignore-block(suite): Not run.
5348
_delegate = entity;
5449
return _delegate!;
5550
}
5651
return _delegate = _fs.physical.entityForUri(uri);
5752
}
5853

5954
@override
60-
// Coverage-ignore(suite): Not run.
6155
Future<bool> exists() async => (await delegate).exists();
6256

6357
@override

0 commit comments

Comments
 (0)