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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java

Issue 22871003: Issue 11892. It is compile-time error when unqualified invocation with unresolved identifier. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index 5aca4965c41c0bd65b212cb317f950d591b96a27..90d9546ef77f32041b57643080706315b0c55618 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -132,6 +132,23 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_ambiguousImport_function() throws Exception {
+ Source source = addSource(createSource(//
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "g() { return f(); }"));
+ addSource("/lib1.dart", createSource(//
+ "library lib1;",
+ "f() {}"));
+ addSource("/lib2.dart", createSource(//
+ "library lib2;",
+ "f() {}"));
+ resolve(source);
+ assertErrors(
+ StaticWarningCode.AMBIGUOUS_IMPORT,
+ StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION);
+ }
+
public void test_argumentDefinitionTestNonParameter() throws Exception {
Source source = addSource(createSource(//
"f() {",
@@ -3168,6 +3185,24 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_undefinedFunction() throws Exception {
+ Source source = addSource(createSource(//
+ "void f() {",
+ " g();",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.UNDEFINED_FUNCTION);
+ }
+
+ public void test_undefinedFunction_hasImportPrefix() throws Exception {
+ Source source = addSource(createSource(//
+ "import 'lib.dart' as f;",
+ "main() { return f(); }"));
+ addSource("/lib.dart", "library lib;");
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.UNDEFINED_FUNCTION, HintCode.UNUSED_IMPORT);
+ }
+
public void test_undefinedNamedParameter() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698