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

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

Issue 19018005: NEW_WITH_INVALID_TYPE_PARAMETERS is warning (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 07cea17cd14312001ba6fa8e24483adf5232ff66..8f6938c6ab63bed0f5ca7daeb3e23a0ad6e7b48f 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
@@ -1234,6 +1234,39 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_newWithInvalidTypeParameters() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {}",
+ "f() { return new A<A>(); }"));
+ resolve(source);
+ assertErrors(StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS);
+ verify(source);
+ }
+
+ public void test_newWithInvalidTypeParameters_tooFew() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {}",
+ "class C<K, V> {}",
+ "f(p) {",
+ " return new C<A>();",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS);
+ verify(source);
+ }
+
+ public void test_newWithInvalidTypeParameters_tooMany() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {}",
+ "class C<E> {}",
+ "f(p) {",
+ " return new C<A, A>();",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS);
+ verify(source);
+ }
+
public void test_newWithNonType() throws Exception {
Source source = addSource(createSource(//
"var A = 0;",

Powered by Google App Engine
This is Rietveld 408576698