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

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

Issue 11366062: Use union type parts when check if type is subtype. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 b2de6fd1ef57a4995cb7f8568804840a65d48379..3a23360d1214eb4c20e42c4b1882d58bb64f4e50 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -47,9 +47,9 @@ import com.google.dart.compiler.resolver.TypeErrorCode;
import static com.google.dart.compiler.common.ErrorExpectation.assertErrors;
import static com.google.dart.compiler.common.ErrorExpectation.errEx;
+import static com.google.dart.compiler.type.TypeQuality.EXACT;
import static com.google.dart.compiler.type.TypeQuality.INFERRED;
import static com.google.dart.compiler.type.TypeQuality.INFERRED_EXACT;
-import static com.google.dart.compiler.type.TypeQuality.EXACT;
import java.net.URI;
import java.util.List;
@@ -2407,14 +2407,29 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
* When single variable has conflicting type constraints, we use union of types.
*/
public void test_typesPropagation_ifIsType_conflictingTypes() throws Exception {
- analyzeLibrary(
+ compilerConfiguration = new DefaultCompilerConfiguration(new CompilerOptions() {
+ @Override
+ public boolean typeChecksForInferredTypes() {
+ return true;
+ }
+ });
+ AnalyzeLibraryResult result = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"f(int v) {",
" if (v is String) {",
" var v1 = v;",
+ " // should be OK because 'v' is String",
+ " v.abs; // from num",
+ " v.length; // from String",
+ " processInt(v);",
+ " processString(v);",
" }",
"}",
+ "processInt(int p) {}",
+ "processString(String p) {}",
"");
+ // should be no errors, we because "v" is String
+ assertErrors(result.getErrors());
assertInferredElementTypeString(testUnit, "v1", "[int, String]", INFERRED);
}
« 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