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

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

Issue 10889009: Issue 4764. Rollback List/Map literals type inference (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 fff16b053e70753197c7d1f3bce33816b5bd4d03..1cae5a0c7edfc5adf1cc485d421f750dd336c20b 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -21,7 +21,6 @@ import com.google.dart.compiler.DefaultCompilerConfiguration;
import com.google.dart.compiler.MockArtifactProvider;
import com.google.dart.compiler.MockLibrarySource;
import com.google.dart.compiler.ast.ASTVisitor;
-import com.google.dart.compiler.ast.DartArrayLiteral;
import com.google.dart.compiler.ast.DartClass;
import com.google.dart.compiler.ast.DartDeclaration;
import com.google.dart.compiler.ast.DartExprStmt;
@@ -2777,98 +2776,6 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
}
}
- /**
- * We can not guarantee type of non-const literal.
- */
- public void test_typesPropagation_arrayLiteral_notConst() throws Exception {
- final AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "// filler filler filler filler filler filler filler filler filler filler",
- "main() {",
- " var a = [1, 2, 3];",
- "}",
- "");
- assertErrors(libraryResult.getErrors());
- assertNodeNotInferredTypeString("[1, 2, 3]", "List<Dynamic>");
- }
-
- public void test_typesPropagation_arrayLiteralConst_singleType() throws Exception {
- final AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "// filler filler filler filler filler filler filler filler filler filler",
- "main() {",
- " var a = const [1, 2, 3];",
- " var v = a[0];",
- "}",
- "");
- assertErrors(libraryResult.getErrors());
- assertInferredElementTypeString(testUnit, "v", "int");
- assertNodeInferredTypeString("[1, 2, 3]", "List<int>");
- }
-
- public void test_typesPropagation_arrayLiteralConst_mixedTypes() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "// filler filler filler filler filler filler filler filler filler filler",
- "main() {",
- " var a = const [1, 2, '3'];",
- " var v = a[0];",
- "}",
- "");
- assertErrors(libraryResult.getErrors());
- assertInferredElementTypeString(testUnit, "v", "[Comparable, Hashable]");
- }
-
- /**
- * We can not guarantee type of non-const literal.
- */
- public void test_typesPropagation_mapLiteral_notConst() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "// filler filler filler filler filler filler filler filler filler filler",
- "main() {",
- " var m = {'1': 1, '2' : 2, '3' : 3};",
- "}",
- "");
- assertErrors(libraryResult.getErrors());
- assertNodeNotInferredTypeString("{'1': 1, ", "Map<String, Dynamic>");
- }
-
- public void test_typesPropagation_mapLiteralConst_singleType() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "// filler filler filler filler filler filler filler filler filler filler",
- "main() {",
- " var m = const {'1': 1, '2' : 2, '3' : 3};",
- " var v = m['1'];",
- "}",
- "");
- assertErrors(libraryResult.getErrors());
- assertInferredElementTypeString(testUnit, "v", "int");
- assertNodeInferredTypeString("{'1': 1, ", "Map<String, int>");
- }
-
- public void test_typesPropagation_mapLiteralConst_mixedTypes() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "// filler filler filler filler filler filler filler filler filler filler",
- "main() {",
- " var m = const {'1': 1, '2' : 2, '3' : 3.0};",
- " var v = m['1'];",
- "}",
- "");
- assertErrors(libraryResult.getErrors());
- assertInferredElementTypeString(testUnit, "v", "num");
- }
-
- private void assertNodeInferredTypeString(String pattern, String expectedType) {
- DartNode node = findNode(DartNode.class, pattern);
- Type actualType = node.getType();
- assertEquals(expectedType, getTypeSource(actualType));
- assertTrue(actualType.isInferred());
- }
-
- private void assertNodeNotInferredTypeString(String pattern, String expectedType) {
- DartNode node = findNode(DartNode.class, pattern);
- Type actualType = node.getType();
- assertEquals(expectedType, getTypeSource(actualType));
- assertFalse(actualType.isInferred());
- }
-
public void test_getType_binaryExpression() throws Exception {
analyzeLibrary(
"f(var arg) {",

Powered by Google App Engine
This is Rietveld 408576698