Skip to content

Commit 74d85c1

Browse files
stereotype441Commit Queue
authored andcommitted
[front_end] Trim diagnostic correction messages.
There was already code to trim extra whitespace off the end of problem messages. It makes sense to trim correction messages too. Change-Id: I6a6a69641ec435c1e708c67c94792c6f159bb0b2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447941 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent 2c38c8b commit 74d85c1

File tree

185 files changed

+7
-478
lines changed

Some content is hidden

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

185 files changed

+7
-478
lines changed

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,7 @@ codeCantUseDeferredPrefixAsConstant = const Template<Message Function(Token toke
892892
problemMessageTemplate:
893893
r"""'#lexeme' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
894894
correctionMessageTemplate:
895-
r"""Try moving the constant from the deferred library, or removing 'deferred' from the import.
896-
""",
895+
r"""Try moving the constant from the deferred library, or removing 'deferred' from the import.""",
897896
withArgumentsOld: _withArgumentsOldCantUseDeferredPrefixAsConstant,
898897
analyzerCodes: <String>["CONST_DEFERRED_CLASS"],
899898
);
@@ -906,8 +905,7 @@ Message _withArgumentsOldCantUseDeferredPrefixAsConstant(Token token) {
906905
problemMessage:
907906
"""'${lexeme}' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
908907
correctionMessage:
909-
"""Try moving the constant from the deferred library, or removing 'deferred' from the import.
910-
""",
908+
"""Try moving the constant from the deferred library, or removing 'deferred' from the import.""",
911909
arguments: {'lexeme': token},
912910
);
913911
}
@@ -1248,8 +1246,7 @@ codeConstEvalDeferredLibrary = const Template<Message Function(String _nameOKEmp
12481246
problemMessageTemplate:
12491247
r"""'#nameOKEmpty' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
12501248
correctionMessageTemplate:
1251-
r"""Try moving the constant from the deferred library, or removing 'deferred' from the import.
1252-
""",
1249+
r"""Try moving the constant from the deferred library, or removing 'deferred' from the import.""",
12531250
withArgumentsOld: _withArgumentsOldConstEvalDeferredLibrary,
12541251
analyzerCodes: <String>[
12551252
"INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY",
@@ -1264,8 +1261,7 @@ Message _withArgumentsOldConstEvalDeferredLibrary(String _nameOKEmpty) {
12641261
problemMessage:
12651262
"""'${nameOKEmpty}' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
12661263
correctionMessage:
1267-
"""Try moving the constant from the deferred library, or removing 'deferred' from the import.
1268-
""",
1264+
"""Try moving the constant from the deferred library, or removing 'deferred' from the import.""",
12691265
arguments: {'nameOKEmpty': _nameOKEmpty},
12701266
);
12711267
}
@@ -9173,8 +9169,7 @@ codeMissingImplementationNotAbstract =
91739169
- provide an implementation,
91749170
- inherit an implementation from a superclass or mixin,
91759171
- mark the class as abstract, or
9176-
- provide a 'noSuchMethod' implementation.
9177-
""",
9172+
- provide a 'noSuchMethod' implementation.""",
91789173
withArgumentsOld: _withArgumentsOldMissingImplementationNotAbstract,
91799174
analyzerCodes: <String>["CONCRETE_CLASS_WITH_ABSTRACT_MEMBER"],
91809175
);
@@ -9197,8 +9192,7 @@ ${names}""",
91979192
- provide an implementation,
91989193
- inherit an implementation from a superclass or mixin,
91999194
- mark the class as abstract, or
9200-
- provide a 'noSuchMethod' implementation.
9201-
""",
9195+
- provide a 'noSuchMethod' implementation.""",
92029196
arguments: {'name': _name, 'names': _names},
92039197
);
92049198
}

pkg/front_end/testcases/enhanced_enums/abstract_members.dart.strong.expect

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ library;
2121
// - inherit an implementation from a superclass or mixin,
2222
// - mark the class as abstract, or
2323
// - provide a 'noSuchMethod' implementation.
24-
//
2524
// enum E4 implements InterfaceMethod { // Error.
2625
// ^^
2726
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:24:8: Context: 'InterfaceMethod.foo' is defined here.
@@ -35,7 +34,6 @@ library;
3534
// - inherit an implementation from a superclass or mixin,
3635
// - mark the class as abstract, or
3736
// - provide a 'noSuchMethod' implementation.
38-
//
3937
// enum E5 implements InterfaceGetter { // Error.
4038
// ^^
4139
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:32:11: Context: 'InterfaceGetter.foo' is defined here.
@@ -49,7 +47,6 @@ library;
4947
// - inherit an implementation from a superclass or mixin,
5048
// - mark the class as abstract, or
5149
// - provide a 'noSuchMethod' implementation.
52-
//
5350
// enum E6 implements InterfaceSetter { // Error.
5451
// ^^
5552
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:40:12: Context: 'InterfaceSetter.foo=' is defined here.

pkg/front_end/testcases/enhanced_enums/abstract_members.dart.strong.modular.expect

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ library;
2121
// - inherit an implementation from a superclass or mixin,
2222
// - mark the class as abstract, or
2323
// - provide a 'noSuchMethod' implementation.
24-
//
2524
// enum E4 implements InterfaceMethod { // Error.
2625
// ^^
2726
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:24:8: Context: 'InterfaceMethod.foo' is defined here.
@@ -35,7 +34,6 @@ library;
3534
// - inherit an implementation from a superclass or mixin,
3635
// - mark the class as abstract, or
3736
// - provide a 'noSuchMethod' implementation.
38-
//
3937
// enum E5 implements InterfaceGetter { // Error.
4038
// ^^
4139
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:32:11: Context: 'InterfaceGetter.foo' is defined here.
@@ -49,7 +47,6 @@ library;
4947
// - inherit an implementation from a superclass or mixin,
5048
// - mark the class as abstract, or
5149
// - provide a 'noSuchMethod' implementation.
52-
//
5350
// enum E6 implements InterfaceSetter { // Error.
5451
// ^^
5552
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:40:12: Context: 'InterfaceSetter.foo=' is defined here.

pkg/front_end/testcases/enhanced_enums/abstract_members.dart.strong.outline.expect

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ library;
2121
// - inherit an implementation from a superclass or mixin,
2222
// - mark the class as abstract, or
2323
// - provide a 'noSuchMethod' implementation.
24-
//
2524
// enum E4 implements InterfaceMethod { // Error.
2625
// ^^
2726
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:24:8: Context: 'InterfaceMethod.foo' is defined here.
@@ -35,7 +34,6 @@ library;
3534
// - inherit an implementation from a superclass or mixin,
3635
// - mark the class as abstract, or
3736
// - provide a 'noSuchMethod' implementation.
38-
//
3937
// enum E5 implements InterfaceGetter { // Error.
4038
// ^^
4139
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:32:11: Context: 'InterfaceGetter.foo' is defined here.
@@ -49,7 +47,6 @@ library;
4947
// - inherit an implementation from a superclass or mixin,
5048
// - mark the class as abstract, or
5149
// - provide a 'noSuchMethod' implementation.
52-
//
5350
// enum E6 implements InterfaceSetter { // Error.
5451
// ^^
5552
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:40:12: Context: 'InterfaceSetter.foo=' is defined here.

pkg/front_end/testcases/enhanced_enums/abstract_members.dart.strong.transformed.expect

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ library;
2121
// - inherit an implementation from a superclass or mixin,
2222
// - mark the class as abstract, or
2323
// - provide a 'noSuchMethod' implementation.
24-
//
2524
// enum E4 implements InterfaceMethod { // Error.
2625
// ^^
2726
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:24:8: Context: 'InterfaceMethod.foo' is defined here.
@@ -35,7 +34,6 @@ library;
3534
// - inherit an implementation from a superclass or mixin,
3635
// - mark the class as abstract, or
3736
// - provide a 'noSuchMethod' implementation.
38-
//
3937
// enum E5 implements InterfaceGetter { // Error.
4038
// ^^
4139
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:32:11: Context: 'InterfaceGetter.foo' is defined here.
@@ -49,7 +47,6 @@ library;
4947
// - inherit an implementation from a superclass or mixin,
5048
// - mark the class as abstract, or
5149
// - provide a 'noSuchMethod' implementation.
52-
//
5350
// enum E6 implements InterfaceSetter { // Error.
5451
// ^^
5552
// pkg/front_end/testcases/enhanced_enums/abstract_members.dart:40:12: Context: 'InterfaceSetter.foo=' is defined here.

pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart.strong.expect

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ library;
3737
// - inherit an implementation from a superclass or mixin,
3838
// - mark the class as abstract, or
3939
// - provide a 'noSuchMethod' implementation.
40-
//
4140
// class A extends Enum { // Error.
4241
// ^
4342
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -51,7 +50,6 @@ library;
5150
// - inherit an implementation from a superclass or mixin,
5251
// - mark the class as abstract, or
5352
// - provide a 'noSuchMethod' implementation.
54-
//
5553
// class B implements Enum { // Error.
5654
// ^
5755
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -65,7 +63,6 @@ library;
6563
// - inherit an implementation from a superclass or mixin,
6664
// - mark the class as abstract, or
6765
// - provide a 'noSuchMethod' implementation.
68-
//
6966
// class EnumClass2 extends AbstractEnumClass {} // Error.
7067
// ^^^^^^^^^^
7168
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -79,7 +76,6 @@ library;
7976
// - inherit an implementation from a superclass or mixin,
8077
// - mark the class as abstract, or
8178
// - provide a 'noSuchMethod' implementation.
82-
//
8379
// class EnumClass3 extends AbstractEnumClass2 {} // Error.
8480
// ^^^^^^^^^^
8581
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.

pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart.strong.modular.expect

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ library;
3737
// - inherit an implementation from a superclass or mixin,
3838
// - mark the class as abstract, or
3939
// - provide a 'noSuchMethod' implementation.
40-
//
4140
// class A extends Enum { // Error.
4241
// ^
4342
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -51,7 +50,6 @@ library;
5150
// - inherit an implementation from a superclass or mixin,
5251
// - mark the class as abstract, or
5352
// - provide a 'noSuchMethod' implementation.
54-
//
5553
// class B implements Enum { // Error.
5654
// ^
5755
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -65,7 +63,6 @@ library;
6563
// - inherit an implementation from a superclass or mixin,
6664
// - mark the class as abstract, or
6765
// - provide a 'noSuchMethod' implementation.
68-
//
6966
// class EnumClass2 extends AbstractEnumClass {} // Error.
7067
// ^^^^^^^^^^
7168
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -79,7 +76,6 @@ library;
7976
// - inherit an implementation from a superclass or mixin,
8077
// - mark the class as abstract, or
8178
// - provide a 'noSuchMethod' implementation.
82-
//
8379
// class EnumClass3 extends AbstractEnumClass2 {} // Error.
8480
// ^^^^^^^^^^
8581
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.

pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart.strong.outline.expect

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ library;
3737
// - inherit an implementation from a superclass or mixin,
3838
// - mark the class as abstract, or
3939
// - provide a 'noSuchMethod' implementation.
40-
//
4140
// class A extends Enum { // Error.
4241
// ^
4342
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -51,7 +50,6 @@ library;
5150
// - inherit an implementation from a superclass or mixin,
5251
// - mark the class as abstract, or
5352
// - provide a 'noSuchMethod' implementation.
54-
//
5553
// class B implements Enum { // Error.
5654
// ^
5755
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -65,7 +63,6 @@ library;
6563
// - inherit an implementation from a superclass or mixin,
6664
// - mark the class as abstract, or
6765
// - provide a 'noSuchMethod' implementation.
68-
//
6966
// class EnumClass2 extends AbstractEnumClass {} // Error.
7067
// ^^^^^^^^^^
7168
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -79,7 +76,6 @@ library;
7976
// - inherit an implementation from a superclass or mixin,
8077
// - mark the class as abstract, or
8178
// - provide a 'noSuchMethod' implementation.
82-
//
8379
// class EnumClass3 extends AbstractEnumClass2 {} // Error.
8480
// ^^^^^^^^^^
8581
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.

pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart.strong.transformed.expect

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ library;
3737
// - inherit an implementation from a superclass or mixin,
3838
// - mark the class as abstract, or
3939
// - provide a 'noSuchMethod' implementation.
40-
//
4140
// class A extends Enum { // Error.
4241
// ^
4342
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -51,7 +50,6 @@ library;
5150
// - inherit an implementation from a superclass or mixin,
5251
// - mark the class as abstract, or
5352
// - provide a 'noSuchMethod' implementation.
54-
//
5553
// class B implements Enum { // Error.
5654
// ^
5755
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -65,7 +63,6 @@ library;
6563
// - inherit an implementation from a superclass or mixin,
6664
// - mark the class as abstract, or
6765
// - provide a 'noSuchMethod' implementation.
68-
//
6966
// class EnumClass2 extends AbstractEnumClass {} // Error.
7067
// ^^^^^^^^^^
7168
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.
@@ -79,7 +76,6 @@ library;
7976
// - inherit an implementation from a superclass or mixin,
8077
// - mark the class as abstract, or
8178
// - provide a 'noSuchMethod' implementation.
82-
//
8379
// class EnumClass3 extends AbstractEnumClass2 {} // Error.
8480
// ^^^^^^^^^^
8581
// sdk/lib/core/enum.dart:*: Context: 'Enum.index' is defined here.

pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart.strong.expect

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ library;
1414
// - inherit an implementation from a superclass or mixin,
1515
// - mark the class as abstract, or
1616
// - provide a 'noSuchMethod' implementation.
17-
//
1817
// enum E2 implements I { // Error.
1918
// ^^
2019
// pkg/front_end/testcases/enhanced_enums/simple_interfaces.dart:6:8: Context: 'I.foo' is defined here.

0 commit comments

Comments
 (0)