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

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

Issue 10556014: Test for 'if (v as T)' and fix to make 'if as' check useful (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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: 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 e87acf5c2a63e4ea911e957d2a48f55b9735c430..21f8ff90411156b2539f7082a8028ad8d78c2c9b 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -1724,6 +1724,19 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
assertInferredElementTypeString(libraryResult, "v2", "<dynamic>");
}
+ public void test_typesPropagation_ifAsType() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "f(var v) {",
+ " if ((v as String).length != 0) {",
+ " var v1 = v;",
+ " }",
+ " var v2 = v;",
+ "}",
+ "");
+ assertInferredElementTypeString(libraryResult, "v1", "String");
+ assertInferredElementTypeString(libraryResult, "v2", "<dynamic>");
+ }
+
public void test_typesPropagation_ifIsType() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"f(var v) {",

Powered by Google App Engine
This is Rietveld 408576698