Index: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java |
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java |
index 8407959cf98d8814ff58d122fc42aacbb4776cff..246f51726410afe0adab9ecc736af09bf2d3fabd 100644 |
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java |
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java |
@@ -3031,6 +3031,52 @@ public class NonErrorResolverTest extends ResolverTestCase { |
verify(source); |
} |
+ public void test_typePromotion_functionType_arg_ignoreIfNotMoreSpecific() throws Exception { |
+ Source source = addSource(createSource(// |
+ "typedef FuncB(B b);", |
+ "typedef FuncA(A a);", |
+ "class A {}", |
+ "class B {}", |
+ "main(FuncA f) {", |
+ " if (f is FuncB) {", |
+ " f(new A());", |
+ " }", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
+ public void test_typePromotion_functionType_return_ignoreIfNotMoreSpecific() throws Exception { |
+ Source source = addSource(createSource(// |
+ "typedef FuncDynToDyn(x);", |
+ "typedef void FuncDynToVoid(x);", |
+ "class A {}", |
+ "main(FuncDynToDyn f) {", |
+ " if (f is FuncDynToVoid) {", |
+ " A a = f(null);", |
+ " }", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
+ public void test_typePromotion_functionType_return_voidToDynamic() throws Exception { |
+ Source source = addSource(createSource(// |
+ "typedef FuncDynToDyn(x);", |
+ "typedef void FuncDynToVoid(x);", |
+ "class A {}", |
+ "main(FuncDynToVoid f) {", |
+ " if (f is FuncDynToDyn) {", |
+ " A a = f(null);", |
+ " }", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
public void test_typePromotion_if_accessedInClosure_noAssignment() throws Exception { |
Source source = addSource(createSource(// |
"callMe(f()) { f(); }", |
@@ -3098,6 +3144,25 @@ public class NonErrorResolverTest extends ResolverTestCase { |
verify(source); |
} |
+ public void test_typePromotion_if_is_and_subThenSuper() throws Exception { |
+ Source source = addSource(createSource(// |
+ "class A {", |
+ " var a;", |
+ "}", |
+ "class B extends A {", |
+ " var b;", |
+ "}", |
+ "main(Object p) {", |
+ " if (p is B && p is A) {", |
+ " p.a;", |
+ " p.b;", |
+ " }", |
+ "}")); |
+ resolve(source); |
+ assertNoErrors(source); |
+ verify(source); |
+ } |
+ |
public void test_typePromotion_if_is_parenthesized() throws Exception { |
Source source = addSource(createSource(// |
"main(Object p) {", |