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

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

Issue 223033002: Fix for 16134- class members modify the set of members that are inherited from superclasses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 d7cf27abc34dfef09257d5371890aaf286b649b8..594ae2a16a258285731d77b0a2a15aa344c444d5 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
@@ -20,6 +20,60 @@ import com.google.dart.engine.error.StaticWarningCode;
import com.google.dart.engine.source.Source;
public class StaticWarningCodeTest extends ResolverTestCase {
+ public void fail_invalidGetterOverrideReturnType_twoInterfaces_conflicting() throws Exception {
+ // 17983
+ Source source = addSource(createSource(//
+ "abstract class I<U> {",
+ " U get g => null;",
+ "}",
+ "abstract class J<V> {",
+ " V get g => null;",
+ "}",
+ "class B implements I<int>, J<String> {",
+ " double get g => null;",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE);
+ verify(source);
+ }
+
+ public void fail_invalidMethodOverrideNormalParamType_twoInterfaces_conflicting()
+ throws Exception {
+ // 17983
+ // language/override_inheritance_generic_test/08
+ Source source = addSource(createSource(//
+ "abstract class I<U> {",
+ " m(U u) => null;",
+ "}",
+ "abstract class J<V> {",
+ " m(V v) => null;",
+ "}",
+ "class B implements I<int>, J<String> {",
+ " m(double d) {}",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE);
+ verify(source);
+ }
+
+ public void fail_invalidSetterOverrideNormalParamType_twoInterfaces_conflicting()
+ throws Exception {
+ // 17983
+ Source source = addSource(createSource(//
+ "abstract class I<U> {",
+ " set s(U u) {}",
+ "}",
+ "abstract class J<V> {",
+ " set s(V v) {}",
+ "}",
+ "class B implements I<int>, J<String> {",
+ " set s(double d) {}",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE);
+ verify(source);
+ }
+
public void fail_undefinedGetter() throws Exception {
Source source = addSource(createSource(//
// TODO
@@ -1398,7 +1452,7 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
- public void test_invalidMethodOverrideNormalParamType() throws Exception {
+ public void test_invalidMethodOverrideNormalParamType_interface() throws Exception {
Source source = addSource(createSource(//
"class A {",
" m(int a) {}",
@@ -1411,6 +1465,35 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_invalidMethodOverrideNormalParamType_superclass() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " m(int a) {}",
+ "}",
+ "class B extends A {",
+ " m(String a) {}",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE);
+ verify(source);
+ }
+
+ public void test_invalidMethodOverrideNormalParamType_superclass_interface() throws Exception {
+ Source source = addSource(createSource(//
+ "abstract class I<U> {",
+ " m(U u) => null;",
+ "}",
+ "abstract class J<V> {",
+ " m(V v) => null;",
+ "}",
+ "class B extends I<int> implements J<String> {",
+ " m(double d) {}",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE);
+ verify(source);
+ }
+
public void test_invalidMethodOverrideNormalParamType_twoInterfaces() throws Exception {
Source source = addSource(createSource(//
"abstract class I {",
@@ -1674,6 +1757,23 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_invalidSetterOverrideNormalParamType_superclass_interface() throws Exception {
+ Source source = addSource(createSource(//
+ "abstract class I {",
+ " set setter14(int _) => null;",
+ "}",
+ "abstract class J {",
+ " set setter14(num _) => null;",
+ "}",
+ "abstract class A extends I implements J {}",
+ "class B extends A {",
+ " set setter14(String _) => null;",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE);
+ verify(source);
+ }
+
public void test_invalidSetterOverrideNormalParamType_twoInterfaces() throws Exception {
// test from language/override_inheritance_field_test_34.dart
Source source = addSource(createSource(//

Powered by Google App Engine
This is Rietveld 408576698