| 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 b3e498d4e88539f60561cb5ace3a37a8c0cea491..e9151c91ecfe007813e26e869075bfd916786595 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| @@ -1498,6 +1498,21 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
|
| "");
|
| assertInferredElementTypeString(libraryResult, "v", "<dynamic>");
|
| }
|
| +
|
| + /**
|
| + * When we can not identify type of assigned value we should keep "Dynamic" as type of variable.
|
| + */
|
| + public void test_typesPropagation_assign_newUnknownType() throws Exception {
|
| + AnalyzeLibraryResult libraryResult = analyzeLibrary(
|
| + "// filler filler filler filler filler filler filler filler filler filler",
|
| + "f() {",
|
| + " var v1 = new Unknown();",
|
| + " var v2 = new Unknown.name();",
|
| + "}",
|
| + "");
|
| + assertInferredElementTypeString(libraryResult, "v1", "<dynamic>");
|
| + assertInferredElementTypeString(libraryResult, "v2", "<dynamic>");
|
| + }
|
|
|
| public void test_typesPropagation_ifIsType() throws Exception {
|
| AnalyzeLibraryResult libraryResult = analyzeLibrary(
|
| @@ -1976,7 +1991,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
|
| @Override
|
| public Void visitIdentifier(DartIdentifier node) {
|
| Element element = node.getElement();
|
| - if (element.getName().equals(name)) {
|
| + if (element != null && element.getName().equals(name)) {
|
| result[0] = element;
|
| }
|
| return super.visitIdentifier(node);
|
|
|