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

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

Issue 22846003: Fix for function type assignable check. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/FunctionTypeImplTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/FunctionTypeImplTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/FunctionTypeImplTest.java
index 60b37ee842b255894256100a8e4a50339a011817..19b42bfd8b853adb249c0c3e8d706bc8dc364699 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/FunctionTypeImplTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/type/FunctionTypeImplTest.java
@@ -86,6 +86,18 @@ public class FunctionTypeImplTest extends EngineTestCase {
type.hashCode();
}
+ public void test_isAssignableTo_normalAndPositionalArgs() {
+ // ([a]) -> void <: (a) -> void
+ ClassElement a = classElement("A");
+ FunctionType t = functionElement("t", null, new ClassElement[] {a}).getType();
+ FunctionType s = functionElement("s", new ClassElement[] {a}).getType();
+ assertTrue(t.isSubtypeOf(s));
+ assertFalse(s.isSubtypeOf(t));
+ // assignable iff subtype
+ assertTrue(t.isAssignableTo(s));
+ assertFalse(s.isAssignableTo(t));
+ }
+
public void test_isSubtypeOf_baseCase_classFunction() {
// () -> void <: Function
ClassElementImpl functionElement = classElement("Function");

Powered by Google App Engine
This is Rietveld 408576698