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

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

Issue 15074002: Report StaticTypeWarningCode.AMBIGUOUS_IMPORT when used as type annotation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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/StaticWarningCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
index 7c0c2bbcccd0307bd070b12f8e5c055123e28427..f9346531f5fbe672421b5b3694f79b869b9a30ee 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
@@ -13,6 +13,7 @@
*/
package com.google.dart.engine.resolver;
+import com.google.dart.engine.error.StaticTypeWarningCode;
import com.google.dart.engine.error.StaticWarningCode;
import com.google.dart.engine.source.Source;
@@ -423,6 +424,43 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_ambiguousImport_typeAnnotation() throws Exception {
+ Source source = addSource(createSource(//
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "typedef N FT(N p);",
+ "N f(N p) {",
+ " N v;",
+ "}",
+ "class A {",
+ " N m() {}",
+ "}",
+ "class B<T extends N> {}"));
+ addSource("/lib1.dart", "class N {}");
+ addSource("/lib2.dart", "class N {}");
+ resolve(source);
+ assertErrors(
+ StaticTypeWarningCode.AMBIGUOUS_IMPORT,
+ StaticTypeWarningCode.AMBIGUOUS_IMPORT,
+ StaticTypeWarningCode.AMBIGUOUS_IMPORT,
+ StaticTypeWarningCode.AMBIGUOUS_IMPORT,
+ StaticTypeWarningCode.AMBIGUOUS_IMPORT,
+ StaticTypeWarningCode.AMBIGUOUS_IMPORT,
+ StaticTypeWarningCode.AMBIGUOUS_IMPORT);
+ }
+
+ public void test_ambiguousImport_typeArgument_annotation() throws Exception {
+ Source source = addSource(createSource(//
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "class A<T> {}",
+ "A<N> f() {}"));
+ addSource("/lib1.dart", "class N {}");
+ addSource("/lib2.dart", "class N {}");
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.AMBIGUOUS_IMPORT);
+ }
+
public void test_assignmentToFinal_instanceVariable() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698