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 cf8a7f420f41b19fe9c05ec7f6c3efcc766268bb..55fc81cef88642b9e423c35c5d64a4e1b7e51bb9 100644 |
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java |
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java |
@@ -582,6 +582,22 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase { |
} |
/** |
+ * When we attempt to use function as type, we should report only one error. |
+ * <p> |
+ * http://code.google.com/p/dart/issues/detail?id=3309 |
+ */ |
+ public void test_useFunctionAsType() throws Exception { |
+ AnalyzeLibraryResult libraryResult = analyzeLibrary( |
+ "// filler filler filler filler filler filler filler filler filler filler", |
+ "func() {}", |
+ "main() {", |
+ " new func();", |
+ "}", |
+ ""); |
+ assertErrors(libraryResult.getErrors(), errEx(ResolverErrorCode.NOT_A_TYPE, 4, 7, 4)); |
+ } |
+ |
+ /** |
* There was problem that {@link DartForInStatement} visits "iterable" two times. At first time we |
* set {@link MethodElement}, because we resolve it to getter. However because of this at second |
* time we can not resolve. Solution - don't try to resolve second time, we already done at first |