Improve the message for non_exhaustive_switch diagnostics
Fixes https://github.com/dart-lang/sdk/issues/60690
Change-Id: I1431d646a53c39b738369493b6a234df440dc2f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index 49e0935..911443f 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -3971,8 +3971,8 @@
static const CompileTimeErrorCode
NON_EXHAUSTIVE_SWITCH_EXPRESSION = CompileTimeErrorCode(
'NON_EXHAUSTIVE_SWITCH_EXPRESSION',
- "The type '{0}' is not exhaustively matched by the switch cases since it "
- "doesn't match '{1}'.",
+ "The type '{0}' isn't exhaustively matched by the switch cases since it "
+ "doesn't match the pattern '{1}'.",
correctionMessage:
"Try adding a wildcard pattern or cases that match '{2}'.",
hasPublishedDocs: true,
@@ -3985,8 +3985,8 @@
static const CompileTimeErrorCode
NON_EXHAUSTIVE_SWITCH_STATEMENT = CompileTimeErrorCode(
'NON_EXHAUSTIVE_SWITCH_STATEMENT',
- "The type '{0}' is not exhaustively matched by the switch cases since it "
- "doesn't match '{1}'.",
+ "The type '{0}' isn't exhaustively matched by the switch cases since it "
+ "doesn't match the pattern '{1}'.",
correctionMessage: "Try adding a default case or cases that match '{2}'.",
hasPublishedDocs: true,
);
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index aa8e0d0..a5cba99 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -11873,7 +11873,7 @@
extension type A(void Function(String) f) {}
```
NON_EXHAUSTIVE_SWITCH_EXPRESSION:
- problemMessage: "The type '{0}' is not exhaustively matched by the switch cases since it doesn't match '{1}'."
+ problemMessage: "The type '{0}' isn't exhaustively matched by the switch cases since it doesn't match the pattern '{1}'."
correctionMessage: "Try adding a wildcard pattern or cases that match '{2}'."
hasPublishedDocs: true
comment: |-
@@ -11934,7 +11934,7 @@
in the future. You will lose the ability to have the compiler warn you if
the `switch` needs to be updated to account for newly added types.
NON_EXHAUSTIVE_SWITCH_STATEMENT:
- problemMessage: "The type '{0}' is not exhaustively matched by the switch cases since it doesn't match '{1}'."
+ problemMessage: "The type '{0}' isn't exhaustively matched by the switch cases since it doesn't match the pattern '{1}'."
correctionMessage: "Try adding a default case or cases that match '{2}'."
hasPublishedDocs: true
comment: |-
@@ -18992,7 +18992,7 @@
external void leafCall(Pointer<Uint8> ptr);
void main() {
- final data = Uint8List(10);
+ final data = Uint8List(10);
// Correct: Using .address directly as an argument to a leaf call.
leafCall(data.address);