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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java

Issue 49383003: Issue 14358. Check for assignment in any close. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
index 7f4c70bc3ac80c3cc7966e50054fffb4adb1f887..0b599b906effd4f7aaf5c8a39b6b1a482407ab41 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
@@ -830,6 +830,54 @@ public class StaticTypeWarningCodeTest extends ResolverTestCase {
assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
}
+ public void test_typePromotion_if_hasAssignment_inClosure_anonymous_after() throws Exception {
+ Source source = addSource(createSource(//
+ "main(Object p) {",
+ " if (p is String) {",
+ " p.length;",
+ " }",
+ " () {p = 0;};",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
+ public void test_typePromotion_if_hasAssignment_inClosure_anonymous_before() throws Exception {
+ Source source = addSource(createSource(//
+ "main(Object p) {",
+ " () {p = 0;};",
+ " if (p is String) {",
+ " p.length;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
+ public void test_typePromotion_if_hasAssignment_inClosure_function_after() throws Exception {
+ Source source = addSource(createSource(//
+ "main(Object p) {",
+ " if (p is String) {",
+ " p.length;",
+ " }",
+ " f() {p = 0;};",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
+ public void test_typePromotion_if_hasAssignment_inClosure_function_before() throws Exception {
+ Source source = addSource(createSource(//
+ "main(Object p) {",
+ " f() {p = 0;};",
+ " if (p is String) {",
+ " p.length;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
public void test_undefinedGetter() throws Exception {
Source source = addSource(createSource(//
"class T {}",

Powered by Google App Engine
This is Rietveld 408576698