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

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

Issue 10533050: Makes method shadowing a getter or setter or vice versa a compile time error. (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 bd95e53a008b1b3690a9b1c2ee6d01f9f1b6a6f2..aa3e90f9ac10287389d8ddd4602034aecf9173f6 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -2061,7 +2061,57 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertNotNull(equalsElement);
}
-
+ public void test_supertypeHasMethod() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {}",
+ "interface I {",
+ " foo();",
+ " bar();",
+ "}",
+ "interface J extends I {",
+ " get foo();",
+ " set bar();",
+ "}");
+ assertErrors(libraryResult.getTypeErrors(),
+ errEx(TypeErrorCode.SUPERTYPE_HAS_METHOD, 8, 7, 3),
+ errEx(TypeErrorCode.SUPERTYPE_HAS_METHOD, 9, 7, 3));
+ }
+
+ public void test_supertypeHasField() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {}",
+ "interface I {",
+ " var foo;",
+ " var bar;",
+ "}",
+ "interface J extends I {",
+ " foo();",
+ " bar();",
+ "}");
+ assertErrors(libraryResult.getTypeErrors(),
+ errEx(TypeErrorCode.SUPERTYPE_HAS_FIELD, 8, 3, 3),
+ errEx(TypeErrorCode.SUPERTYPE_HAS_FIELD, 9, 3, 3));
+ }
+
+ public void test_supertypeHasGetterSetter() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {}",
+ "interface I {",
+ " get foo();",
+ " set bar();",
+ "}",
+ "interface J extends I {",
+ " foo();",
+ " bar();",
+ "}");
+ assertErrors(libraryResult.getTypeErrors(),
+ errEx(TypeErrorCode.SUPERTYPE_HAS_FIELD, 8, 3, 3),
+ errEx(TypeErrorCode.SUPERTYPE_HAS_FIELD, 9, 3, 3));
+ }
+
private AnalyzeLibraryResult analyzeLibrary(String... lines) throws Exception {
return analyzeLibrary(getName(), makeCode(lines));
}

Powered by Google App Engine
This is Rietveld 408576698