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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/InterfaceTypeImplTest.java

Issue 16690009: Fix for issue 10970 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/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());

Powered by Google App Engine
This is Rietveld 408576698