| Index: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/InterfaceTypeImplTest.java
|
| ===================================================================
|
| --- editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/InterfaceTypeImplTest.java (revision 23812)
|
| +++ editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/InterfaceTypeImplTest.java (working copy)
|
| @@ -32,6 +32,7 @@
|
|
|
| import static com.google.dart.engine.ast.ASTFactory.identifier;
|
| import static com.google.dart.engine.element.ElementFactory.classElement;
|
| +import static com.google.dart.engine.element.ElementFactory.functionElement;
|
| import static com.google.dart.engine.element.ElementFactory.getterElement;
|
| import static com.google.dart.engine.element.ElementFactory.library;
|
| import static com.google.dart.engine.element.ElementFactory.methodElement;
|
| @@ -968,6 +969,25 @@
|
| assertTrue(typeA.isSubtypeOf(dynamicType));
|
| }
|
|
|
| + public void test_isSubtypeOf_function() throws Exception {
|
| + //
|
| + // void f(String s) {}
|
| + // class A {
|
| + // void call(String s) {}
|
| + // }
|
| + //
|
| + InterfaceType stringType = typeProvider.getStringType();
|
| + ClassElementImpl classA = classElement("A");
|
| + classA.setMethods(new MethodElement[] {methodElement(
|
| + "call",
|
| + VoidTypeImpl.getInstance(),
|
| + stringType)});
|
| +
|
| + FunctionType functionType = functionElement("f", new ClassElement[] {stringType.getElement()}).getType();
|
| +
|
| + assertTrue(classA.getType().isSubtypeOf(functionType));
|
| + }
|
| +
|
| public void test_isSubtypeOf_interface() {
|
| ClassElement classA = classElement("A");
|
| ClassElement classB = classElement("B", classA.getType());
|
|
|