diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java b/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java index bc788f8491e..4d596020f54 100644 --- a/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java +++ b/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java @@ -197,6 +197,7 @@ public enum ResolverErrorCode implements ErrorCode { RETHROW_NOT_IN_CATCH("Re-throw not in a catch block"), STATIC_FINAL_REQUIRES_VALUE("Static final fields must have an initial value"), STATIC_METHOD_MUST_HAVE_BODY("Static method must have a body"), + SUPER_CLASS_IN_IMPLEMENTS("Superclass in implements clause"), SUPER_IN_FACTORY_CONSTRUCTOR("Cannot use 'super' in a factory constructor"), SUPER_IN_STATIC_METHOD("Cannot use 'super' in a static method"), SUPER_OUTSIDE_OF_METHOD("Cannot use 'super' outside of a method"), diff --git a/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java b/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java index 0aef7bcb7de..6e1b911ecd3 100644 --- a/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java +++ b/compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java @@ -4,6 +4,7 @@ package com.google.dart.compiler.resolver; +import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.google.dart.compiler.DartCompilerContext; @@ -111,6 +112,10 @@ public class SupertypeResolver { topLevelContext.onError(intNode, ResolverErrorCode.DUPLICATE_IMPLEMENTS_TYPE); continue; } + if (Objects.equal(intType, supertype)) { + topLevelContext.onError(intNode, ResolverErrorCode.SUPER_CLASS_IN_IMPLEMENTS); + continue; + } seenImplement.add(intType); } // OK, add diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java index 31bb3ca8236..3f278a5d1b0 100644 --- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java +++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java @@ -5332,6 +5332,20 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase { assertErrors(result.getErrors(), errEx(ResolverErrorCode.DUPLICATE_IMPLEMENTS_TYPE, 3, 23, 1)); } + /** + * It is a compile-time error if the superclass of a class C appears in the implements clause of C. + *
+ * http://code.google.com/p/dart/issues/detail?id=7469 + */ + public void test_superClass_imImplementsClause() throws Exception { + AnalyzeLibraryResult result = analyzeLibrary( + "// filler filler filler filler filler filler filler filler filler filler", + "class A {}", + "class B extends A implements A {}", + ""); + assertErrors(result.getErrors(), errEx(ResolverErrorCode.SUPER_CLASS_IN_IMPLEMENTS, 3, 30, 1)); + } + /** * We should report only "no such type", but not duplicate. *
diff --git a/tests/language/language.status b/tests/language/language.status index a2c4a8d12ab..4599194534e 100644 --- a/tests/language/language.status +++ b/tests/language/language.status @@ -87,7 +87,6 @@ compile_time_constant_checked3_test/06: Fail, OK default_factory2_test/01: Fail # Issue 7075. [ $compiler == dartc ] -class_cycle_test/03: Fail # Issue 7469. library_juxtaposition_test: Fail # Issue 6881 new_expression_type_args_test/0*: Fail # Wrongly reports compile-time error. redirecting_factory_infinite_steps_test/01: Fail # http://dartbug.com/6560