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

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

Issue 18555007: Bug fix in analysis engine, implementation of new error code to prevent type parameters in static m… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 3c820d65d586139f89a5ead7291816d5c80e98d2..73dc398cd37d7fd4177badb78e498d4d42dc6feb 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
@@ -1666,6 +1666,68 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_typeParameterReferencedByStatic_field() throws Exception {
+ Source source = addSource(createSource(//
+ "class A<K> {",
+ " static K k;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC);
+ verify(source);
+ }
+
+ public void test_typeParameterReferencedByStatic_getter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A<K> {",
+ " static K get k => 0;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC);
+ verify(source);
+ }
+
+ public void test_typeParameterReferencedByStatic_methodBodyReference() throws Exception {
+ Source source = addSource(createSource(//
+ "class A<K> {",
+ " static m() {",
+ " K k;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC);
+ verify(source);
+ }
+
+ public void test_typeParameterReferencedByStatic_methodParameter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A<K> {",
+ " static m(K k) {}",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC);
+ verify(source);
+ }
+
+ public void test_typeParameterReferencedByStatic_methodReturn() throws Exception {
+ Source source = addSource(createSource(//
+ "class A<K> {",
+ " static K m() {}",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC);
+ verify(source);
+ }
+
+ public void test_typeParameterReferencedByStatic_setter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A<K> {",
+ " static set s(K k) {}",
+ "}"));
+ resolve(source);
+ assertErrors(StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC);
+ verify(source);
+ }
+
public void test_typeTestNonType() throws Exception {
Source source = addSource(createSource(//
"var A = 0;",

Powered by Google App Engine
This is Rietveld 408576698