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

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

Issue 10909011: Issue 4791. Ignore Dynamic (e.g. null) during types intersection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/Types.java ('k') | no next file » | 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 05a1c495b8f9cb0c625750f29423f8b65617a37f..80b3db5a8e8d281a5f0b566a51c8c7ec468c2a57 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -2211,6 +2211,28 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertInferredElementTypeString(testUnit, "a1", "List<String>");
assertInferredElementTypeString(testUnit, "b1", "List<String>");
}
+
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=4791
+ */
+ public void test_typesPropagation_multiAssign_type_null() throws Exception {
+ analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "f() {",
+ " var v = null;",
+ " var v1 = v;",
+ " if (true) {",
+ " v = '';",
+ " var v2 = v;",
+ " }",
+ " var v3 = v;",
+ "}",
+ "");
+ assertInferredElementTypeString(testUnit, "v1", "Dynamic");
+ assertInferredElementTypeString(testUnit, "v2", "String");
+ assertInferredElementTypeString(testUnit, "v3", "String");
+ }
/**
* When we can not identify type of assigned value we should keep "Dynamic" as type of variable.
« no previous file with comments | « compiler/java/com/google/dart/compiler/type/Types.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698