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

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

Issue 10827339: Issue 4460. Mark inferred type variable in for-in loop as inferred (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
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 df788a45f6b1887354abf3b6a378dd13c5ef5205..254863ed560f475acc12c1d5c9873c02367ee6f5 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -1803,6 +1803,32 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
}
}
+ /**
+ * There was bug that for-in loop did not mark type of variable as inferred, so we produced
+ * warnings even when this is disabled.
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=4460
+ */
+ public void test_inferredTypes_noMemberWarnings_forInLoop() throws Exception {
+ compilerConfiguration = new DefaultCompilerConfiguration(new CompilerOptions() {
+ @Override
+ public boolean memberWarningForInferredTypes() {
+ return false;
+ }
+ });
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {}",
+ "foo() {",
+ " List<A> values;",
+ " for (var v in values) {",
+ " v.bar();",
+ " }",
+ "}",
+ "");
+ assertErrors(result.getErrors());
+ }
+
public void test_typesPropagation_assignAtDeclaration() throws Exception {
analyzeLibrary(
"f() {",

Powered by Google App Engine
This is Rietveld 408576698