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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 10627017: Removes compile-time error from implementing the same interface more than once (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index 54df7cd30a14b6471a072d2af4eccdab8e3d75a6..5efda4d0ce62ad7b864332de7ad93c04014d9490 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -1204,7 +1204,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
errEx(ResolverErrorCode.CANNOT_ASSIGN_TO_FINAL, 11, 3, 1),
errEx(TypeErrorCode.FIELD_IS_FINAL, 13, 5, 1));
}
-
+
/**
* It is a compile-time error to use type variables in "const" instance creation.
* <p>
@@ -2690,7 +2690,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
libraryResult.getErrors(),
errEx(TypeErrorCode.NO_SUCH_TYPE, 3, 11, 1));
}
-
+
/**
* It is a compile-time error if T is a parameterized type of the form G < T1; : : : ; Tn > and G
* is not a generic type with n type parameters.
@@ -2709,7 +2709,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
libraryResult.getErrors(),
errEx(ResolverErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 4, 11, 12));
}
-
+
/**
* It is a static warning if T does not denote a type available in the current lexical scope.
* <p>
@@ -2727,6 +2727,38 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
errEx(TypeErrorCode.NO_SUCH_TYPE, 3, 11, 1));
}
+ public void test_incompatibleTypesInHierarchy1() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "interface Interface<T> {",
+ " T m();",
+ "}",
+ "abstract class A implements Interface {",
+ "}",
+ "class C extends A implements Interface<int> {",
+ " int m() => 0;",
+ "}");
+ assertErrors(
+ libraryResult.getErrors());
+ }
+
+ public void test_incompatibleTypesInHierarchy2() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "interface Interface<T> {",
+ " T m();",
+ "}",
+ "abstract class A implements Interface<String> {",
+ "}",
+ "class C extends A implements Interface<int> {",
+ " int m() => 0;",
+ "}");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(TypeErrorCode.CANNOT_OVERRIDE_METHOD_NOT_SUBTYPE, 8, 7, 1),
+ errEx(TypeErrorCode.INCOMPATIBLE_TYPES_IN_HIERARCHY, 7, 7, 1));
+ }
+
private static <T extends DartNode> T findNode(
AnalyzeLibraryResult libraryResult,
final Class<T> clazz,

Powered by Google App Engine
This is Rietveld 408576698