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

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

Issue 296193008: Generate proper override warnings when conflicting members are inherited. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 c2ace61d3c5c576eb9338b8903a26a1ad0ba9d95..497e1dfdfb2e742cd3a4e0e2f041e54c8fe598c1 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
@@ -22,60 +22,6 @@ import com.google.dart.engine.parser.ParserErrorCode;
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
@@ -1526,6 +1472,22 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_invalidGetterOverrideReturnType_twoInterfaces_conflicting() throws Exception {
+ 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 test_invalidMethodOverrideNamedParamType() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -1598,6 +1560,24 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_invalidMethodOverrideNormalParamType_twoInterfaces_conflicting()
+ throws Exception {
+ // 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 test_invalidMethodOverrideOptionalParamType() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -1879,6 +1859,23 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_invalidSetterOverrideNormalParamType_twoInterfaces_conflicting()
+ throws Exception {
+ 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 test_listElementTypeNotAssignable() throws Exception {
Source source = addSource(createSource(//
"var v = <String> [42];"));

Powered by Google App Engine
This is Rietveld 408576698