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

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

Issue 10837237: Issue 4383. Calling field without setter should generate problem (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use same text for error as for warning Created 8 years, 4 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/language/language.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 7c081704c11bf8c170b32139bd4b75007b65a03b..657d6d7b3961dbed04cd34be7ee9e05d4c07d807 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -3467,6 +3467,45 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
errEx(TypeErrorCode.NO_SUCH_TYPE, 7, 7, 1),
errEx(ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR, 7, 7, 19));
}
+
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=4383
+ */
+ public void test_callFieldWithoutGetter_topLevel() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "set setOnlyField(v) {}",
+ "main() {",
+ " setOnlyField(0);",
+ "}");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(ResolverErrorCode.USE_ASSIGNMENT_ON_SETTER, 4, 3, 12));
+ }
+
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=4383
+ */
+ public void test_callFieldWithoutGetter_member() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " set setOnlyField(v) {}",
+ " foo() {",
+ " setOnlyField(0);",
+ " }",
+ "}",
+ "main() {",
+ " A a = new A();",
+ " a.setOnlyField(0);",
+ "}");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(TypeErrorCode.USE_ASSIGNMENT_ON_SETTER, 5, 5, 12),
+ errEx(TypeErrorCode.USE_ASSIGNMENT_ON_SETTER, 10, 5, 12));
+ }
private static <T extends DartNode> T findNode(
AnalyzeLibraryResult libraryResult,
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698