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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java

Issue 9979004: Show an error if a field has no getter defined in a getter context (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated feedback. Created 8 years, 9 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
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
index 399d98b6d38754f13f3a9dc993bdf41780e1ccee..eaff06a965190977c4a1db74d271bd1aa8f19bcb 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
@@ -1133,4 +1133,35 @@ public class ResolverTest extends ResolverTestCase {
errEx(ResolverErrorCode.STATIC_FINAL_REQUIRES_VALUE, 9, 16, 2),
errEx(ResolverErrorCode.CONSTANTS_MUST_BE_INITIALIZED, 12, 11, 2));
}
+
+ public void testNoGetterOrSetter() {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "get getter1() {}",
+ "set setter1(arg) {}",
+ "class A {",
+ " static get getter2() {}",
+ " static set setter2(arg) {}",
+ " get getter3() {}",
+ " set setter3(arg) {}",
+ "}",
+ "method() {",
+ " var result;",
+ " result = getter1;",
+ " getter1 = 1;",
+ " result = setter1;",
+ " setter1 = 1;",
+ " result = A.getter2;",
+ " A.getter2 = 1;",
+ " result = A.setter2;",
+ " A.setter2 = 1;",
+ " var instance = new A();",
+ " result = instance.getter3;",
+ " instance.getter3 = 1;",
+ " result = instance.setter3;",
+ " instance.setter3 = 1;",
+ "}"),
+ errEx(ResolverErrorCode.FIELD_DOES_NOT_HAVE_A_SETTER, 17, 5, 7),
+ errEx(ResolverErrorCode.FIELD_DOES_NOT_HAVE_A_GETTER, 18, 14, 7));
+ }
}
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698