| Index: pkg/compiler/lib/src/diagnostics/messages.dart
|
| diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
|
| index 09417957c7511f45110dd5bb1e5e0811758035ec..30a6a8507f2fb4f8b54e55849f905e6e35438c4c 100644
|
| --- a/pkg/compiler/lib/src/diagnostics/messages.dart
|
| +++ b/pkg/compiler/lib/src/diagnostics/messages.dart
|
| @@ -107,6 +107,7 @@ enum MessageKind {
|
| CANNOT_EXTEND_ENUM,
|
| CANNOT_EXTEND_MALFORMED,
|
| CANNOT_FIND_CONSTRUCTOR,
|
| + CANNOT_FIND_UNNAMED_CONSTRUCTOR,
|
| CANNOT_IMPLEMENT,
|
| CANNOT_IMPLEMENT_ENUM,
|
| CANNOT_IMPLEMENT_MALFORMED,
|
| @@ -403,12 +404,14 @@ enum MessageKind {
|
| SETTER_NOT_FOUND_IN_SUPER,
|
| STATIC_FUNCTION_BLOAT,
|
| STRING_EXPECTED,
|
| + SUPER_CALL_TO_FACTORY,
|
| SUPER_INITIALIZER_IN_OBJECT,
|
| SWITCH_CASE_FORBIDDEN,
|
| SWITCH_CASE_TYPES_NOT_EQUAL,
|
| SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
|
| SWITCH_CASE_VALUE_OVERRIDES_EQUALS,
|
| TERNARY_OPERATOR_BAD_ARITY,
|
| + THIS_CALL_TO_FACTORY,
|
| THIS_IS_THE_DECLARATION,
|
| THIS_IS_THE_METHOD,
|
| THIS_IS_THE_PART_OF_TAG,
|
| @@ -896,7 +899,13 @@ main() {}"""},
|
|
|
| MessageKind.CANNOT_FIND_CONSTRUCTOR:
|
| const MessageTemplate(MessageKind.CANNOT_FIND_CONSTRUCTOR,
|
| - "Cannot find constructor '#{constructorName}'."),
|
| + "Cannot find constructor '#{constructorName}' in class "
|
| + "'#{className}'."),
|
| +
|
| + MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR:
|
| + const MessageTemplate(MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR,
|
| + "Cannot find unnamed constructor in class "
|
| + "'#{className}'."),
|
|
|
| MessageKind.CYCLIC_CLASS_HIERARCHY:
|
| const MessageTemplate(MessageKind.CYCLIC_CLASS_HIERARCHY,
|
| @@ -978,6 +987,62 @@ main() => new C();"""]),
|
| const MessageTemplate(MessageKind.DUPLICATE_SUPER_INITIALIZER,
|
| "Cannot have more than one super initializer."),
|
|
|
| + MessageKind.SUPER_CALL_TO_FACTORY:
|
| + const MessageTemplate(MessageKind.SUPER_CALL_TO_FACTORY,
|
| + "The target of the superinitializer must be a generative "
|
| + "constructor.",
|
| + howToFix: "Try calling another constructor on the superclass.",
|
| + examples: const ["""
|
| +class Super {
|
| + factory Super() => null;
|
| +}
|
| +class Class extends Super {}
|
| +main() => new Class();
|
| +""", """
|
| +class Super {
|
| + factory Super() => null;
|
| +}
|
| +class Class extends Super {
|
| + Class();
|
| +}
|
| +main() => new Class();
|
| +""", """
|
| +class Super {
|
| + factory Super() => null;
|
| +}
|
| +class Class extends Super {
|
| + Class() : super();
|
| +}
|
| +main() => new Class();
|
| +""", """
|
| +class Super {
|
| + factory Super.foo() => null;
|
| +}
|
| +class Class extends Super {
|
| + Class() : super.foo();
|
| +}
|
| +main() => new Class();
|
| +"""]),
|
| +
|
| + MessageKind.THIS_CALL_TO_FACTORY:
|
| + const MessageTemplate(MessageKind.THIS_CALL_TO_FACTORY,
|
| + "The target of the redirection clause must be a generative "
|
| + "constructor",
|
| + howToFix: "Try redirecting to another constructor.",
|
| + examples: const ["""
|
| +class Class {
|
| + factory Class() => null;
|
| + Class.foo() : this();
|
| +}
|
| +main() => new Class.foo();
|
| +""", """
|
| +class Class {
|
| + factory Class.foo() => null;
|
| + Class() : this.foo();
|
| +}
|
| +main() => new Class();
|
| +"""]),
|
| +
|
| MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS:
|
| const MessageTemplate(MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS,
|
| "Arguments do not match the expected parameters of constructor "
|
|
|