| Index: pkg/compiler/lib/src/warnings.dart
|
| diff --git a/pkg/compiler/lib/src/warnings.dart b/pkg/compiler/lib/src/warnings.dart
|
| index 5d872d0106329df0c54e6cad4f495e7a2b76494a..c3a56542121c59005d8c7ea85541e35b4ffa053e 100644
|
| --- a/pkg/compiler/lib/src/warnings.dart
|
| +++ b/pkg/compiler/lib/src/warnings.dart
|
| @@ -804,9 +804,9 @@ main() => new C();
|
| howToFix: "Try making '#{enumType}' a normal class or removing the "
|
| "'extends' clause.",
|
| examples: const ["""
|
| -enum Enum {}
|
| -class A extends Enum {}
|
| -main() => new A();"""]);
|
| +enum Enum { A }
|
| +class B extends Enum {}
|
| +main() => new B();"""]);
|
|
|
| static const MessageKind CANNOT_IMPLEMENT_ENUM = const MessageKind(
|
| "Class '#{className}' can't implement the type '#{enumType}' "
|
| @@ -815,9 +815,9 @@ main() => new A();"""]);
|
| howToFix: "Try making '#{enumType}' a normal class or removing the "
|
| "type from the 'implements' clause.",
|
| examples: const ["""
|
| -enum Enum {}
|
| -class A implements Enum {}
|
| -main() => new A();"""]);
|
| +enum Enum { A }
|
| +class B implements Enum {}
|
| +main() => new B();"""]);
|
|
|
| static const MessageKind CANNOT_MIXIN_ENUM = const MessageKind(
|
| "Class '#{className}' can't mixin the type '#{enumType}' because it "
|
| @@ -826,9 +826,9 @@ main() => new A();"""]);
|
| howToFix: "Try making '#{enumType}' a normal class or removing the "
|
| "type from the 'with' clause.",
|
| examples: const ["""
|
| -enum Enum {}
|
| -class A extends Object with Enum {}
|
| -main() => new A();"""]);
|
| +enum Enum { A }
|
| +class B extends Object with Enum {}
|
| +main() => new B();"""]);
|
|
|
| static const MessageKind CANNOT_INSTANTIATE_ENUM = const MessageKind(
|
| "Enum type '#{enumName}' cannot be instantiated.",
|
| @@ -836,11 +836,38 @@ main() => new A();"""]);
|
| howToFix: "Try making '#{enumType}' a normal class or use an enum "
|
| "constant.",
|
| examples: const ["""
|
| -enum Enum {}
|
| +enum Enum { A }
|
| main() => new Enum(0);""", """
|
| -enum Enum {}
|
| +enum Enum { A }
|
| main() => const Enum(0);"""]);
|
|
|
| + static const MessageKind EMPTY_ENUM_DECLARATION = const MessageKind(
|
| + "Enum '#{enumName}' must contain at least one value.",
|
| + options: const ['--enable-enum'],
|
| + howToFix: "Try adding an enum constant or making #{enumName} a "
|
| + "normal class.",
|
| + examples: const ["""
|
| +enum Enum {}
|
| +main() { Enum e; }"""]);
|
| +
|
| + static const MessageKind MISSING_ENUM_CASES = const MessageKind(
|
| + "Missing enum constants in switch statement: #{enumValues}.",
|
| + options: const ['--enable-enum'],
|
| + howToFix: "Try adding the missing constants or a default case.",
|
| + examples: const ["""
|
| +enum Enum { A, B }
|
| +main() {
|
| + switch (Enum.A) {
|
| + case Enum.B: break;
|
| + }
|
| +}""", """
|
| +enum Enum { A, B, C }
|
| +main() {
|
| + switch (Enum.A) {
|
| + case Enum.B: break;
|
| + }
|
| +}"""]);
|
| +
|
| static const MessageKind DUPLICATE_EXTENDS_IMPLEMENTS = const MessageKind(
|
| "'#{type}' can not be both extended and implemented.");
|
|
|
|
|