Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: pkg/analyzer/lib/src/generated/error.dart

Issue 1644683002: A missing enum case in a switch is a warning, not a compile-time error. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/error.dart
diff --git a/pkg/analyzer/lib/src/generated/error.dart b/pkg/analyzer/lib/src/generated/error.dart
index 777e5bc0267b07bbe0a83a7568ae711ae6b5d20e..fe21b9d718ab6afe91acfdf93f061a7086c2c617 100644
--- a/pkg/analyzer/lib/src/generated/error.dart
+++ b/pkg/analyzer/lib/src/generated/error.dart
@@ -19,8 +19,6 @@ import 'package:analyzer/src/task/model.dart';
import 'package:analyzer/task/model.dart';
import 'package:source_span/source_span.dart';
-import 'generated/shared_messages.dart' as shared_messages;
-
/**
* The descriptor used to associate error processors with analysis contexts in
* configuration data.
@@ -1660,25 +1658,6 @@ class CompileTimeErrorCode extends ErrorCode {
"Map literals must be prefixed with 'const' when used as a constant expression");
/**
- * Enum proposal: It is a static warning if all of the following conditions
- * hold:
- * * The switch statement does not have a 'default' clause.
- * * The static type of <i>e</i> is an enumerated typed with elements
- * <i>id<sub>1</sub></i>, &hellip;, <i>id<sub>n</sub></i>.
- * * The sets {<i>e<sub>1</sub></i>, &hellip;, <i>e<sub>k</sub></i>} and
- * {<i>id<sub>1</sub></i>, &hellip;, <i>id<sub>n</sub></i>} are not the
- * same.
- *
- * Parameters:
- * 0: the name of the constant that is missing
- */
- static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH =
- const CompileTimeErrorCode(
- 'MISSING_ENUM_CONSTANT_IN_SWITCH',
- "Missing case clause for '{0}'",
- "Add a case clause for the missing constant or add a default clause.");
-
- /**
* 9 Mixins: It is a compile-time error if a declared or derived mixin
* explicitly declares a constructor.
*
@@ -2615,7 +2594,6 @@ abstract class ErrorCode {
CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME,
CompileTimeErrorCode.MISSING_CONST_IN_LIST_LITERAL,
CompileTimeErrorCode.MISSING_CONST_IN_MAP_LITERAL,
- CompileTimeErrorCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR,
CompileTimeErrorCode.MIXIN_DEFERRED_CLASS,
CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS,
@@ -2850,6 +2828,7 @@ abstract class ErrorCode {
StaticWarningCode.UNDEFINED_SUPER_GETTER,
StaticWarningCode.UNDEFINED_SUPER_SETTER,
StaticWarningCode.VOID_RETURN_FOR_GETTER,
+ StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
TodoCode.TODO,
//
@@ -5648,6 +5627,24 @@ class StaticWarningCode extends ErrorCode {
"The return type of the getter must not be 'void'");
/**
+ * 17.9 Switch: It is a static warning if all of the following conditions
+ * hold:
+ * * The switch statement does not have a 'default' clause.
+ * * The static type of <i>e</i> is an enumerated typed with elements
+ * <i>id<sub>1</sub></i>, &hellip;, <i>id<sub>n</sub></i>.
+ * * The sets {<i>e<sub>1</sub></i>, &hellip;, <i>e<sub>k</sub></i>} and
+ * {<i>id<sub>1</sub></i>, &hellip;, <i>id<sub>n</sub></i>} are not the
+ * same.
+ *
+ * Parameters:
+ * 0: the name of the constant that is missing
+ */
+ static const StaticWarningCode MISSING_ENUM_CONSTANT_IN_SWITCH =
+ const StaticWarningCode('MISSING_ENUM_CONSTANT_IN_SWITCH',
+ "Missing case clause for '{0}'",
+ "Add a case clause for the missing constant or add a default clause.");
+
+ /**
* Initialize a newly created error code to have the given [name]. The message
* associated with the error will be created from the given [message]
* template. The correction associated with the error will be created from the
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698