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

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

Issue 10829288: Issue 3800. Calling an undefined constructor via new is a warning, not an error (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 75cb4798a4fa4ad89d60f9be75005c2cbd4a57df..600bdf35431580125fa6f113cd4bde8d8601a036 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -727,7 +727,7 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
" new func();",
"}",
"");
- assertErrors(libraryResult.getErrors(), errEx(ResolverErrorCode.NOT_A_TYPE, 4, 7, 4));
+ assertErrors(libraryResult.getErrors(), errEx(TypeErrorCode.NOT_A_TYPE, 4, 7, 4));
}
/**
@@ -3414,6 +3414,29 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 4, 3, 7),
errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 5, 11, 7));
}
+
+ /**
+ * Unresolved constructor is warning.
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=3800
+ */
+ public void test_unresolvedConstructor() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {}",
+ "main() {",
+ " new A(); // OK",
+ " new A.noSuchConstructor(); // warning",
+ " new B(); // warning",
+ " new B.noSuchConstructor(); // warning",
+ "}"));
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR, 5, 7, 19),
+ errEx(TypeErrorCode.NO_SUCH_TYPE, 6, 7, 1),
+ errEx(TypeErrorCode.NO_SUCH_TYPE, 7, 7, 1),
+ errEx(ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR, 7, 7, 19));
+ }
private static <T extends DartNode> T findNode(
AnalyzeLibraryResult libraryResult,

Powered by Google App Engine
This is Rietveld 408576698