Version 1.2.0-dev.3.1
svn merge -c 32192 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32210 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32219 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32235 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 32237 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
The merging of r32235 is partial and only includes the changes to:
tests/language/language_analyzer.status
tests/language/language_analyzer2.status
tests/language/override_inheritance_field_test.dart
Review URL: https://codereview.chromium.org//152593002
git-svn-id: http://dart.googlecode.com/svn/trunk@32241 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/pkgbuild.status b/pkg/pkgbuild.status
index 3acf8e6..cfcca4d 100644
--- a/pkg/pkgbuild.status
+++ b/pkg/pkgbuild.status
@@ -5,7 +5,7 @@
third_party/pkg/route_hierarchical: Fail
samples/third_party/pop-pop-win: Pass, Slow
-samples/searchable_list: Pass, Slow, Crash # Crashing from issue 16404
+samples/searchable_list: Pass, Slow
pkg/docgen: Pass, Slow
[ $use_repository_packages ]
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 3c50a5b..41c43b6 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -1013,6 +1013,10 @@
// Convert the old target entry to a new join entry.
TargetEntryInstr* old_target =
inlined_entries_[i]->AsGraphEntry()->normal_entry();
+ // Unuse all inputs in the the old graph entry since it is not part of
+ // the graph anymore. A new target be created instead.
+ inlined_entries_[i]->AsGraphEntry()->UnuseAllInputs();
+
JoinEntryInstr* new_join = BranchSimplifier::ToJoinEntry(old_target);
old_target->ReplaceAsPredecessorWith(new_join);
for (intptr_t j = 0; j < old_target->dominated_blocks().length(); ++j) {
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index 34a16b0..b52189b 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -606,10 +606,7 @@
void setPartOf(PartOf tag, DiagnosticListener listener) {
LibraryElementX library = enclosingElement;
if (library.entryCompilationUnit == this) {
- listener.reportMessage(
- listener.spanFromSpannable(tag),
- MessageKind.ILLEGAL_DIRECTIVE.error(),
- api.Diagnostic.WARNING);
+ listener.reportError(tag, MessageKind.ILLEGAL_DIRECTIVE);
return;
}
if (!localMembers.isEmpty) {
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/class_members.dart b/sdk/lib/_internal/compiler/implementation/resolution/class_members.dart
index 8efc910..c8c9c00 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/class_members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/class_members.dart
@@ -32,13 +32,32 @@
Map<Name, MemberSignature> interfaceMembers =
new Map<Name, MemberSignature>();
+ Map<dynamic/* Member | Element */, Set<MessageKind>> reportedMessages =
+ new Map<dynamic, Set<MessageKind>>();
+
MembersCreator(Compiler this.compiler, ClassElement this.cls);
+ void reportMessage(var marker, MessageKind kind, report()) {
+ Set<MessageKind> messages =
+ reportedMessages.putIfAbsent(marker,
+ () => new Set<MessageKind>());
+ if (messages.add(kind)) {
+ report();
+ }
+ }
+
void computeMembers() {
Map<Name, Set<Member>> inheritedInterfaceMembers =
_computeSuperMembers();
Map<Name, Member> declaredMembers = _computeClassMembers();
_computeInterfaceMembers(inheritedInterfaceMembers, declaredMembers);
+
+ if (!cls.modifiers.isAbstract() &&
+ !declaredMembers.containsKey(const PublicName('noSuchMethod'))) {
+ // Check for unimplemented members on concrete classes that neither have
+ // a `@proxy` annotation nor declare a `noSuchMethod` method.
+ checkInterfaceImplementation();
+ }
}
Map<Name, Set<Member>> _computeSuperMembers() {
@@ -85,7 +104,9 @@
Map<Name, Member> declaredMembers = new Map<Name, Member>();
void overrideMember(DeclaredMember declared) {
+ DeclaredMember inherited = classMembers[declared.name];
classMembers[declared.name] = declared;
+ checkValidOverride(declared, inherited);
}
if (cls.isMixinApplication) {
@@ -170,6 +191,10 @@
(Name name, Set<Member> inheritedMembers) {
Member declared = declaredMembers[name];
if (declared != null) {
+ // Check that [declaredMember] is a valid override
+ for (Member inherited in inheritedMembers) {
+ checkValidOverride(declared, inherited);
+ }
if (!declared.isStatic) {
interfaceMembers[name] = declared;
}
@@ -196,6 +221,26 @@
() => new Set<Member>()).add(inherited);
}
if (someAreGetters && !allAreGetters) {
+ compiler.reportWarningCode(cls,
+ MessageKind.INHERIT_GETTER_AND_METHOD,
+ {'class': thisType, 'name': name.text });
+ for (Member inherited in inheritedMembers) {
+ MessageKind kind;
+ if (inherited.isMethod) {
+ kind = MessageKind.INHERITED_METHOD;
+ } else {
+ assert(invariant(cls, inherited.isGetter,
+ message: 'Conflicting member is neither a method nor a '
+ 'getter.'));
+ if (inherited.isDeclaredByField) {
+ kind = MessageKind.INHERITED_IMPLICIT_GETTER;
+ } else {
+ kind = MessageKind.INHERITED_EXPLICIT_GETTER;
+ }
+ }
+ compiler.reportInfo(inherited.element, kind,
+ {'class': inherited.declarer, 'name': name.text });
+ }
interfaceMembers[name] = new ErroneousMember(inheritedMembers);
} else if (subtypesOfAllInherited.length == 1) {
// All signatures have the same type.
@@ -293,6 +338,215 @@
}
}
+ /// Checks that a class member exists for every interface member.
+ void checkInterfaceImplementation() {
+ LibraryElement library = cls.getLibrary();
+
+ interfaceMembers.forEach((Name name, MemberSignature interfaceMember) {
+ if (!name.isAccessibleFrom(library)) return;
+ Member classMember = classMembers[name];
+ if (classMember != null) return;
+ if (interfaceMember is DeclaredMember &&
+ interfaceMember.declarer.element == cls) {
+ // Abstract method declared in [cls].
+ MessageKind kind = MessageKind.ABSTRACT_METHOD;
+ if (interfaceMember.isSetter) {
+ kind = MessageKind.ABSTRACT_SETTER;
+ } else if (interfaceMember.isGetter) {
+ kind = MessageKind.ABSTRACT_GETTER;
+ }
+ reportMessage(
+ interfaceMember.element, MessageKind.ABSTRACT_METHOD, () {
+ compiler.reportWarningCode(
+ interfaceMember.element, kind,
+ {'class': cls.name, 'name': name.text});
+ });
+ } else {
+ reportWarning(MessageKind singleKind,
+ MessageKind multipleKind,
+ MessageKind explicitlyDeclaredKind,
+ [MessageKind implicitlyDeclaredKind]) {
+ Member inherited = interfaceMember.declarations.first;
+ reportMessage(
+ interfaceMember, MessageKind.UNIMPLEMENTED_METHOD, () {
+ compiler.reportWarningCode(cls,
+ interfaceMember.declarations.length == 1
+ ? singleKind : multipleKind,
+ {'class': cls.name,
+ 'name': name.text,
+ 'method': interfaceMember,
+ 'declarer': inherited.declarer});
+ for (Member inherited in interfaceMember.declarations) {
+ compiler.reportInfo(inherited.element,
+ inherited.isDeclaredByField ?
+ implicitlyDeclaredKind : explicitlyDeclaredKind,
+ {'class': inherited.declarer.name,
+ 'name': name.text});
+ }
+ });
+ }
+ if (interfaceMember.isSetter) {
+ reportWarning(MessageKind.UNIMPLEMENTED_SETTER_ONE,
+ MessageKind.UNIMPLEMENTED_SETTER,
+ MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER);
+ } else if (interfaceMember.isGetter) {
+ reportWarning(MessageKind.UNIMPLEMENTED_GETTER_ONE,
+ MessageKind.UNIMPLEMENTED_GETTER,
+ MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER);
+ } else if (interfaceMember.isMethod) {
+ reportWarning(MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ MessageKind.UNIMPLEMENTED_METHOD,
+ MessageKind.UNIMPLEMENTED_METHOD_CONT);
+ }
+ }
+ // TODO(johnniwinther): If [cls] is not abstract, check that for all
+ // interface members, there is a class member whose type is a subtype of
+ // the interface member.
+ });
+ }
+
+ void checkValidOverride(Member declared, MemberSignature superMember) {
+ if (superMember == null) {
+ // No override.
+ if (!declared.isStatic) {
+ ClassElement superclass = cls.superclass;
+ while (superclass != null) {
+ Member superMember =
+ superclass.lookupClassMember(declared.name);
+ if (superMember != null && superMember.isStatic) {
+ reportMessage(superMember, MessageKind.INSTANCE_STATIC_SAME_NAME,
+ () {
+ compiler.reportWarningCode(
+ declared.element,
+ MessageKind.INSTANCE_STATIC_SAME_NAME,
+ {'memberName': declared.name,
+ 'className': superclass.name});
+ compiler.reportInfo(superMember.element,
+ MessageKind.INSTANCE_STATIC_SAME_NAME_CONT);
+ });
+ break;
+ }
+ superclass = superclass.superclass;
+ }
+ }
+ } else {
+ assert(declared.name == superMember.name);
+ if (declared.isStatic) {
+ for (Member inherited in superMember.declarations) {
+ reportMessage(
+ inherited.element, MessageKind.NO_STATIC_OVERRIDE, () {
+ reportErrorWithContext(
+ declared.element, MessageKind.NO_STATIC_OVERRIDE,
+ inherited.element, MessageKind.NO_STATIC_OVERRIDE_CONT);
+ });
+ }
+ }
+
+ DartType declaredType = declared.functionType;
+ for (Member inherited in superMember.declarations) {
+
+ void reportError(MessageKind errorKind, MessageKind infoKind) {
+ reportMessage(
+ inherited.element, MessageKind.INVALID_OVERRIDE_METHOD, () {
+ compiler.reportError(declared.element, errorKind,
+ {'name': declared.name.text,
+ 'class': cls.thisType,
+ 'inheritedClass': inherited.declarer});
+ compiler.reportInfo(inherited.element, infoKind,
+ {'name': declared.name.text,
+ 'class': inherited.declarer});
+ });
+ }
+
+ if (declared.isDeclaredByField && inherited.isMethod) {
+ reportError(MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD,
+ MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT);
+ } else if (declared.isMethod && inherited.isDeclaredByField) {
+ reportError(MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD,
+ MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT);
+ } else if (declared.isGetter && inherited.isMethod) {
+ reportError(MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER,
+ MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT);
+ } else if (declared.isMethod && inherited.isGetter) {
+ reportError(MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD,
+ MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT);
+ } else {
+ DartType inheritedType = inherited.functionType;
+ if (!compiler.types.isSubtype(declaredType, inheritedType)) {
+ void reportWarning(var marker,
+ MessageKind warningKind,
+ MessageKind infoKind) {
+ reportMessage(marker, MessageKind.INVALID_OVERRIDE_METHOD, () {
+ compiler.reportWarningCode(declared.element, warningKind,
+ {'declaredType': declared.type,
+ 'name': declared.name.text,
+ 'class': cls.thisType,
+ 'inheritedType': inherited.type,
+ 'inheritedClass': inherited.declarer});
+ compiler.reportInfo(inherited.element, infoKind,
+ {'name': declared.name.text,
+ 'class': inherited.declarer});
+ });
+ }
+ if (declared.isDeclaredByField) {
+ if (inherited.isDeclaredByField) {
+ reportWarning(inherited.element,
+ MessageKind.INVALID_OVERRIDE_FIELD,
+ MessageKind.INVALID_OVERRIDDEN_FIELD);
+ } else if (inherited.isGetter) {
+ reportWarning(inherited,
+ MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD,
+ MessageKind.INVALID_OVERRIDDEN_GETTER);
+ } else if (inherited.isSetter) {
+ reportWarning(inherited,
+ MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD,
+ MessageKind.INVALID_OVERRIDDEN_SETTER);
+ }
+ } else if (declared.isGetter) {
+ if (inherited.isDeclaredByField) {
+ reportWarning(inherited,
+ MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER,
+ MessageKind.INVALID_OVERRIDDEN_FIELD);
+ } else {
+ reportWarning(inherited,
+ MessageKind.INVALID_OVERRIDE_GETTER,
+ MessageKind.INVALID_OVERRIDDEN_GETTER);
+ }
+ } else if (declared.isSetter) {
+ if (inherited.isDeclaredByField) {
+ reportWarning(inherited,
+ MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER,
+ MessageKind.INVALID_OVERRIDDEN_FIELD);
+ } else {
+ reportWarning(inherited,
+ MessageKind.INVALID_OVERRIDE_SETTER,
+ MessageKind.INVALID_OVERRIDDEN_SETTER);
+ }
+ } else {
+ reportWarning(inherited,
+ MessageKind.INVALID_OVERRIDE_METHOD,
+ MessageKind.INVALID_OVERRIDDEN_METHOD);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void reportErrorWithContext(Element errorneousElement,
+ MessageKind errorMessage,
+ Element contextElement,
+ MessageKind contextMessage) {
+ compiler.reportError(
+ errorneousElement,
+ errorMessage,
+ {'memberName': contextElement.name,
+ 'className': contextElement.getEnclosingClass().name});
+ compiler.reportInfo(contextElement, contextMessage);
+ }
+
static void computeClassMembers(Compiler compiler, BaseClassElementX cls) {
if (cls.classMembers != null) return;
MembersCreator creator = new MembersCreator(compiler, cls);
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index cdc8e86..af629c4 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -947,7 +947,6 @@
}
}
checkAbstractField(member);
- checkValidOverride(member, cls.lookupSuperMember(member.name));
checkUserDefinableOperator(member);
});
});
@@ -968,25 +967,6 @@
MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD);
}
}
-
- if (!cls.isAbstract) {
- for (DartType supertype in cls.allSupertypes) {
- // This must have been reported elsewhere.
- if (!supertype.element.isClass()) continue;
- ClassElement superclass = supertype.element;
- superclass.forEachMember((ClassElement holder, Element member) {
- if (member.isAbstract) {
- Element mine = cls.lookupMember(member.name);
- if (mine == null || mine.isAbstract) {
- compiler.reportWarningCode(
- cls, MessageKind.UNIMPLEMENTED_METHOD,
- {'class_name': cls.name, 'member_name': member.name});
- compiler.reportHint(member, MessageKind.THIS_IS_THE_METHOD, {});
- }
- }
- });
- }
- }
}
void checkAbstractField(Element member) {
@@ -1139,45 +1119,6 @@
compiler.reportInfo(contextElement, contextMessage);
}
- void checkValidOverride(Element member, Element superMember) {
- if (superMember == null) return;
- if (member.modifiers.isStatic()) {
- reportErrorWithContext(
- member, MessageKind.NO_STATIC_OVERRIDE,
- superMember, MessageKind.NO_STATIC_OVERRIDE_CONT);
- } else {
- FunctionElement superFunction = superMember.asFunctionElement();
- FunctionElement function = member.asFunctionElement();
- if (superFunction == null || superFunction.isAccessor()) {
- // Field or accessor in super.
- if (function != null && !function.isAccessor()) {
- // But a plain method in this class.
- reportErrorWithContext(
- member, MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD,
- superMember, MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT);
- }
- } else {
- // Instance method in super.
- if (function == null || function.isAccessor()) {
- // But a field (or accessor) in this class.
- reportErrorWithContext(
- member, MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD,
- superMember, MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT);
- } else {
- // Both are plain instance methods.
- if (superFunction.requiredParameterCount(compiler) !=
- function.requiredParameterCount(compiler)) {
- reportErrorWithContext(
- member,
- MessageKind.BAD_ARITY_OVERRIDE,
- superMember,
- MessageKind.BAD_ARITY_OVERRIDE_CONT);
- }
- // TODO(ahe): Check optional parameters.
- }
- }
- }
- }
FunctionSignature resolveSignature(FunctionElement element) {
MessageKind defaultValuesError = null;
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 3183fe3..014e40a 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -68,6 +68,8 @@
* 1. what is wrong, 2. why is it wrong, 3. how do I fix it. However, we
* combine the first two in [template] and the last in [howToFix].
*/
+// TODO(johnnniwinther): For Infos, consider adding a reference to the
+// error/warning/hint that they belong to.
class MessageKind {
/// Should describe what is wrong and why.
final String template;
@@ -868,10 +870,77 @@
"Info: This is the instance member that cannot be overridden "
"by a static member.");
+ static const MessageKind INSTANCE_STATIC_SAME_NAME = const MessageKind(
+ "Warning: Instance member '#{memberName}' and static member of "
+ "superclass '#{className}' have the same name.");
+
+ static const MessageKind INSTANCE_STATIC_SAME_NAME_CONT = const MessageKind(
+ "Info: This is the static member with the same name.");
+
+ static const MessageKind INVALID_OVERRIDE_METHOD = const MessageKind(
+ "Warning: The type '#{declaredType}' of method '#{name}' declared in "
+ "'#{class}' is not a subtype of the overridden method type "
+ "'#{inheritedType}' inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDDEN_METHOD = const MessageKind(
+ "Info: This is the overridden method '#{name}' declared in class "
+ "'#{class}'.");
+
+ static const MessageKind INVALID_OVERRIDE_GETTER = const MessageKind(
+ "Warning: The type '#{declaredType}' of getter '#{name}' declared in "
+ "'#{class}' is not assignable to the type '#{inheritedType}' of the "
+ "overridden getter inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDDEN_GETTER = const MessageKind(
+ "Info: This is the overridden getter '#{name}' declared in class "
+ "'#{class}'.");
+
+ static const MessageKind INVALID_OVERRIDE_GETTER_WITH_FIELD =
+ const MessageKind(
+ "Warning: The type '#{declaredType}' of field '#{name}' declared in "
+ "'#{class}' is not assignable to the type '#{inheritedType}' of the "
+ "overridden getter inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDE_FIELD_WITH_GETTER =
+ const MessageKind(
+ "Warning: The type '#{declaredType}' of getter '#{name}' declared in "
+ "'#{class}' is not assignable to the type '#{inheritedType}' of the "
+ "overridden field inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDE_SETTER = const MessageKind(
+ "Warning: The type '#{declaredType}' of setter '#{name}' declared in "
+ "'#{class}' is not assignable to the type '#{inheritedType}' of the "
+ "overridden setter inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDDEN_SETTER = const MessageKind(
+ "Info: This is the overridden setter '#{name}' declared in class "
+ "'#{class}'.");
+
+ static const MessageKind INVALID_OVERRIDE_SETTER_WITH_FIELD =
+ const MessageKind(
+ "Warning: The type '#{declaredType}' of field '#{name}' declared in "
+ "'#{class}' is not assignable to the type '#{inheritedType}' of the "
+ "overridden setter inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDE_FIELD_WITH_SETTER =
+ const MessageKind(
+ "Warning: The type '#{declaredType}' of setter '#{name}' declared in "
+ "'#{class}' is not assignable to the type '#{inheritedType}' of the "
+ "overridden field inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDE_FIELD = const MessageKind(
+ "Warning: The type '#{declaredType}' of field '#{name}' declared in "
+ "'#{class}' is not assignable to the type '#{inheritedType}' of the "
+ "overridden field inherited from '#{inheritedClass}'.");
+
+ static const MessageKind INVALID_OVERRIDDEN_FIELD = const MessageKind(
+ "Info: This is the overridden field '#{name}' declared in class "
+ "'#{class}'.");
+
static const MessageKind CANNOT_OVERRIDE_FIELD_WITH_METHOD =
const MessageKind(
- "Error: Method cannot override field '#{memberName}' of "
- "'#{className}'.");
+ "Error: Method '#{name}' in '#{class}' can't override field from "
+ "'#{inheritedClass}'.");
static const MessageKind CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT =
const MessageKind(
@@ -879,19 +948,30 @@
static const MessageKind CANNOT_OVERRIDE_METHOD_WITH_FIELD =
const MessageKind(
- "Error: Field cannot override method '#{memberName}' of "
- "'#{className}'.");
+ "Error: Field '#{name}' in '#{class}' can't override method from "
+ "'#{inheritedClass}'.");
static const MessageKind CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT =
const MessageKind(
"Info: This is the method that cannot be overridden by a field.");
- static const MessageKind BAD_ARITY_OVERRIDE = const MessageKind(
- "Error: Cannot override method '#{memberName}' in '#{className}'; "
- "the parameters do not match.");
+ static const MessageKind CANNOT_OVERRIDE_GETTER_WITH_METHOD =
+ const MessageKind(
+ "Error: Method '#{name}' in '#{class}' can't override getter from "
+ "'#{inheritedClass}'.");
- static const MessageKind BAD_ARITY_OVERRIDE_CONT = const MessageKind(
- "Info: This is the method whose parameters do not match.");
+ static const MessageKind CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT =
+ const MessageKind(
+ "Info: This is the getter that cannot be overridden by a method.");
+
+ static const MessageKind CANNOT_OVERRIDE_METHOD_WITH_GETTER =
+ const MessageKind(
+ "Error: Getter '#{name}' in '#{class}' can't override method from "
+ "'#{inheritedClass}'.");
+
+ static const MessageKind CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT =
+ const MessageKind(
+ "Info: This is the method that cannot be overridden by a getter.");
static const MessageKind MISSING_FORMALS = const MessageKind(
"Error: Formal parameters are missing.");
@@ -1407,22 +1487,105 @@
howToFix: "Consider deleting it.",
examples: const ["deadCode() {} main() {}"]);
+ static const MessageKind ABSTRACT_METHOD = const MessageKind(
+ "Warning: The method '#{name}' has no implementation in "
+ "class '#{class}'.",
+ howToFix: "Try adding a body to '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+class Class {
+ method();
+}
+main() => new Class();
+"""]);
+
+ static const MessageKind ABSTRACT_GETTER = const MessageKind(
+ "Warning: The getter '#{name}' has no implementation in "
+ "class '#{class}'.",
+ howToFix: "Try adding a body to '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+class Class {
+ get getter;
+}
+main() => new Class();
+"""]);
+
+ static const MessageKind ABSTRACT_SETTER = const MessageKind(
+ "Warning: The setter '#{name}' has no implementation in "
+ "class '#{class}'.",
+ howToFix: "Try adding a body to '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+class Class {
+ set setter(_);
+}
+main() => new Class();
+"""]);
+
+ static const MessageKind INHERIT_GETTER_AND_METHOD = const MessageKind(
+ "Warning: The class '#{class}' can't inherit both getters and methods "
+ "by the named '#{name}'.",
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const ["""
+class A {
+ get member => null;
+}
+class B {
+ member() {}
+}
+class Class implements A, B {
+}
+main() => new Class();
+"""]);
+
+ static const MessageKind INHERITED_METHOD = const MessageKind(
+ "Info: The inherited method '#{name}' is declared here in class "
+ "'#{class}'.");
+
+ static const MessageKind INHERITED_EXPLICIT_GETTER = const MessageKind(
+ "Info: The inherited getter '#{name}' is declared here in class "
+ "'#{class}'.");
+
+ static const MessageKind INHERITED_IMPLICIT_GETTER = const MessageKind(
+ "Info: The inherited getter '#{name}' is implicitly declared by this "
+ "field in class '#{class}'.");
+
+ static const MessageKind UNIMPLEMENTED_METHOD_ONE = const MessageKind(
+ "Warning: '#{class}' doesn't implement '#{method}' "
+ "declared in '#{declarer}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+abstract class I {
+ m();
+}
+class C implements I {}
+main() => new C();
+""", """
+abstract class I {
+ m();
+}
+class C extends I {}
+main() => new C();
+"""]);
+
static const MessageKind UNIMPLEMENTED_METHOD = const MessageKind(
- "Warning: '#{class_name}' doesn't implement '#{member_name}'.",
- howToFix: "Try adding an implementation of '#{member_name}'.",
+ "Warning: '#{class}' doesn't implement '#{method}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
examples: const ["""
abstract class I {
m();
}
-class C implements I {}
-
-class D implements I {
- m() {}
+abstract class J {
+ m();
}
+class C implements I, J {}
+
main() {
- new D().m();
new C();
}
""", """
@@ -1430,18 +1593,120 @@
m();
}
-class C extends I {}
-
-class D extends I {
- m() {}
+abstract class J {
+ m();
}
+class C extends I implements J {}
+
main() {
- new D().m();
new C();
}
"""]);
+ static const MessageKind UNIMPLEMENTED_METHOD_CONT = const MessageKind(
+ "Info: The method '#{name}' is declared here in class '#{class}'.");
+
+ static const MessageKind UNIMPLEMENTED_SETTER_ONE = const MessageKind(
+ "Warning: '#{class}' doesn't implement the setter '#{name}' "
+ "declared in '#{declarer}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+abstract class I {
+ set m(_);
+}
+class C implements I {}
+class D implements I {
+ set m(_) {}
+}
+main() {
+ new D().m = 0;
+ new C();
+}
+"""]);
+
+ static const MessageKind UNIMPLEMENTED_SETTER = const MessageKind(
+ "Warning: '#{class}' doesn't implement the setter '#{name}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+abstract class I {
+ set m(_);
+}
+abstract class J {
+ set m(_);
+}
+class C implements I, J {}
+main() => new C();
+""", """
+abstract class I {
+ set m(_);
+}
+abstract class J {
+ set m(_);
+}
+class C extends I implements J {}
+main() => new C();
+"""]);
+
+ static const MessageKind UNIMPLEMENTED_EXPLICIT_SETTER = const MessageKind(
+ "Info: The setter '#{name}' is declared here in class '#{class}'.");
+
+ static const MessageKind UNIMPLEMENTED_IMPLICIT_SETTER = const MessageKind(
+ "Info: The setter '#{name}' is implicitly declared by this field "
+ "in class '#{class}'.");
+
+ static const MessageKind UNIMPLEMENTED_GETTER_ONE = const MessageKind(
+ "Warning: '#{class}' doesn't implement the getter '#{name}' "
+ "declared in '#{declarer}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+abstract class I {
+ get m;
+}
+class C implements I {}
+main() => new C();
+""", """
+abstract class I {
+ get m;
+}
+class C extends I {}
+main() => new C();
+"""]);
+
+ static const MessageKind UNIMPLEMENTED_GETTER = const MessageKind(
+ "Warning: '#{class}' doesn't implement the getter '#{name}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const ["""
+abstract class I {
+ get m;
+}
+abstract class J {
+ get m;
+}
+class C implements I, J {}
+main() => new C();
+""", """
+abstract class I {
+ get m;
+}
+abstract class J {
+ get m;
+}
+class C extends I implements J {}
+main() => new C();
+"""]);
+
+ static const MessageKind UNIMPLEMENTED_EXPLICIT_GETTER = const MessageKind(
+ "Info: The getter '#{name}' is declared here in class '#{class}'.");
+
+ static const MessageKind UNIMPLEMENTED_IMPLICIT_GETTER = const MessageKind(
+ "Info: The getter '#{name}' is implicitly declared by this field "
+ "in class '#{class}'.");
+
static const MessageKind EQUAL_MAP_ENTRY_KEY = const MessageKind(
"Warning: An entry with the same key already exists in the map.",
howToFix: "Try removing the previous entry or changing the key in one "
@@ -1651,7 +1916,8 @@
});
assert(invariant(
CURRENT_ELEMENT_SPANNABLE,
- !message.contains(new RegExp(r'#\{.+\}')),
+ kind == MessageKind.GENERIC ||
+ !message.contains(new RegExp(r'#\{.+\}')),
message: 'Missing arguments in error message: "$message"'));
if (!terse && kind.hasHowToFix) {
String howToFix = kind.howToFix;
diff --git a/sdk/lib/_internal/lib/isolate_helper.dart b/sdk/lib/_internal/lib/isolate_helper.dart
index da53482..6debde7 100644
--- a/sdk/lib/_internal/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/lib/isolate_helper.dart
@@ -1043,7 +1043,7 @@
}
/** Abstract visitor for dart objects that can be sent as isolate messages. */
-class _MessageTraverser {
+abstract class _MessageTraverser {
_MessageTraverserVisitedMap _visited;
_MessageTraverser() : _visited = new _MessageTraverserVisitedMap();
@@ -1167,7 +1167,7 @@
}
/** Deserializes arrays created with [_Serializer]. */
-class _Deserializer {
+abstract class _Deserializer {
Map<int, dynamic> _deserialized;
_Deserializer();
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
index 7ecb275..24e7840 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -2006,7 +2006,7 @@
String get source => throw new UnimplementedError();
// TODO(ahe): Implement this method.
- InstanceMirror findInContext(Symbol name) {
+ InstanceMirror findInContext(Symbol name, {ifAbsent: null}) {
throw new UnsupportedError("ClosureMirror.findInContext not yet supported");
}
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index 7611ee9..fbdee70 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -39,10 +39,6 @@
Language/06_Functions/4_External_Functions_A01_t01: Fail # inherited from VM
Language/07_Classes/3_Setters_A04_t01: Fail # inherited from VM
Language/07_Classes/3_Setters_A04_t02: Fail # inherited from VM
-Language/07_Classes/3_Setters_A04_t03: Fail # inherited from VM
-Language/07_Classes/3_Setters_A04_t04: Fail # inherited from VM
-Language/07_Classes/3_Setters_A04_t05: Fail # inherited from VM
-Language/07_Classes/3_Setters_A04_t06: Fail # inherited from VM
Language/07_Classes/3_Setters_A04_t07: Fail # inherited from VM
Language/12_Expressions/01_Constants_A03_t01: Fail # Issue 13652
@@ -92,20 +88,12 @@
LibTest/core/double/round_A01_t02: Fail # truncate/ceil/floor/round returns ints, issue 389
LibTest/core/double/round_A01_t04: Fail # truncate/ceil/floor/round returns ints, issue 389
-Language/14_Libraries_and_Scripts/1_Imports_A04_t01: Fail # co19 Issue 603
-
[ $compiler == dart2dart ]
Language/03_Overview/1_Scoping_A02_t28: Fail # co19-roll r559: Please triage this failure
Language/05_Variables/05_Variables_A05_t01: fail # co19-roll r546: Please triage this failure
Language/05_Variables/05_Variables_A05_t02: fail # co19-roll r546: Please triage this failure
Language/05_Variables/05_Variables_A11_t01: fail
-Language/07_Classes/1_Instance_Methods_A01_t01: Fail # co19-roll r559: Please triage this failure
-Language/07_Classes/1_Instance_Methods_A01_t02: Fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t01: Fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t02: Fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t03: Fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t04: Fail # co19-roll r559: Please triage this failure
Language/07_Classes/6_Constructors/2_Factories_A10_t01: crash # co19-roll r587: Please triage this failure
Language/07_Classes/6_Constructors/2_Factories_A10_t04: crash # co19-roll r587: Please triage this failure
Language/12_Expressions/01_Constants_A20_t02: fail # co19-roll r546: Please triage this failure
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index da70dd7..597905e 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -229,8 +229,6 @@
LibTest/typed_data/ByteData/setUint8_A02_t02: fail # Issue 12989
LibTest/typed_data/ByteData/setUint8_A02_t02: fail # Issue 12989
-Language/14_Libraries_and_Scripts/1_Imports_A04_t01: Fail # co19 Issue 603
-
[ $compiler == dart2js && $jscl ]
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A03_t01: Fail, Pass # issue 3333
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t01: RuntimeError, OK # This is not rejected by V8.
@@ -262,6 +260,7 @@
#
[ $compiler == dart2js ]
Language/07_Classes/6_Constructors/1_Generative_Constructors_A13_t01: RuntimeError # compiler cancelled: cannot resolve type T
+Language/07_Classes/3_Setters_A04_t03: RuntimeError # http://dartbug.com/5023
[ $compiler == dart2js && $jscl ]
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterEscape_A06_t02: RuntimeError # IllegalJSRegExpException: '\c(' 'SyntaxError: Invalid regular expression: /\c(/: Unterminated group'
@@ -330,10 +329,6 @@
[ $compiler == dart2js ]
Language/07_Classes/3_Setters_A04_t01: CompileTimeError # http://dartbug.com/5023
Language/07_Classes/3_Setters_A04_t02: CompileTimeError # http://dartbug.com/5023
-Language/07_Classes/3_Setters_A04_t03: CompileTimeError # http://dartbug.com/5023
-Language/07_Classes/3_Setters_A04_t04: CompileTimeError # http://dartbug.com/5023
-Language/07_Classes/3_Setters_A04_t05: CompileTimeError # http://dartbug.com/5023
-Language/07_Classes/3_Setters_A04_t06: CompileTimeError # http://dartbug.com/5023
Language/07_Classes/3_Setters_A04_t07: CompileTimeError # http://dartbug.com/5023
Language/12_Expressions/01_Constants_A03_t01: CompileTimeError # Issue 13652
@@ -448,12 +443,6 @@
Language/03_Overview/1_Scoping_A02_t28: fail # co19-roll r559: Please triage this failure
Language/05_Variables/05_Variables_A05_t01: fail # co19-roll r546: Please triage this failure
Language/05_Variables/05_Variables_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/1_Instance_Methods_A01_t01: fail # co19-roll r559: Please triage this failure
-Language/07_Classes/1_Instance_Methods_A01_t02: fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t01: fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t02: fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t03: fail # co19-roll r559: Please triage this failure
-Language/07_Classes/4_Abstract_Instance_Members_A03_t04: fail # co19-roll r559: Please triage this failure
Language/12_Expressions/00_Object_Identity/1_Object_Identity_A02_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/00_Object_Identity/1_Object_Identity_A06_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/03_Numbers_A01_t06: fail # co19-roll r546: Please triage this failure
@@ -646,8 +635,6 @@
LibTest/typed_data/Uint8List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
[ $compiler == dart2js || $compiler == dart2dart ]
-Language/07_Classes/1_Instance_Methods_A07_t02: CompileTimeError # co19-roll r667: Please triage this failure
-Language/07_Classes/1_Instance_Methods_A03_t06: fail # co19-roll r587: Please triage this failure
Language/07_Classes/1_Instance_Methods_A07_t01: fail # co19-roll r587: Please triage this failure
Language/07_Classes/6_Constructors/2_Factories_A08_t02: fail # co19-roll r587: Please triage this failure
Language/07_Classes/6_Constructors/2_Factories_A10_t02: fail # co19-roll r587: Please triage this failure
@@ -658,7 +645,6 @@
Language/12_Expressions/12_Instance_Creation/1_New_A06_t15: CompileTimeError # co19-roll r651: Please triage this failure
Language/12_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t17: MissingCompileTimeError # co19-roll r651: Please triage this failure
Language/12_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t18: MissingCompileTimeError # co19-roll r651: Please triage this failure
-Language/14_Libraries_and_Scripts/2_Exports_A05_t03: MissingCompileTimeError # co19-roll r623: Please triage this failure
Language/15_Types/4_Interface_Types_A11_t04: fail # Issue 14654
LibTest/core/Symbol/Symbol_A01_t02: CompileTimeError # co19-roll r607: Please triage this failure
LibTest/isolate/Isolate/spawnUri_A01_t01: Fail # co19-roll r672: Please triage this failure
diff --git a/tests/compiler/dart2js/analyze_api_test.dart b/tests/compiler/dart2js/analyze_api_test.dart
index de48a2e..2e860d5 100644
--- a/tests/compiler/dart2js/analyze_api_test.dart
+++ b/tests/compiler/dart2js/analyze_api_test.dart
@@ -20,6 +20,14 @@
// TODO(johnniwinther): Support canonical URIs as keys and message kinds as
// values.
const Map<String, List<String>> WHITE_LIST = const {
+ 'html_dart2js.dart': const [
+ "doesn't implement", // Issue 16105.
+ "is not assignable to the type 'HtmlCollection'", // Issue 16105.
+ "is not a subtype of the overridden method type", // Issue 16105.
+ ],
+ 'html_common/lists.dart': const [
+ "has no implementation" // Issue 16105.
+ ],
};
void main() {
diff --git a/tests/compiler/dart2js/analyze_helper.dart b/tests/compiler/dart2js/analyze_helper.dart
index 47deb90..585468a 100644
--- a/tests/compiler/dart2js/analyze_helper.dart
+++ b/tests/compiler/dart2js/analyze_helper.dart
@@ -30,6 +30,7 @@
bool hasWarnings = false;
bool hasHint = false;
bool hasErrors = false;
+ bool lastWasWhitelisted = false;
Map<String, Map<String, int>> whiteListMap
= new Map<String, Map<String, int>>();
@@ -99,6 +100,7 @@
if (kind == api.Diagnostic.WARNING) {
if (checkWhiteList(uri, message)) {
// Suppress whitelisted warnings.
+ lastWasWhitelisted = true;
return;
}
hasWarnings = true;
@@ -106,6 +108,7 @@
if (kind == api.Diagnostic.HINT) {
if (checkWhiteList(uri, message)) {
// Suppress whitelisted hints.
+ lastWasWhitelisted = true;
return;
}
hasHint = true;
@@ -113,10 +116,15 @@
if (kind == api.Diagnostic.ERROR) {
if (checkWhiteList(uri, message)) {
// Suppress whitelisted errors.
+ lastWasWhitelisted = true;
return;
}
hasErrors = true;
}
+ if (kind == api.Diagnostic.INFO && lastWasWhitelisted) {
+ return;
+ }
+ lastWasWhitelisted = false;
super.diagnosticHandler(uri, begin, end, message, kind);
}
}
diff --git a/tests/compiler/dart2js/analyze_only_test.dart b/tests/compiler/dart2js/analyze_only_test.dart
index e189790..edc0d4c 100644
--- a/tests/compiler/dart2js/analyze_only_test.dart
+++ b/tests/compiler/dart2js/analyze_only_test.dart
@@ -54,9 +54,9 @@
[],
(String code, List errors, List warnings) {
Expect.isNull(code);
- Expect.equals(1, errors.length);
+ Expect.equals(1, errors.length, 'errors=$errors');
Expect.equals("Error: Could not find 'main'.", errors[0].toString());
- Expect.isTrue(warnings.isEmpty);
+ Expect.isTrue(warnings.isEmpty, 'warnings=$warnings');
});
runCompiler(
diff --git a/tests/compiler/dart2js/check_members_test.dart b/tests/compiler/dart2js/check_members_test.dart
new file mode 100644
index 0000000..023e849
--- /dev/null
+++ b/tests/compiler/dart2js/check_members_test.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test that dart2js produces the expected static type warnings for least upper
+// bound language tests. This ensures that the analyzer and dart2js agrees
+// on these tests.
+
+import 'warnings_checker.dart';
+
+/// Map from test files to a map of their expected status. If the status map is
+/// `null` no warnings must be missing or unexpected, otherwise the status map
+/// can contain a list of line numbers for keys 'missing' and 'unexpected' for
+/// the warnings of each category.
+const Map<String, dynamic> TESTS = const {
+ // Instance methods.
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A01_t01.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A01_t02.dart': null,
+
+ 'language/check_method_override_test.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A06_t01.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A06_t02.dart': null,
+
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A02_t01.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A02_t02.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A02_t03.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A02_t04.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A02_t05.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A02_t06.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A03_t01.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A03_t02.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A03_t03.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A03_t04.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A03_t05.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A03_t06.dart': null,
+
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A05_t01.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A05_t02.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A05_t04.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A05_t05.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A05_t06.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A05_t07.dart': null,
+ 'co19/src/Language/07_Classes/1_Instance_Methods_A05_t08.dart': null,
+ // Getters.
+ 'co19/src/Language/07_Classes/2_Getters_A05_t01.dart': null,
+ 'co19/src/Language/07_Classes/2_Getters_A05_t02.dart': null,
+ 'co19/src/Language/07_Classes/2_Getters_A05_t03.dart': null,
+ 'co19/src/Language/07_Classes/2_Getters_A05_t04.dart': null,
+};
+
+void main() {
+ checkWarnings(TESTS);
+}
diff --git a/tests/compiler/dart2js/members_test.dart b/tests/compiler/dart2js/members_test.dart
index 155c531..558be71 100644
--- a/tests/compiler/dart2js/members_test.dart
+++ b/tests/compiler/dart2js/members_test.dart
@@ -168,7 +168,7 @@
method() {}
abstractMethod();
- static staticMethod() {}
+ static staticMethod() {}
}
class B<T> {
T field;
@@ -558,7 +558,7 @@
method2() {}
}
abstract class B {
- method1();
+ method1();
method2(a);
}
abstract class C extends A implements B {}
@@ -610,7 +610,7 @@
method4(T a) {}
}
abstract class B<S> {
- method1();
+ method1();
method2(a);
method3(S a) {}
}
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index 1035d1a..f39e046 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -103,10 +103,7 @@
// files must be available to the new diagnostic handler.
provider = expando[cachedCompiler.provider];
readStringFromUri = cachedCompiler.provider;
- provider.memorySourceFiles.clear();
- memorySourceFiles.forEach((key, value) {
- provider.memorySourceFiles[key] = value;
- });
+ provider.memorySourceFiles = memorySourceFiles;
}
var handler =
createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics);
diff --git a/tests/compiler/dart2js/memory_source_file_helper.dart b/tests/compiler/dart2js/memory_source_file_helper.dart
index 8610a2b..4409497 100644
--- a/tests/compiler/dart2js/memory_source_file_helper.dart
+++ b/tests/compiler/dart2js/memory_source_file_helper.dart
@@ -24,7 +24,7 @@
show SourceFileProvider, FormattingDiagnosticHandler;
class MemorySourceFileProvider extends SourceFileProvider {
- final Map<String, String> memorySourceFiles;
+ Map<String, String> memorySourceFiles;
MemorySourceFileProvider(Map<String, String> this.memorySourceFiles);
diff --git a/tests/compiler/dart2js/message_kind_test.dart b/tests/compiler/dart2js/message_kind_test.dart
index 505fe5b..7a882d4 100644
--- a/tests/compiler/dart2js/message_kind_test.dart
+++ b/tests/compiler/dart2js/message_kind_test.dart
@@ -49,7 +49,14 @@
};
var cachedCompiler;
asyncTest(() => Future.forEach(examples, (String name) {
+ print("Checking '$name'.");
Stopwatch sw = new Stopwatch()..start();
+ bool useCachedCompiler = true;
+ if (name == 'MISSING_LIBRARY_NAME') {
+ // TODO(johnniwinther): Found out why we cannot use the cached compiler
+ // for this message kind.
+ cachedCompiler = null;
+ }
return check(kinds[name], cachedCompiler).
then((var compiler) {
cachedCompiler = compiler;
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index a91eeff..b63df94 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -478,15 +478,22 @@
};
}
-/// [expectedWarnings] must be a list of either [MessageKind] or [CheckMessage].
void compareWarningKinds(String text,
List expectedWarnings,
List<WarningMessage> foundWarnings) {
+ compareMessageKinds(text, expectedWarnings, foundWarnings, 'warning');
+}
+
+/// [expectedMessages] must be a list of either [MessageKind] or [CheckMessage].
+void compareMessageKinds(String text,
+ List expectedMessages,
+ List<WarningMessage> foundMessages,
+ String kind) {
var fail = (message) => Expect.fail('$text: $message');
HasNextIterator expectedIterator =
- new HasNextIterator(expectedWarnings.iterator);
+ new HasNextIterator(expectedMessages.iterator);
HasNextIterator<WarningMessage> foundIterator =
- new HasNextIterator(foundWarnings.iterator);
+ new HasNextIterator(foundMessages.iterator);
while (expectedIterator.hasNext && foundIterator.hasNext) {
var expected = expectedIterator.next();
var found = foundIterator.next();
@@ -496,22 +503,22 @@
String error = expected(found.message);
Expect.isNull(error, error);
} else {
- Expect.fail("Unexpected expectedWarnings value: $expected.");
+ Expect.fail("Unexpected $kind value: $expected.");
}
}
if (expectedIterator.hasNext) {
do {
var expected = expectedIterator.next();
if (expected is CheckMessage) expected = expected(null);
- print('Expected warning "${expected}" did not occur');
+ print('Expected $kind "${expected}" did not occur');
} while (expectedIterator.hasNext);
- fail('Too few warnings');
+ fail('Too few ${kind}s');
}
if (foundIterator.hasNext) {
do {
- print('Additional warning "${foundIterator.next()}"');
+ print('Additional $kind "${foundIterator.next()}"');
} while (foundIterator.hasNext);
- fail('Too many warnings');
+ fail('Too many ${kind}s');
}
}
diff --git a/tests/compiler/dart2js/override_inheritance_test.dart b/tests/compiler/dart2js/override_inheritance_test.dart
new file mode 100644
index 0000000..f3ccd9a
--- /dev/null
+++ b/tests/compiler/dart2js/override_inheritance_test.dart
@@ -0,0 +1,1512 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+import "compiler_helper.dart";
+
+main() {
+ testRequiredParameters();
+ testPositionalParameters();
+ testNamedParameters();
+ testNotSubtype();
+ testGetterNotSubtype();
+ testSetterNotSubtype();
+ testGenericNotSubtype();
+ testFieldNotSubtype();
+ testMixedOverride();
+ testAbstractMethods();
+ testNoSuchMethod();
+}
+
+check(String source, {errors, warnings, hints, infos}) {
+ MockCompiler compiler = new MockCompiler();
+ compiler.diagnosticHandler = createHandler(compiler, source);
+ compiler.parseScript(source);
+ var cls = compiler.mainApp.find('Class');
+ cls.ensureResolved(compiler);
+
+ toList(o) => o == null ? [] : o is List ? o : [o];
+
+ compareMessageKinds(source, toList(errors), compiler.errors, 'error');
+
+ compareMessageKinds(source, toList(warnings), compiler.warnings, 'warning');
+
+ if (infos != null) {
+ compareMessageKinds(source, toList(infos), compiler.infos, 'info');
+ }
+
+ if (hints != null) {
+ compareMessageKinds(source, toList(hints), compiler.hints, 'hint');
+ }
+}
+
+testRequiredParameters() {
+ check("""
+ class A {
+ method() => null; // testRequiredParameters:0
+ }
+ class Class extends A {
+ method() => null; // testRequiredParameters:1
+ }
+ """);
+
+ check("""
+ class A {
+ method(a) => null; // testRequiredParameters:2
+ }
+ class Class extends A {
+ method(b) => null; // testRequiredParameters:3
+ }
+ """);
+
+ check("""
+ class A {
+ method(a, b, c, d) => null; // testRequiredParameters:3
+ }
+ class Class extends A {
+ method(b, a, d, c) => null; // testRequiredParameters:4
+ }
+ """);
+
+ check("""
+ class A {
+ method() => null; // testRequiredParameters:5
+ }
+ class Class extends A {
+ method(a) => null; // testRequiredParameters:6
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method() => null; // testRequiredParameters:7
+ }
+ class Class implements A {
+ method(a) => null; // testRequiredParameters:8
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method(a, b, c) => null; // testRequiredParameters:9
+ }
+ class Class extends A {
+ method(a, b, c, d) => null; // testRequiredParameters:10
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+}
+
+testPositionalParameters() {
+ check("""
+ class A {
+ method([a]) => null; // testPositionalParameters:1
+ }
+ class Class extends A {
+ method([a]) => null; // testPositionalParameters:2
+ }
+ """);
+
+ check("""
+ class A {
+ method([a, b]) => null; // testPositionalParameters:3
+ }
+ class Class extends A {
+ method([b, a]) => null; // testPositionalParameters:4
+ }
+ """);
+
+ check("""
+ class A {
+ method([a, b, c]) => null; // testPositionalParameters:5
+ }
+ class Class extends A {
+ method([b, d, a, c]) => null; // testPositionalParameters:6
+ }
+ """);
+
+ check("""
+ class A {
+ method([a]) => null; // testPositionalParameters:7
+ }
+ class Class extends A {
+ method([a]) => null; // testPositionalParameters:8
+ }
+ """);
+
+ check("""
+ class A {
+ method(a) => null; // testPositionalParameters:9
+ }
+ class Class extends A {
+ method() => null; // testPositionalParameters:10
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method(a, [b]) => null; // testPositionalParameters:11
+ }
+ class Class extends A {
+ method(a) => null; // testPositionalParameters:12
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method(a, [b]) => null; // testPositionalParameters:13
+ }
+ class Class extends A {
+ method([a]) => null; // testPositionalParameters:14
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method(a, b, [c, d, e]) => null; // testPositionalParameters:15
+ }
+ class Class extends A {
+ method([a, b, c, d]) => null; // testPositionalParameters:16
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+}
+
+testNamedParameters() {
+ check("""
+ class A {
+ method({a}) => null; // testNamedParameters:1
+ }
+ class Class extends A {
+ method({a}) => null; // testNamedParameters:2
+ }
+ """);
+
+ check("""
+ class A {
+ method({a, b}) => null; // testNamedParameters:3
+ }
+ class Class extends A {
+ method({b, a}) => null; // testNamedParameters:4
+ }
+ """);
+
+ check("""
+ class A {
+ method({a, b, c}) => null; // testNamedParameters:5
+ }
+ class Class extends A {
+ method({b, c, a, d}) => null; // testNamedParameters:6
+ }
+ """);
+
+ check("""
+ class A {
+ method(d, {a, b, c}) => null; // testNamedParameters:7
+ }
+ class Class extends A {
+ method(e, {b, c, a, d}) => null; // testNamedParameters:8
+ }
+ """);
+
+ check("""
+ class A {
+ method({a}) => null; // testNamedParameters:9
+ }
+ class Class extends A {
+ method() => null; // testNamedParameters:10
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method({a, b}) => null; // testNamedParameters:11
+ }
+ class Class extends A {
+ method({b}) => null; // testNamedParameters:12
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method({a, b, c, d}) => null; // testNamedParameters:13
+ }
+ class Class extends A {
+ method({a, e, d, c}) => null; // testNamedParameters:14
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+}
+
+testNotSubtype() {
+ check("""
+ class A {
+ method(int a) => null; // testNotSubtype:1
+ }
+ class Class extends A {
+ method(int a) => null; // testNotSubtype:2
+ }
+ """);
+
+ check("""
+ class A {
+ method(int a) => null; // testNotSubtype:3
+ }
+ class Class extends A {
+ method(num a) => null; // testNotSubtype:4
+ }
+ """);
+
+ check("""
+ class A {
+ void method() {} // testNotSubtype:5
+ }
+ class Class extends A {
+ method() => null; // testNotSubtype:6
+ }
+ """);
+
+ check("""
+ class A {
+ method() => null; // testNotSubtype:7
+ }
+ class Class extends A {
+ void method() {} // testNotSubtype:8
+ }
+ """);
+
+ check("""
+ class A {
+ void method() {} // testNotSubtype:9
+ }
+ class Class extends A {
+ int method() => null; // testNotSubtype:10
+ }
+ """);
+
+ check("""
+ class A {
+ int method() => null; // testNotSubtype:11
+ }
+ class Class extends A {
+ void method() {} // testNotSubtype:12
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method(int a) => null; // testNotSubtype:13
+ }
+ class B extends A {
+ method(num a) => null; // testNotSubtype:14
+ }
+ class Class extends B {
+ method(double a) => null; // testNotSubtype:15
+ }
+ """);
+
+ check("""
+ class A {
+ method(int a) => null; // testNotSubtype:16
+ }
+ class B extends A {
+ method(a) => null; // testNotSubtype:17
+ }
+ class Class extends B {
+ method(String a) => null; // testNotSubtype:18
+ }
+ """);
+
+ check("""
+ class A {
+ method(int a) => null; // testNotSubtype:19
+ }
+ class Class extends A {
+ method(String a) => null; // testNotSubtype:20
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ // TODO(johnniwinther): These are unclear. Issue 16443 has been filed.
+ check("""
+ class A {
+ method(int a) => null; // testNotSubtype:23
+ }
+ class B {
+ method(num a) => null; // testNotSubtype:24
+ }
+ abstract class C implements A, B {
+ }
+ class Class implements C {
+ method(double a) => null; // testNotSubtype:25
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method(num a) => null; // testNotSubtype:29
+ }
+ class B {
+ method(int a) => null; // testNotSubtype:30
+ }
+ abstract class C implements A, B {
+ }
+ class Class implements C {
+ method(double a) => null; // testNotSubtype:31
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A {
+ method(int a) => null; // testNotSubtype:26
+ }
+ class B {
+ method(num a) => null; // testNotSubtype:27
+ }
+ abstract class C implements A, B {
+ }
+ class Class implements C {
+ method(String a) => null; // testNotSubtype:28
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD,
+ MessageKind.INVALID_OVERRIDE_METHOD],
+ infos: [MessageKind.INVALID_OVERRIDDEN_METHOD,
+ MessageKind.INVALID_OVERRIDDEN_METHOD]);
+}
+
+testGetterNotSubtype() {
+ check("""
+ class A {
+ get getter => null; // testGetterNotSubtype:1
+ }
+ class Class extends A {
+ get getter => null; // testGetterNotSubtype:2
+ }
+ """);
+
+ check("""
+ class A {
+ num get getter => null; // testGetterNotSubtype:3
+ }
+ class Class extends A {
+ num get getter => null; // testGetterNotSubtype:4
+ }
+ """);
+
+ check("""
+ class A {
+ num get getter => null; // testGetterNotSubtype:5
+ }
+ class Class extends A {
+ int get getter => null; // testGetterNotSubtype:6
+ }
+ """);
+
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:7
+ }
+ class Class extends A {
+ num get getter => null; // testGetterNotSubtype:8
+ }
+ """);
+
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:9
+ }
+ class Class extends A {
+ double get getter => null; // testGetterNotSubtype:10
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_GETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_GETTER);
+
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:11
+ }
+ class B extends A {
+ num get getter => null; // testGetterNotSubtype:12
+ }
+ class Class extends B {
+ double get getter => null; // testGetterNotSubtype:13
+ }
+ """);
+
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:14
+ }
+ class B {
+ num get getter => null; // testGetterNotSubtype:15
+ }
+ class Class extends A implements B {
+ double get getter => null; // testGetterNotSubtype:16
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_GETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_GETTER);
+
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:17
+ }
+ class B {
+ String get getter => null; // testGetterNotSubtype:18
+ }
+ class Class extends A implements B {
+ double get getter => null; // testGetterNotSubtype:19
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER,
+ MessageKind.INVALID_OVERRIDE_GETTER],
+ infos: [MessageKind.INVALID_OVERRIDDEN_GETTER,
+ MessageKind.INVALID_OVERRIDDEN_GETTER]);
+
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:20
+ }
+ class B {
+ String get getter => null; // testGetterNotSubtype:21
+ }
+ class Class implements A, B {
+ double get getter => null; // testGetterNotSubtype:22
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER,
+ MessageKind.INVALID_OVERRIDE_GETTER],
+ infos: [MessageKind.INVALID_OVERRIDDEN_GETTER,
+ MessageKind.INVALID_OVERRIDDEN_GETTER]);
+
+ // TODO(johnniwinther): These are unclear. Issue 16443 has been filed.
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:23
+ }
+ class B {
+ num get getter => null; // testGetterNotSubtype:24
+ }
+ abstract class C implements A, B {
+ }
+ class Class implements C {
+ double get getter => null; // testGetterNotSubtype:25
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_GETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_GETTER);
+
+ check("""
+ class A {
+ int get getter => null; // testGetterNotSubtype:26
+ }
+ class B {
+ num get getter => null; // testGetterNotSubtype:27
+ }
+ abstract class C implements A, B {
+ }
+ class Class implements C {
+ String get getter => null; // testGetterNotSubtype:28
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER,
+ MessageKind.INVALID_OVERRIDE_GETTER],
+ infos: [MessageKind.INVALID_OVERRIDDEN_GETTER,
+ MessageKind.INVALID_OVERRIDDEN_GETTER]);
+}
+
+testGenericNotSubtype() {
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:1
+ }
+ class Class<S> extends A<S> {
+ method(S s) => null; // testGenericNotSubtype:2
+ }
+ """);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:3
+ }
+ class Class extends A<num> {
+ method(int i) => null; // testGenericNotSubtype:4
+ }
+ """);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:5
+ }
+ class B<S> {
+ method(S s) => null; // testGenericNotSubtype:6
+ }
+ class Class extends A<double> implements B<int> {
+ method(num i) => null; // testGenericNotSubtype:7
+ }
+ """);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:8
+ }
+ class Class<S> extends A<S> {
+ method(int i) => null; // testGenericNotSubtype:9
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:10
+ }
+ class B<S> extends A<S> {
+
+ }
+ class Class<U> extends B<U> {
+ method(U u) => null; // testGenericNotSubtype:11
+ }
+ """);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:12
+ }
+ class B<S> {
+ method(S s) => null; // testGenericNotSubtype:13
+ }
+ class Class<U> extends A<U> implements B<num> {
+ method(int i) => null; // testGenericNotSubtype:14
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:15
+ }
+ class B<S> {
+ method(S s) => null; // testGenericNotSubtype:16
+ }
+ class Class extends A<int> implements B<String> {
+ method(double d) => null; // testGenericNotSubtype:17
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD,
+ MessageKind.INVALID_OVERRIDE_METHOD],
+ infos: [MessageKind.INVALID_OVERRIDDEN_METHOD,
+ MessageKind.INVALID_OVERRIDDEN_METHOD]);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:18
+ }
+ class B<S> {
+ method(S s) => null; // testGenericNotSubtype:19
+ }
+ class Class implements A<int>, B<String> {
+ method(double d) => null; // testGenericNotSubtype:20
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD,
+ MessageKind.INVALID_OVERRIDE_METHOD],
+ infos: [MessageKind.INVALID_OVERRIDDEN_METHOD,
+ MessageKind.INVALID_OVERRIDDEN_METHOD]);
+
+ // TODO(johnniwinther): These are unclear. Issue 16443 has been filed.
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:21
+ }
+ class B<S> {
+ method(S s) => null; // testGenericNotSubtype:22
+ }
+ abstract class C implements A<int>, B<num> {
+ }
+ class Class implements C {
+ method(double d) => null; // testGenericNotSubtype:23
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_METHOD,
+ infos: MessageKind.INVALID_OVERRIDDEN_METHOD);
+
+ check("""
+ class A<T> {
+ method(T t) => null; // testGenericNotSubtype:24
+ }
+ class B<S> {
+ method(S s) => null; // testGenericNotSubtype:25
+ }
+ abstract class C implements A<int>, B<num> {
+ }
+ class Class implements C {
+ method(String s) => null; // testGenericNotSubtype:26
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD,
+ MessageKind.INVALID_OVERRIDE_METHOD],
+ infos: [MessageKind.INVALID_OVERRIDDEN_METHOD,
+ MessageKind.INVALID_OVERRIDDEN_METHOD]);
+}
+
+testSetterNotSubtype() {
+ check("""
+ class A {
+ set setter(_) => null; // testSetterNotSubtype:1
+ }
+ class Class extends A {
+ set setter(_) => null; // testSetterNotSubtype:2
+ }
+ """);
+
+ check("""
+ class A {
+ void set setter(_) {} // testSetterNotSubtype:3
+ }
+ class Class extends A {
+ set setter(_) => null; // testSetterNotSubtype:4
+ }
+ """);
+
+ check("""
+ class A {
+ set setter(_) => null; // testSetterNotSubtype:5
+ }
+ class Class extends A {
+ void set setter(_) {} // testSetterNotSubtype:6
+ }
+ """);
+
+ check("""
+ class A {
+ set setter(_) => null; // testSetterNotSubtype:7
+ }
+ class Class extends A {
+ void set setter(_) {} // testSetterNotSubtype:8
+ }
+ """);
+
+ check("""
+ class A {
+ set setter(num _) => null; // testSetterNotSubtype:9
+ }
+ class Class extends A {
+ set setter(num _) => null; // testSetterNotSubtype:10
+ }
+ """);
+
+ check("""
+ class A {
+ set setter(num _) => null; // testSetterNotSubtype:11
+ }
+ class Class extends A {
+ set setter(int _) => null; // testSetterNotSubtype:12
+ }
+ """);
+
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:13
+ }
+ class Class extends A {
+ set setter(num _) => null; // testSetterNotSubtype:14
+ }
+ """);
+
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:15
+ }
+ class Class extends A {
+ set setter(double _) => null; // testSetterNotSubtype:16
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_SETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_SETTER);
+
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:17
+ }
+ class B extends A {
+ set setter(num _) => null; // testSetterNotSubtype:18
+ }
+ class Class extends B {
+ set setter(double _) => null; // testSetterNotSubtype:19
+ }
+ """);
+
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:20
+ }
+ class B {
+ set setter(num _) => null; // testSetterNotSubtype:21
+ }
+ class Class extends A implements B {
+ set setter(double _) => null; // testSetterNotSubtype:22
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_SETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_SETTER);
+
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:23
+ }
+ class B {
+ set setter(String _) => null; // testSetterNotSubtype:24
+ }
+ class Class extends A implements B {
+ set setter(double _) => null; // testSetterNotSubtype:25
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_SETTER,
+ MessageKind.INVALID_OVERRIDE_SETTER],
+ infos: [MessageKind.INVALID_OVERRIDDEN_SETTER,
+ MessageKind.INVALID_OVERRIDDEN_SETTER]);
+
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:26
+ }
+ class B {
+ set setter(String _) => null; // testSetterNotSubtype:27
+ }
+ class Class implements A, B {
+ set setter(double _) => null; // testSetterNotSubtype:28
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_SETTER,
+ MessageKind.INVALID_OVERRIDE_SETTER],
+ infos: [MessageKind.INVALID_OVERRIDDEN_SETTER,
+ MessageKind.INVALID_OVERRIDDEN_SETTER]);
+
+ // TODO(johnniwinther): These are unclear. Issue 16443 has been filed.
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:29
+ }
+ class B {
+ set setter(num _) => null; // testSetterNotSubtype:30
+ }
+ abstract class C implements A, B {
+ }
+ class Class implements C {
+ set setter(double _) => null; // testSetterNotSubtype:31
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_SETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_SETTER);
+
+ check("""
+ class A {
+ set setter(int _) => null; // testSetterNotSubtype:32
+ }
+ class B {
+ set setter(num _) => null; // testSetterNotSubtype:33
+ }
+ abstract class C implements A, B {
+ }
+ class Class implements C {
+ set setter(String _) => null; // testSetterNotSubtype:34
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_SETTER,
+ MessageKind.INVALID_OVERRIDE_SETTER],
+ infos: [MessageKind.INVALID_OVERRIDDEN_SETTER,
+ MessageKind.INVALID_OVERRIDDEN_SETTER]);
+}
+
+testFieldNotSubtype() {
+ check("""
+ class A {
+ int field; // testFieldNotSubtype:1
+ }
+ class Class extends A {
+ int field; // testFieldNotSubtype:2
+ }
+ """);
+
+ check("""
+ class A {
+ num field; // testFieldNotSubtype:3
+ }
+ class Class extends A {
+ int field; // testFieldNotSubtype:4
+ }
+ """);
+
+ check("""
+ class A {
+ int field; // testFieldNotSubtype:5
+ }
+ class Class extends A {
+ num field; // testFieldNotSubtype:6
+ }
+ """);
+
+ check("""
+ class A {
+ int field; // testFieldNotSubtype:7
+ }
+ class Class extends A {
+ double field; // testFieldNotSubtype:8
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_FIELD,
+ infos: MessageKind.INVALID_OVERRIDDEN_FIELD);
+
+ check("""
+ class A {
+ int field; // testFieldNotSubtype:9
+ }
+ class B extends A {
+ num field; // testFieldNotSubtype:10
+ }
+ class Class extends B {
+ double field; // testFieldNotSubtype:11
+ }
+ """);
+
+ check("""
+ class A {
+ num field; // testFieldNotSubtype:12
+ }
+ class Class extends A {
+ int get field => null; // testFieldNotSubtype:13
+ }
+ """);
+
+ check("""
+ class A {
+ num field; // testFieldNotSubtype:14
+ }
+ class Class extends A {
+ String get field => null; // testFieldNotSubtype:15
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_FIELD);
+
+ check("""
+ class A {
+ num get field => null; // testFieldNotSubtype:16
+ }
+ class Class extends A {
+ String field; // testFieldNotSubtype:17
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD,
+ infos: MessageKind.INVALID_OVERRIDDEN_GETTER);
+
+ check("""
+ class A {
+ num field; // testFieldNotSubtype:18
+ }
+ class Class extends A {
+ set field(int _) {} // testFieldNotSubtype:19
+ }
+ """);
+
+ check("""
+ class A {
+ num field; // testFieldNotSubtype:19
+ }
+ class Class extends A {
+ void set field(int _) {} // testFieldNotSubtype:20
+ }
+ """);
+
+ check("""
+ class A {
+ set field(int _) {} // testFieldNotSubtype:21
+ }
+ class Class extends A {
+ num field; // testFieldNotSubtype:22
+ }
+ """);
+
+ check("""
+ class A {
+ void set field(int _) {} // testFieldNotSubtype:23
+ }
+ class Class extends A {
+ num field; // testFieldNotSubtype:24
+ }
+ """);
+
+ check("""
+ class A {
+ num field; // testFieldNotSubtype:25
+ }
+ class Class extends A {
+ set field(String _) {} // testFieldNotSubtype:26
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER,
+ infos: MessageKind.INVALID_OVERRIDDEN_FIELD);
+
+ check("""
+ class A {
+ set field(num _) {} // testFieldNotSubtype:27
+ }
+ class Class extends A {
+ String field; // testFieldNotSubtype:28
+ }
+ """, warnings: MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD,
+ infos: MessageKind.INVALID_OVERRIDDEN_SETTER);
+
+ check("""
+ class A {
+ int field; // testFieldNotSubtype:29
+ }
+ class Class implements A {
+ String get field => null; // testFieldNotSubtype:30
+ void set field(String s) {} // testFieldNotSubtype:31
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER,
+ MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER],
+ infos: [MessageKind.INVALID_OVERRIDDEN_FIELD,
+ MessageKind.INVALID_OVERRIDDEN_FIELD]);
+
+
+ check("""
+ class A {
+ String get field => null; // testFieldNotSubtype:32
+ void set field(String s) {} // testFieldNotSubtype:33
+ }
+ class Class implements A {
+ int field; // testFieldNotSubtype:34
+ }
+ """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD,
+ MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD],
+ infos: [MessageKind.INVALID_OVERRIDDEN_GETTER,
+ MessageKind.INVALID_OVERRIDDEN_SETTER]);
+}
+
+testMixedOverride() {
+ check("""
+ class A {
+ var member; // testMixedOverride:1
+ }
+ class Class extends A {
+ member() {} // testMixedOverride:2
+ }
+ """, errors: MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD,
+ infos: MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT);
+
+ check("""
+ class A {
+ member() {} // testMixedOverride:3
+ }
+ class Class extends A {
+ var member; // testMixedOverride:4
+ }
+ """, errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD,
+ infos: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT);
+
+ check("""
+ class A {
+ get member => null; // testMixedOverride:5
+ }
+ class Class extends A {
+ member() {} // testMixedOverride:6
+ }
+ """, errors: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD,
+ infos: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT);
+
+ check("""
+ class A {
+ member() {} // testMixedOverride:7
+ }
+ class Class extends A {
+ get member => null; // testMixedOverride:8
+ }
+ """, errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER,
+ infos: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT);
+
+ check("""
+ abstract class A {
+ var member; // testMixedOverride:9
+ }
+ abstract class B {
+ get member; // testMixedOverride:10
+ }
+ abstract class Class implements A, B {
+ }
+ """);
+
+ check("""
+ abstract class A {
+ var member; // testMixedOverride:11
+ }
+ abstract class B {
+ member() {} // testMixedOverride:12
+ }
+ abstract class Class implements A, B {
+ }
+ """, warnings: MessageKind.INHERIT_GETTER_AND_METHOD,
+ infos: [MessageKind.INHERITED_METHOD,
+ MessageKind.INHERITED_IMPLICIT_GETTER]);
+
+ check("""
+ abstract class A {
+ get member; // testMixedOverride:13
+ }
+ abstract class B {
+ member() {} // testMixedOverride:14
+ }
+ abstract class Class implements A, B {
+ }
+ """, warnings: MessageKind.INHERIT_GETTER_AND_METHOD,
+ infos: [MessageKind.INHERITED_METHOD,
+ MessageKind.INHERITED_EXPLICIT_GETTER]);
+
+ check("""
+ abstract class A {
+ get member; // testMixedOverride:15
+ }
+ abstract class B {
+ member() {} // testMixedOverride:16
+ }
+ abstract class C {
+ var member; // testMixedOverride:17
+ }
+ abstract class D {
+ member() {} // testMixedOverride:18
+ }
+ abstract class E {
+ get member; // testMixedOverride:19
+ }
+ abstract class Class implements A, B, C, D, E {
+ }
+ """, warnings: MessageKind.INHERIT_GETTER_AND_METHOD,
+ infos: [MessageKind.INHERITED_EXPLICIT_GETTER,
+ MessageKind.INHERITED_METHOD,
+ MessageKind.INHERITED_IMPLICIT_GETTER,
+ MessageKind.INHERITED_METHOD,
+ MessageKind.INHERITED_EXPLICIT_GETTER]);
+
+ check("""
+ abstract class A {
+ get member; // testMixedOverride:20
+ }
+ abstract class B {
+ member() {} // testMixedOverride:21
+ }
+ abstract class C implements A, B {
+ }
+ class Class extends C {
+ member() {} // testMixedOverride:22
+ }
+ """, errors: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD,
+ warnings: MessageKind.INHERIT_GETTER_AND_METHOD,
+ infos: [MessageKind.INHERITED_METHOD,
+ MessageKind.INHERITED_EXPLICIT_GETTER,
+ MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT]);
+
+ check("""
+ abstract class A {
+ get member; // testMixedOverride:23
+ }
+ abstract class B {
+ member() {} // testMixedOverride:24
+ }
+ abstract class C implements A, B {
+ }
+ class Class extends C {
+ get member => null; // testMixedOverride:25
+ }
+ """, errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER,
+ warnings: MessageKind.INHERIT_GETTER_AND_METHOD,
+ infos: [MessageKind.INHERITED_METHOD,
+ MessageKind.INHERITED_EXPLICIT_GETTER,
+ MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT]);
+}
+
+testAbstractMethods() {
+ check("""
+ abstract class Class {
+ method(); // testAbstractMethod:1
+ }
+ """);
+
+ check("""
+ class Class {
+ method(); // testAbstractMethod:2
+ }
+ """, warnings: MessageKind.ABSTRACT_METHOD,
+ infos: []);
+
+ check("""
+ class Class {
+ get getter; // testAbstractMethod:3
+ }
+ """, warnings: MessageKind.ABSTRACT_GETTER,
+ infos: []);
+
+ check("""
+ class Class {
+ set setter(_); // testAbstractMethod:4
+ }
+ """, warnings: MessageKind.ABSTRACT_SETTER,
+ infos: []);
+
+ check("""
+ abstract class A {
+ method(); // testAbstractMethod:5
+ }
+ class Class extends A {
+ method() {} // testAbstractMethod:6
+ }
+ """);
+
+ check("""
+ abstract class A {
+ method(); // testAbstractMethod:7
+ }
+ class Class extends A {
+ method([a]) {} // testAbstractMethod:8
+ }
+ """);
+
+ check("""
+ abstract class A {
+ method(); // testAbstractMethod:9
+ }
+ class Class extends A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+
+ check("""
+ abstract class A {
+ get getter; // testAbstractMethod:10
+ }
+ class Class extends A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE,
+ infos: MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER);
+
+ check("""
+ abstract class A {
+ set setter(_); // testAbstractMethod:11
+ }
+ class Class extends A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE,
+ infos: MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER);
+
+ check("""
+ abstract class A {
+ method(); // testAbstractMethod:12
+ }
+ class B {
+ method() {} // testAbstractMethod:13
+ }
+ class Class extends A implements B {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD,
+ infos: [MessageKind.UNIMPLEMENTED_METHOD_CONT,
+ MessageKind.UNIMPLEMENTED_METHOD_CONT]);
+
+ check("""
+ abstract class A {
+ get getter; // testAbstractMethod:14
+ }
+ class B {
+ get getter => 0; // testAbstractMethod:15
+ }
+ class Class extends A implements B {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_GETTER,
+ infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER]);
+
+ check("""
+ abstract class A {
+ set setter(_); // testAbstractMethod:16
+ }
+ class B {
+ set setter(_) {} // testAbstractMethod:17
+ }
+ class Class extends A implements B {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_SETTER,
+ infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER,
+ MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER]);
+
+ check("""
+ abstract class A {
+ get field; // testAbstractMethod:18
+ }
+ class B {
+ var field; // testAbstractMethod:19
+ }
+ class Class extends A implements B {
+ set field(_) {} // testAbstractMethod:20
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_GETTER,
+ infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER]);
+
+ check("""
+ abstract class A {
+ set field(_); // testAbstractMethod:21
+ }
+ class B {
+ var field; // testAbstractMethod:22
+ }
+ class Class extends A implements B {
+ get field => 0; // testAbstractMethod:23
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_SETTER,
+ infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]);
+
+ check("""
+ class A {
+ method() {} // testAbstractMethod:24
+ }
+ class Class implements A {
+ method() {} // testAbstractMethod:25
+ }
+ """);
+
+ check("""
+ class A {
+ method() {} // testAbstractMethod:26
+ }
+ class Class implements A {
+ method([a]) {} // testAbstractMethod:27
+ }
+ """);
+
+ check("""
+ class A {
+ method() {} // testAbstractMethod:28
+ }
+ class Class implements A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+
+ check("""
+ class A {
+ method() {} // testAbstractMethod:29
+ }
+ class B {
+ method() {} // testAbstractMethod:30
+ }
+ class Class extends A implements B {
+ }
+ """);
+
+ check("""
+ class A {
+ var member; // testAbstractMethod:31
+ }
+ class Class implements A {
+ }
+ """, warnings: [MessageKind.UNIMPLEMENTED_GETTER_ONE,
+ MessageKind.UNIMPLEMENTED_SETTER_ONE],
+ infos: [MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]);
+
+ check("""
+ class A {
+ var member; // testAbstractMethod:32
+ }
+ class B {
+ get member => null; // testAbstractMethod:33
+ set member(_) {} // testAbstractMethod:34
+ }
+ class Class implements A, B {
+ }
+ """, warnings: [MessageKind.UNIMPLEMENTED_GETTER,
+ MessageKind.UNIMPLEMENTED_SETTER],
+ infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]);
+
+ check("""
+ class A {
+ var member; // testAbstractMethod:35
+ }
+ class B {
+ var member; // testAbstractMethod:36
+ }
+ class Class implements A, B {
+ }
+ """, warnings: [MessageKind.UNIMPLEMENTED_GETTER,
+ MessageKind.UNIMPLEMENTED_SETTER],
+ infos: [MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER,
+ MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]);
+
+ check("""
+ class A {
+ get member => 0; // testAbstractMethod:37
+ }
+ class Class implements A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE,
+ infos: MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER);
+
+ check("""
+ class A {
+ set member(_) {} // testAbstractMethod:38
+ }
+ class Class implements A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE,
+ infos: MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER);
+
+ check("""
+ class A {
+ var member; // testAbstractMethod:39
+ }
+ class Class implements A {
+ get member => 0;
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE,
+ infos: MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER);
+
+ check("""
+ class A {
+ var field; // testAbstractMethod:40
+ }
+ class Class implements A {
+ final field = 0; // testAbstractMethod:41
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE,
+ infos: MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER);
+
+ check("""
+ class A {
+ var member; // testAbstractMethod:42
+ }
+ class Class implements A {
+ set member(_) {}
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE,
+ infos: MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER);
+
+ check("""
+ abstract class A {
+ method() {} // testAbstractMethod:43
+ }
+ class Class extends A {
+ method();
+ }
+ """);
+}
+
+testNoSuchMethod() {
+ check("""
+ class Class {
+ method(); // testNoSuchMethod:1
+ }
+ """, warnings: MessageKind.ABSTRACT_METHOD,
+ infos: []);
+
+ check("""
+ @proxy
+ class Class {
+ method(); // testNoSuchMethod:2
+ }
+ """, warnings: MessageKind.ABSTRACT_METHOD,
+ infos: []);
+
+ check("""
+ class Class {
+ noSuchMethod(_) => null;
+ method(); // testNoSuchMethod:3
+ }
+ """);
+
+ check("""
+ class Class {
+ noSuchMethod(_, [__]) => null;
+ method(); // testNoSuchMethod:4
+ }
+ """);
+
+ check("""
+ class Class {
+ noSuchMethod(_);
+ method(); // testNoSuchMethod:5
+ }
+ """);
+
+ check("""
+ abstract class A {
+ method(); // testNoSuchMethod:6
+ }
+ class Class extends A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+
+ check("""
+ abstract class A {
+ method(); // testNoSuchMethod:7
+ }
+ @proxy
+ class Class extends A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+
+ check("""
+ abstract class A {
+ method(); // testNoSuchMethod:8
+ }
+ class Class extends A {
+ noSuchMethod(_) => null;
+ }
+ """);
+
+ check("""
+ class A {
+ method() {} // testNoSuchMethod:9
+ }
+ class Class implements A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+
+ check("""
+ class A {
+ method() {} // testNoSuchMethod:10
+ }
+ class Class implements A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+
+ check("""
+ class A {
+ method() {} // testNoSuchMethod:11
+ }
+ @proxy
+ class Class implements A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+
+ check("""
+ class A {
+ method() {} // testNoSuchMethod:12
+ }
+ class Class implements A {
+ noSuchMethod(_) => null;
+ }
+ """);
+
+ check("""
+ class A {
+ noSuchMethod(_) => null;
+ method(); // testNoSuchMethod:13
+ }
+ class Class extends A {
+ }
+ """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ infos: MessageKind.UNIMPLEMENTED_METHOD_CONT);
+}
\ No newline at end of file
diff --git a/tests/compiler/dart2js/warnings_checker.dart b/tests/compiler/dart2js/warnings_checker.dart
index aa84570..fc70bef 100644
--- a/tests/compiler/dart2js/warnings_checker.dart
+++ b/tests/compiler/dart2js/warnings_checker.dart
@@ -29,7 +29,9 @@
Map<int,String> expectedWarnings = {};
int lineNo = 0;
for (String line in source.split('\n')) {
- if (line.contains('///') && line.contains('static type warning')) {
+ if (line.contains('///') &&
+ (line.contains('static type warning') ||
+ line.contains('static warning'))) {
expectedWarnings[lineNo] = line;
}
lineNo++;
diff --git a/tests/language/check_member_static_test.dart b/tests/language/check_member_static_test.dart
new file mode 100644
index 0000000..e66c37d
--- /dev/null
+++ b/tests/language/check_member_static_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A {
+ static var a;
+ var b;
+}
+
+class B extends A {
+
+}
+
+class C extends B {
+ var a; /// 01: static type warning
+ static var b; /// 02: compile-time error
+}
+
+void main() {
+ new C();
+}
\ No newline at end of file
diff --git a/tests/language/check_method_override_test.dart b/tests/language/check_method_override_test.dart
new file mode 100644
index 0000000..bfd6e4a
--- /dev/null
+++ b/tests/language/check_method_override_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A {
+ f([var x]) {}
+ foo(var a, [x, y]) {}
+}
+
+class C extends A {
+ f() {} /// 01: static type warning
+ foo(var a, [x]) {} /// 02: static type warning
+}
+
+main() {
+ new A().foo(2);
+ new C().foo(1);
+}
\ No newline at end of file
diff --git a/tests/language/language.status b/tests/language/language.status
index b5d96fd..b51140d 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -22,6 +22,8 @@
[ $compiler == none && $runtime == vm ]
class_keyword_test/02: MissingCompileTimeError # Issue 13627
+override_inheritance_mixed_test/08: MissingCompileTimeError # Issue 16137
+override_inheritance_mixed_test/09: MissingCompileTimeError # Issue 16137
unicode_bom_test: Fail # Issue 16067
diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status
index fcb6c08..2ed39abb 100644
--- a/tests/language/language_analyzer.status
+++ b/tests/language/language_analyzer.status
@@ -181,6 +181,35 @@
# test issue 15714
typevariable_substitution2_test/01: StaticWarning # Issue 15714
+# analyzer does not handle @proxy and noSuchMethod correctly
+override_inheritance_no_such_method_test/03: StaticWarning # Issue 16132
+override_inheritance_no_such_method_test/04: StaticWarning # Issue 16132
+override_inheritance_no_such_method_test/05: StaticWarning # Issue 16132
+
+# missing warning for unimplemented getter/setter
+override_inheritance_abstract_test/13: MissingStaticWarning # Issue 16133
+override_inheritance_abstract_test/26: MissingStaticWarning # Issue 16133
+
+# unexpected warning for override
+override_inheritance_abstract_test/27: StaticWarning # Issue 16134
+override_inheritance_generic_test/03: StaticWarning # Issue 16134
+
+# missing warning for override
+override_inheritance_field_test/10: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/04: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/06: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/07: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/09: MissingStaticWarning # Issue 16135
+
+# missing compile-time error for getter/member override
+override_inheritance_mixed_test/08: MissingCompileTimeError # Issue 16136
+override_inheritance_mixed_test/09: MissingCompileTimeError # Issue 16136
+
+# flaky override tests
+override_inheritance_field_test/33: MissingStaticWarning, Pass # Issue 16498
+override_inheritance_field_test/33a: MissingStaticWarning, Pass # Issue 16498
+
+
abstract_exact_selector_test: StaticWarning
abstract_getter_test: StaticWarning
abstract_object_method_test: StaticWarning
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index 2169b7b..9f42d9f 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -181,6 +181,35 @@
# test issue 15714
typevariable_substitution2_test/01: StaticWarning # Issue 15714
+# analyzer does not handle @proxy and noSuchMethod correctly
+override_inheritance_no_such_method_test/03: StaticWarning # Issue 16132
+override_inheritance_no_such_method_test/04: StaticWarning # Issue 16132
+override_inheritance_no_such_method_test/05: StaticWarning # Issue 16132
+
+# missing warning for unimplemented getter/setter
+override_inheritance_abstract_test/13: MissingStaticWarning # Issue 16133
+override_inheritance_abstract_test/26: MissingStaticWarning # Issue 16133
+
+# unexpected warning for override
+override_inheritance_abstract_test/27: StaticWarning # Issue 16134
+override_inheritance_generic_test/03: StaticWarning # Issue 16134
+
+# missing warning for override
+override_inheritance_field_test/10: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/04: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/06: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/07: MissingStaticWarning # Issue 16135
+override_inheritance_generic_test/09: MissingStaticWarning # Issue 16135
+
+# missing compile-time error for getter/member override
+override_inheritance_mixed_test/08: MissingCompileTimeError # Issue 16136
+override_inheritance_mixed_test/09: MissingCompileTimeError # Issue 16136
+
+# flaky override tests
+override_inheritance_field_test/33: MissingStaticWarning, Pass # Issue 16498
+override_inheritance_field_test/33a: MissingStaticWarning, Pass # Issue 16498
+
+
abstract_exact_selector_test: StaticWarning
abstract_getter_test: StaticWarning
abstract_object_method_test: StaticWarning
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 8e8dc8c..8f9111d 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -114,22 +114,6 @@
factory_redirection_test/01: CompileTimeError # Issue 12752
bad_override_test/01: CompileTimeError # Issue 11496
bad_override_test/02: CompileTimeError # Issue 11496
-bad_override_test/06: CompileTimeError # Issue 11496
-class_override_test/00: CompileTimeError # Issue 11496
-field_override3_test/00: MissingCompileTimeError # Issue 11496
-field_override3_test/01: MissingCompileTimeError # Issue 11496
-field_override3_test/02: MissingCompileTimeError # Issue 11496
-field_override3_test/03: MissingCompileTimeError # Issue 11496
-getter_override_test/00: MissingCompileTimeError # Issue 11496
-getter_override_test/01: MissingCompileTimeError # Issue 11496
-getter_override_test/02: MissingCompileTimeError # Issue 11496
-method_override7_test/00: MissingCompileTimeError # Issue 11496
-method_override7_test/01: MissingCompileTimeError # Issue 11496
-method_override7_test/02: MissingCompileTimeError # Issue 11496
-method_override8_test/03: CompileTimeError # Issue 11496
-setter_override_test/00: MissingCompileTimeError # Issue 11496
-setter_override_test/03: MissingCompileTimeError # Issue 11496
-setter_override2_test/02: CompileTimeError # Issue 11496
constructor_named_arguments_test/01: CompileTimeError # Issue 5519
not_enough_positional_arguments_test/01: CompileTimeError # Issue 12838
not_enough_positional_arguments_test/02: CompileTimeError # Issue 12838
@@ -229,22 +213,6 @@
bad_override_test/01: Fail # Issue 11496
bad_override_test/02: Fail # Issue 11496
-bad_override_test/06: Fail # Issue 11496
-class_override_test/00: Fail # Issue 11496
-field_override3_test/00: Fail # Issue 11496
-field_override3_test/01: Fail # Issue 11496
-field_override3_test/02: Fail # Issue 11496
-field_override3_test/03: Fail # Issue 11496
-getter_override_test/00: Fail # Issue 11496
-getter_override_test/01: Fail # Issue 11496
-getter_override_test/02: Fail # Issue 11496
-method_override7_test/00: Fail # Issue 11496
-method_override7_test/01: Fail # Issue 11496
-method_override7_test/02: Fail # Issue 11496
-method_override8_test/03: Fail # Issue 11496
-setter_override_test/00: Fail # Issue 11496
-setter_override_test/03: Fail # Issue 11496
-setter_override2_test/02: Fail # Issue 11496
constructor_named_arguments_test/01: Fail # Issue 5519
not_enough_positional_arguments_test/01: Fail # Issue 12839
diff --git a/tests/language/override_inheritance_abstract_test.dart b/tests/language/override_inheritance_abstract_test.dart
new file mode 100644
index 0000000..32fb7d1
--- /dev/null
+++ b/tests/language/override_inheritance_abstract_test.dart
@@ -0,0 +1,66 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+abstract class A {
+ method1(); /// 01: ok
+ method5(); /// 05: ok
+ method6(); /// 06: ok
+ method7(); /// 07: static type warning
+ get getter8; /// 08: static type warning
+ set setter9(_); /// 09: static type warning
+ method10(); /// 10: static type warning
+ get getter11; /// 11: static type warning
+ set setter12(_); /// 12: static type warning
+ get field13; /// 13: static type warning
+ set field14(_); /// 14: static type warning
+ method18() {} /// 18: ok
+ method27() {} /// 27: ok
+}
+
+abstract class I {
+ method10() {} /// 10: continued
+ get getter11 => 0; /// 11: continued
+ set setter12(_) {} /// 12: continued
+ var field13; /// 13: continued
+ var field14; /// 14: continued
+ method15() {} /// 15: ok
+ method16() {} /// 16: ok
+ method17() {} /// 17: static type warning
+ method18() {} /// 18: continued
+ var member19; /// 19: static type warning
+ var member20; /// 20: static type warning
+ var member21; /// 21: static type warning
+ get member22 => 0; /// 22: static type warning
+ set member23(_) {} /// 23: static type warning
+ var member24; /// 24: static type warning
+ var field25; /// 25: static type warning
+ var member26; /// 26: static type warning
+}
+
+abstract class J {
+ get member20 => null; /// 20: continued
+ set member20(_) {} /// 20: continued
+ var member21; /// 21: continued
+}
+
+class Class extends A implements I, J {
+ method1() {} /// 01: continued
+ method2(); /// 02: static type warning
+ get getter3; /// 03: static type warning
+ set setter4(_); /// 04: static type warning
+ method5() {} /// 05: continued
+ method6([a]) {} /// 06: continued
+ set field13(_) {} /// 13: continued
+ get field14 => 0; /// 14: continued
+ method15() {} /// 15: continued
+ method16([a]) {} /// 16: continued
+ get member24 => 0; /// 24: continued
+ final field25 = 0; /// 25: continued
+ set member26(_) {} /// 26: continued
+ method27(); /// 27: continued
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override_inheritance_field_test.dart b/tests/language/override_inheritance_field_test.dart
new file mode 100644
index 0000000..7e2b28b
--- /dev/null
+++ b/tests/language/override_inheritance_field_test.dart
@@ -0,0 +1,123 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A {
+ get getter1 => null; /// 01: ok
+ num get getter2 => null; /// 02: ok
+ num get getter3 => null; /// 03: ok
+ int get getter4 => null; /// 04: ok
+ int get getter5 => null; /// 05: static type warning
+ int get getter6 => null; /// 06: ok
+ int get getter7 => null; /// 07: static type warning
+ int get getter8 => null; /// 08: static type warning
+
+ set setter1(_) => null; /// 21: ok
+ void set setter2(_) {} /// 22: ok
+ set setter3(_) => null; /// 23: ok
+ set setter4(_) => null; /// 24: ok
+ set setter5(num _) => null; /// 25: ok
+ set setter6(num _) => null; /// 26: ok
+ set setter7(int _) => null; /// 27: ok
+ set setter8(int _) => null; /// 28: static type warning
+ set setter9(int _) => null; /// 29: ok
+ set setter10(int _) => null; /// 30: static type warning
+ set setter11(int _) => null; /// 31: static type warning
+
+ int field1; /// 41: ok
+ num field2; /// 42: ok
+ int field3; /// 43: ok
+ int field4; /// 44: static type warning
+ int field5; /// 45: ok
+ num field6; /// 46: ok
+ num field7; /// 47: static type warning
+ num get field8 => null; /// 48: static type warning
+ num field9; /// 49: ok
+ num field10; /// 50: ok
+ set field11(int _) {} /// 51: ok
+ void set field12(int _) {} /// 52: ok
+ num field13; /// 53: static type warning
+ set field14(num _) {} /// 54: static type warning
+}
+
+class B extends A {
+ num get getter6 => null; /// 06: continued
+ set setter9(num _) => null; /// 29: continued
+ num field5; /// 45: continued
+}
+
+abstract class I {
+ num get getter7 => null; /// 07: continued
+ String get getter8 => null; /// 08: continued
+ int get getter9 => null; /// 09: static type warning
+ int get getter10 => null; /// 10: static type warning
+ int get getter11 => null; /// 11: static type warning
+ set setter10(num _) => null; /// 30: continued
+ set setter11(String _) => null; /// 31: continued
+ set setter12(int _) => null; /// 32: static type warning
+ set setter13(int _) => null; /// 33: static type warning
+ set setter13(num _) => null; /// 33a: static type warning
+ set setter14(int _) => null; /// 34: static type warning
+}
+
+abstract class J {
+ String get getter9 => null; /// 09: continued
+ num get getter10 => null; /// 10: continued
+ num get getter11 => null; /// 11: continued
+ set setter12(String _) => null; /// 32: continued
+ set setter13(num _) => null; /// 33: continued
+ set setter13(int _) => null; /// 33a: continued
+ set setter14(num _) => null; /// 34: continued
+}
+
+abstract class Class extends B implements I, J {
+ get getter1 => null; /// 01: continued
+ num get getter2 => null; /// 02: continued
+ int get getter3 => null; /// 03: continued
+ num get getter4 => null; /// 04: continued
+ double get getter5 => null; /// 05: continued
+ double get getter6 => null; /// 06: continued
+ double get getter7 => null; /// 07: continued
+ double get getter8 => null; /// 08: continued
+ double get getter9 => null; /// 09: continued
+
+ set setter1(_) => null; /// 21: continued
+ set setter2(_) => null; /// 22: continued
+ void set setter3(_) {} /// 23: continued
+ void set setter4(_) {} /// 24: continued
+ set setter5(num _) => null; /// 25: continued
+ set setter6(int _) => null; /// 26: continued
+ set setter7(num _) => null; /// 27: continued
+ set setter8(double _) => null; /// 28: continued
+ set setter9(double _) => null; /// 29: continued
+ set setter10(double _) => null; /// 30: continued
+ set setter11(double _) => null; /// 31: continued
+ set setter12(double _) => null; /// 32: continued
+
+ int field1; /// 41: continued
+ int field2; /// 42: continued
+ num field3; /// 43: continued
+ double field4; /// 44: continued
+ double field5; /// 45: continued
+ int get field6 => null; /// 46: continued
+ String get field7 => null; /// 47: continued
+ String field8; /// 48: continued
+ set field9(int _) {} /// 49: continued
+ void set field10(int _) {} /// 50: continued
+ num field11; /// 51: continued
+ num field12; /// 52: continued
+ set field13(String _) {} /// 53: continued
+ String field14; /// 54: continued
+}
+
+class SubClass extends Class {
+ double get getter10 => null; /// 10: continued
+ String get getter11 => null; /// 11: continued
+ set setter13(double _) => null; /// 33: continued
+ set setter13(double _) => null; /// 33a: continued
+ set setter14(String _) => null; /// 34: continued
+}
+
+main() {
+ new SubClass();
+}
diff --git a/tests/language/override_inheritance_generic_test.dart b/tests/language/override_inheritance_generic_test.dart
new file mode 100644
index 0000000..bf6ae37
--- /dev/null
+++ b/tests/language/override_inheritance_generic_test.dart
@@ -0,0 +1,72 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A<T> {
+ method1(T t) => null; /// 01: ok
+ method2(T t) => null; /// 02: ok
+ method4(T t) => null; /// 04: static type warning
+ method5(T t) => null; /// 05: ok
+ method7(T t) => null; /// 07: static type warning
+}
+
+class B<S> extends A
+<S> /// 01: continued
+<num> /// 02: continued
+<S> /// 04: continued
+<S> /// 05: continued
+{
+ method1(S s) => null; /// 01: continued
+ method2(int i) => null; /// 02: continued
+ method3(S s) => null; /// 03: ok
+ method4(int i) => null; /// 04: continued
+ method6(S s) => null; /// 06: static type warning
+}
+
+abstract class I<U> {
+ method3(U u) => null; /// 03: continued
+ method6(U u) => null; /// 06: continued
+ method7(U u) => null; /// 07: continued
+ method8(U u) => null; /// 08: static type warning
+ method9(U u) => null; /// 09: static type warning
+ method10(U u) => null; /// 10: static type warning
+}
+
+abstract class J<V> {
+ method8(V v) => null; /// 08: continued
+ method9(V v) => null; /// 09: continued
+ method10(V v) => null; /// 10: continued
+}
+
+abstract class Class<W> extends B
+<double> /// 03: continued
+<W> /// 05: continued
+<W> /// 06: continued
+<int> /// 07: continued
+implements I
+<int> /// 03: continued
+<num> /// 06: continued
+<String> /// 07: continued
+<int> /// 08: continued
+<int> /// 09: continued
+<int> /// 10: continued
+, J
+<String> /// 08: continued
+<num> /// 09: continued
+<num> /// 10: continued
+{
+ method3(num i) => null; /// 03: continued
+ method5(W w) => null; /// 05: continued
+ method6(int i) => null; /// 06: continued
+ method7(double d) => null; /// 07: continued
+ method8(double d) => null; /// 08: continued
+}
+
+class SubClass extends Class {
+ method9(double d) => null; /// 09: continued
+ method10(String s) => null; /// 10: continued
+}
+
+main() {
+ new SubClass();
+}
diff --git a/tests/language/override_inheritance_method_test.dart b/tests/language/override_inheritance_method_test.dart
new file mode 100644
index 0000000..ea699b5
--- /dev/null
+++ b/tests/language/override_inheritance_method_test.dart
@@ -0,0 +1,100 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test static warnings for method overrides.
+
+class A {
+ method1() => null; /// 01: ok
+ method2(a) => null; /// 02: ok
+ method3(a, b, c, d) => null; /// 03: ok
+ method4() => null; /// 04: static type warning
+ method6(a, b, c) => null; /// 06: static type warning
+ method7([a]) => null; /// 07: ok
+ method8([a, b]) => null; /// 08: ok
+ method9([a, b, c]) => null; /// 09: ok
+ method10([a]) => null; /// 10: ok
+ method11(a) => null; /// 11: static type warning
+ method12(a, [b]) => null; /// 12: static type warning
+ method13(a, [b]) => null; /// 13: static type warning
+ method14(a, b, [c, d, e]) => null; /// 14: static type warning
+ method15({a}) => null; /// 15: ok
+ method16({a, b}) => null; /// 16: ok
+ method17({a, b, c}) => null; /// 17: ok
+ method18(d, {a, b, c}) => null; /// 18: ok
+ method19({a}) => null; /// 19: static type warning
+ method20({a, b}) => null; /// 20: static type warning
+ method21({a, b, c, d}) => null; /// 21: static type warning
+
+ method22(int a) => null; /// 22: ok
+ method23(int a) => null; /// 23: ok
+ void method24() {} /// 24: ok
+ method25() => null; /// 25: ok
+ void method26() {} /// 26: ok
+ int method27() => null; /// 27: static type warning
+ method28(int a) => null; /// 28: ok
+ method29(int a) => null; /// 29: ok
+ method30(int a) => null; /// 30: static type warning
+}
+
+class B extends A {
+ method28(num a) => null; /// 28: continued
+ method29(a) => null; /// 29: continued
+}
+
+abstract class I {
+ method5() => null; /// 05: static type warning
+ method31(int a) => null; /// 31: static type warning
+ method32(int a) => null; /// 32: static type warning
+ method33(num a) => null; /// 33: static type warning
+}
+
+abstract class J {
+ method31(num a) => null; /// 31: continued
+ method32(double a) => null; /// 32: continued
+ method33(int a) => null; /// 33: continued
+}
+
+class Class extends B implements I, J {
+ method1() => null; /// 01: continued
+ method2(b) => null; /// 02: continued
+ method3(b, a, d, c) => null; /// 03: continued
+ method4(a) => null; /// 04: continued
+ method5(a) => null; /// 05: continued
+ method6(a, b, c, d) => null; /// 06: continued
+ method7([a]) => null; /// 07: continued
+ method8([b, a]) => null; /// 08: continued
+ method9([b, d, a, c]) => null; /// 09: continued
+ method10([a]) => null; /// 10: continued
+ method11() => null; /// 11: continued
+ method12(a) => null; /// 12: continued
+ method13([a]) => null; /// 13: continued
+ method14([a, b, c, d]) => null; /// 14: continued
+ method15({a}) => null; /// 15: continued
+ method16({b, a}) => null; /// 16: continued
+ method17({b, c, a, d}) => null; /// 17: continued
+ method18(e, {b, c, a, d}) => null; /// 18: continued
+ method19() => null; /// 19: continued
+ method20({b}) => null; /// 20: continued
+ method21({a, e, d, c}) => null; /// 21: continued
+
+ method22(int a) => null; /// 22: continued
+ method23(num a) => null; /// 23: continued
+ method24() => null; /// 24: continued
+ void method25() {} /// 25: continued
+ int method26() => null; /// 26: continued
+ void method27() {} /// 27: continued
+ method28(double a) => null; /// 28: continued
+ method29(String a) => null; /// 29: continued
+ method30(String a) => null; /// 30: continued
+}
+
+class SubClass extends Class {
+ method31(double a) => null; /// 31: continued
+ method32(String a) => null; /// 32: continued
+ method33(double a) => null; /// 33: continued
+}
+
+main() {
+ new SubClass();
+}
diff --git a/tests/language/override_inheritance_mixed_test.dart b/tests/language/override_inheritance_mixed_test.dart
new file mode 100644
index 0000000..08f8f34
--- /dev/null
+++ b/tests/language/override_inheritance_mixed_test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A {
+ var member1; /// 01: compile-time error
+ member2() {} /// 02: compile-time error
+ get member3 => null; /// 03: compile-time error
+ member4() {} /// 04: compile-time error
+}
+
+abstract class I {
+ var member5; /// 05: ok
+ var member6; /// 06: static type warning
+ get member7; /// 07: static type warning
+ get member8; /// 08: compile-time error
+ get member9; /// 09: compile-time error
+}
+
+abstract class J {
+ get member5; /// 05: continued
+ member6() {} /// 06: continued
+ member7() {} /// 07: continued
+ member8() {} /// 08: continued
+ member9() {} /// 09: continued
+}
+
+abstract class B extends A implements I, J {
+}
+
+class Class extends B {
+ member1() {} /// 01: continued
+ var member2; /// 02: continued
+ member3() {} /// 03: continued
+ get member4 => null; /// 04: continued
+ var member5; /// 05: continued
+ member8() {} /// 08: continued
+ get member9 => null; /// 09: continued
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override_inheritance_no_such_method_test.dart b/tests/language/override_inheritance_no_such_method_test.dart
new file mode 100644
index 0000000..45be62e
--- /dev/null
+++ b/tests/language/override_inheritance_no_such_method_test.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test use of @proxy and noSuchMethod in relation to abstract methods in
+// concrete classes.
+
+abstract class A {
+ method6(); /// 06: static type warning
+ method7(); /// 07: static type warning
+ method8(); /// 08: ok
+}
+
+abstract class I {
+ method9(); /// 09: static type warning
+ method10(); /// 10: static type warning
+ method11(); /// 11: ok
+}
+
+@proxy /// 02: static type warning
+@proxy /// 07: continued
+@proxy /// 10: continued
+class Class1 extends A implements I {
+ method1(); /// 01: static type warning
+
+ method2(); /// 02: continued
+
+ noSuchMethod(_) => null; /// 03: ok
+ method3(); /// 03: continued
+
+ noSuchMethod(_, [__]) => null; /// 04: ok
+ method4(); /// 04: continued
+
+ noSuchMethod(_); /// 05: ok
+ method5(); /// 05: continued
+
+ noSuchMethod(_) => null; /// 08: continued
+
+ noSuchMethod(_) => null; /// 11: continued
+}
+
+@proxy /// 12: static type warning
+class B {
+ method12(); /// 12: continued
+
+ noSuchMethod(_) => null; /// 13: static type warning
+ method13(); /// 13: continued
+}
+
+class Class2 extends B {
+}
+
+main() {
+ new Class1();
+ new Class2();
+}
diff --git a/tests/utils/dummy_compiler_test.dart b/tests/utils/dummy_compiler_test.dart
index 2c3e81c..54742c7 100644
--- a/tests/utils/dummy_compiler_test.dart
+++ b/tests/utils/dummy_compiler_test.dart
@@ -54,24 +54,25 @@
operator==(other) {}
get hashCode => throw 'Interceptor.hashCode not implemented.';
}
-class JSIndexable {
- get length {}
+abstract class JSIndexable {
+ get length;
}
-class JSMutableIndexable {}
-class JSArray<E> implements JSIndexable {
+abstract class JSMutableIndexable {}
+abstract class JSArray<E> implements JSIndexable {
JSArray() {}
factory JSArray.typed(a) => a;
var removeLast;
var add;
}
-class JSMutableArray extends JSArray {}
-class JSFixedArray extends JSMutableArray {}
-class JSExtendableArray extends JSMutableArray {}
+abstract class JSMutableArray extends JSArray {}
+abstract class JSFixedArray extends JSMutableArray {}
+abstract class JSExtendableArray extends JSMutableArray {}
class JSString implements JSIndexable {
var split;
var concat;
operator+(other) {}
var toString;
+ get length => 0;
}
class JSFunction {}
class JSInt {}
diff --git a/tests/utils/recursive_import_test.dart b/tests/utils/recursive_import_test.dart
index 64bfee0..4fa1db2 100644
--- a/tests/utils/recursive_import_test.dart
+++ b/tests/utils/recursive_import_test.dart
@@ -42,7 +42,7 @@
const INTERCEPTORS_LIB = """
library interceptors;
class JSIndexable {
- get length;
+ get length {}
}
class JSMutableIndexable {}
class JSArray {
diff --git a/tools/VERSION b/tools/VERSION
index 580f953..851d6aa 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 2
PATCH 0
PRERELEASE 3
-PRERELEASE_PATCH 0
+PRERELEASE_PATCH 1