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

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

Issue 10966047: Issue 5295. Reference to undefined static setter should be a warning not an error (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/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 98ae0054ae7047136d42a5cd5db3a5f34967ca65..fe4f1acec6fc0b3b519e90ba1614e317925bde65 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -5033,7 +5033,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertClassMembers(superElements, "field A.foo");
}
}
-
+
public void test_getOverridden_getterSetter_withField() throws Exception {
analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -5067,6 +5067,56 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertTrue(superNames.toString(), superNames.isEmpty());
}
+ public void test_fieldAccess_declared_noGetter() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " static set f(x) {}",
+ "}",
+ "main() {",
+ " print(A.f);",
+ "}",
+ "");
+ assertErrors(result.getErrors(), errEx(ResolverErrorCode.FIELD_DOES_NOT_HAVE_A_GETTER, 6, 11, 1));
+ }
+
+ public void test_fieldAccess_notDeclared() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ "}",
+ "main() {",
+ " print(A.f);",
+ "}",
+ "");
+ assertErrors(result.getErrors(), errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 5, 11, 1));
+ }
+
+ public void test_fieldAssign_declared_noSetter() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " static get f() => 0;",
+ "}",
+ "main() {",
+ " A.f = 0;",
+ "}",
+ "");
+ assertErrors(result.getErrors(), errEx(ResolverErrorCode.FIELD_DOES_NOT_HAVE_A_SETTER, 6, 5, 1));
+ }
+
+ public void test_fieldAssign_notDeclared() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ "}",
+ "main() {",
+ " A.f = 0;",
+ "}",
+ "");
+ assertErrors(result.getErrors(), errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 5, 5, 1));
+ }
+
private <T extends DartNode> T findNode(final Class<T> clazz, String pattern) {
final int index = testSource.indexOf(pattern);
assertTrue(index != -1);
« 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