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

Unified Diff: tests/compiler/dart2js/subtype_test.dart

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix 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: tests/compiler/dart2js/subtype_test.dart
diff --git a/tests/compiler/dart2js/subtype_test.dart b/tests/compiler/dart2js/subtype_test.dart
index b4efe86a379b780bdadbe551b75fd428b963defd..35a46517582f585d7092c458cbe068ef433df522 100644
--- a/tests/compiler/dart2js/subtype_test.dart
+++ b/tests/compiler/dart2js/subtype_test.dart
@@ -264,6 +264,7 @@ void testCallableSubtype() {
testFunctionSubtyping() {
var env = new TypeEnvironment(r"""
+ _() => null;
void void_() {}
void void_2() {}
int int_() => 0;
@@ -285,6 +286,7 @@ testFunctionSubtyping() {
testTypedefSubtyping() {
var env = new TypeEnvironment(r"""
+ typedef _();
typedef void void_();
typedef void void_2();
typedef int int_();
@@ -317,6 +319,13 @@ functionSubtypingHelper(TypeEnvironment env) {
// Function <: () -> int
expect(false, 'Function', 'int_');
+ // () -> dynamic <: () -> dynamic
+ expect(true, '_', '_');
+ // () -> dynamic <: () -> void
+ expect(true, '_', 'void_');
+ // () -> void <: () -> dynamic
+ expect(true, 'void_', '_');
+
// () -> int <: () -> void
expect(true, 'int_', 'void_');
// () -> void <: () -> int

Powered by Google App Engine
This is Rietveld 408576698