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

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

Issue 62683005: Issue 14426. Analyzer must warn when a getter & setter pair are not both static or both instance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 648f037e897ad0a755d6f47fbe2b15a2188b3d8e..bc2446fb0a6caca55cfb3b45ed7e44635a086b38 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
@@ -729,20 +729,22 @@ public class StaticWarningCodeTest extends ResolverTestCase {
assertErrors(source, StaticWarningCode.CONFLICTING_DART_IMPORT);
}
- public void test_conflictingInstanceGetterAndSuperclassMember_direct_field() throws Exception {
+ public void test_conflictingInstanceGetterAndSuperclassMember_declField_direct_setter()
+ throws Exception {
Source source = addSource(createSource(//
"class A {",
- " static int v;",
+ " static set v(x) {}",
"}",
"class B extends A {",
- " get v => 0;",
+ " var v;",
"}"));
resolve(source);
assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER);
verify(source);
}
- public void test_conflictingInstanceGetterAndSuperclassMember_direct_getter() throws Exception {
+ public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_getter()
+ throws Exception {
Source source = addSource(createSource(//
"class A {",
" static get v => 0;",
@@ -755,7 +757,8 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_conflictingInstanceGetterAndSuperclassMember_direct_method() throws Exception {
+ public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_method()
+ throws Exception {
Source source = addSource(createSource(//
"class A {",
" static v() {}",
@@ -768,7 +771,8 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_conflictingInstanceGetterAndSuperclassMember_direct_setter() throws Exception {
+ public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_setter()
+ throws Exception {
Source source = addSource(createSource(//
"class A {",
" static set v(x) {}",
@@ -781,7 +785,8 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_conflictingInstanceGetterAndSuperclassMember_indirect() throws Exception {
+ public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_indirect()
+ throws Exception {
Source source = addSource(createSource(//
"class A {",
" static int v;",
@@ -795,7 +800,7 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_conflictingInstanceGetterAndSuperclassMember_mixin() throws Exception {
+ public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_mixin() throws Exception {
Source source = addSource(createSource(//
"class M {",
" static int v;",
@@ -808,6 +813,19 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_conflictingInstanceGetterAndSuperclassMember_direct_field() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " static int v;",
+ "}",
+ "class B extends A {",
+ " get v => 0;",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER);
+ verify(source);
+ }
+
public void test_conflictingInstanceMethodSetter_sameClass() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698