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

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

Issue 47923014: Issue 14364. Strengthen isDirectSupertypeOf() to check type parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 0b599b906effd4f7aaf5c8a39b6b1a482407ab41..1c961ef05f87b94b034da4b99aa77118178cc6b8 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
@@ -806,6 +806,41 @@ public class StaticTypeWarningCodeTest extends ResolverTestCase {
assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
}
+ public void test_typePromotion_if_extends_notMoreSpecific_dynamic() throws Exception {
+ Source source = addSource(createSource(//
+ "class V {}",
+ "class A<T> {}",
+ "class B<S> extends A<S> {",
+ " var b;",
+ "}",
+ "",
+ "main(A<V> p) {",
+ " if (p is B) {",
+ " p.b;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
+ public void test_typePromotion_if_extends_notMoreSpecific_notMoreSpecificTypeArg()
+ throws Exception {
+ Source source = addSource(createSource(//
+ "class V {}",
+ "class A<T> {}",
+ "class B<S> extends A<S> {",
+ " var b;",
+ "}",
+ "",
+ "main(A<V> p) {",
+ " if (p is B<int>) {",
+ " p.b;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
public void test_typePromotion_if_hasAssignment_after() throws Exception {
Source source = addSource(createSource(//
"main(Object p) {",
@@ -878,6 +913,40 @@ public class StaticTypeWarningCodeTest extends ResolverTestCase {
assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
}
+ public void test_typePromotion_if_implements_notMoreSpecific_dynamic() throws Exception {
+ Source source = addSource(createSource(//
+ "class V {}",
+ "class A<T> {}",
+ "class B<S> implements A<S> {",
+ " var b;",
+ "}",
+ "",
+ "main(A<V> p) {",
+ " if (p is B) {",
+ " p.b;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
+ public void test_typePromotion_if_with_notMoreSpecific_dynamic() throws Exception {
+ Source source = addSource(createSource(//
+ "class V {}",
+ "class A<T> {}",
+ "class B<S> extends Object with A<S> {",
+ " var b;",
+ "}",
+ "",
+ "main(A<V> p) {",
+ " if (p is B) {",
+ " p.b;",
+ " }",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticTypeWarningCode.UNDEFINED_GETTER);
+ }
+
public void test_undefinedGetter() throws Exception {
Source source = addSource(createSource(//
"class T {}",

Powered by Google App Engine
This is Rietveld 408576698