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

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

Issue 22710009: Report INSTANCE_ACCESS_TO_STATIC_MEMBER. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments 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/StaticTypeWarningCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
index 9173481a3487e7e02b994f33232fd6ba8547794a..31f81e4d3e9a3e48ec521a8aa1d4d7c4008c32e8 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
@@ -83,6 +83,71 @@ public class StaticTypeWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_instanceAccessToStaticMember_method_invocation() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static m() {}",
+ "}",
+ "main(A a) {",
+ " a.m();",
+ "}"));
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER);
+ verify(source);
+ }
+
+ public void test_instanceAccessToStaticMember_method_reference() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static m() {}",
+ "}",
+ "main(A a) {",
+ " a.m;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER);
+ verify(source);
+ }
+
+ public void test_instanceAccessToStaticMember_propertyAccess_field() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static var f;",
+ "}",
+ "main(A a) {",
+ " a.f;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER);
+ verify(source);
+ }
+
+ public void test_instanceAccessToStaticMember_propertyAccess_getter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static get f => 42;",
+ "}",
+ "main(A a) {",
+ " a.f;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER);
+ verify(source);
+ }
+
+ public void test_instanceAccessToStaticMember_propertyAccess_setter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static set f(x) {}",
+ "}",
+ "main(A a) {",
+ " a.f = 42;",
+ "}"));
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER);
+ verify(source);
+ }
+
public void test_invalidAssignment_compoundAssignment() throws Exception {
Source source = addSource(createSource(//
"class byte {",

Powered by Google App Engine
This is Rietveld 408576698