Index: pkg/kernel/testcases/reify/closure_test.dart.expect |
diff --git a/pkg/kernel/testcases/reify/closure_test.dart.expect b/pkg/kernel/testcases/reify/closure_test.dart.expect |
new file mode 100644 |
index 0000000000000000000000000000000000000000..50134be7056b927c3a65183b54880fdb52b46dbf |
--- /dev/null |
+++ b/pkg/kernel/testcases/reify/closure_test.dart.expect |
@@ -0,0 +1,162 @@ |
+library closure_test; |
+import self as self; |
+import "dart:core" as core; |
+import "../../runtime/reify/interceptors.dart" as int; |
+import "../../runtime/reify/types.dart" as typ; |
+import "dart:mock" as mock; |
+import "./test_base.dart" as tes; |
+import "../../runtime/reify/declarations.dart" as dec; |
+ |
+class A extends core::Object implements int::HasRuntimeTypeGetter { |
+ constructor •() → void |
+ : super core::Object::•() |
+ ; |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](0)); |
+} |
+class B extends core::Object implements int::HasRuntimeTypeGetter { |
+ constructor •() → void |
+ : super core::Object::•() |
+ ; |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](1)); |
+} |
+class Closure#main#foo extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ field mock::Context context; |
+ constructor •(final mock::Context context) → dynamic |
+ : self::Closure#main#foo::context = context |
+ ; |
+ method call(self::A a) → self::B { |
+ "This is a temporary solution. In the VM, this will become an additional parameter."; |
+ final mock::Context #contextParameter = this.{self::Closure#main#foo::context}; |
+ return null; |
+ } |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](2)); |
+} |
+class Closure#main#qux extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ field mock::Context context; |
+ constructor •(final mock::Context context) → dynamic |
+ : self::Closure#main#qux::context = context |
+ ; |
+ method call(self::B b) → self::A { |
+ "This is a temporary solution. In the VM, this will become an additional parameter."; |
+ final mock::Context #contextParameter = this.{self::Closure#main#qux::context}; |
+ return null; |
+ } |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](3)); |
+} |
+class Closure#bar extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ constructor •() → dynamic |
+ ; |
+ method call(self::A a) → dynamic |
+ return self::bar(a); |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](4)); |
+} |
+class Closure#bar extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ constructor •() → dynamic |
+ ; |
+ method call(self::A a) → dynamic |
+ return self::bar(a); |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](5)); |
+} |
+class Closure#baz extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ constructor •() → dynamic |
+ ; |
+ method call(dynamic a) → self::B |
+ return self::baz(a); |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](6)); |
+} |
+class Closure#baz extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ constructor •() → dynamic |
+ ; |
+ method call(dynamic a) → self::B |
+ return self::baz(a); |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](7)); |
+} |
+class Closure#bar extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ constructor •() → dynamic |
+ ; |
+ method call(self::A a) → dynamic |
+ return self::bar(a); |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](8)); |
+} |
+class Closure#baz extends core::Object implements core::Function, int::HasRuntimeTypeGetter { |
+ field core::String note = "This is temporary. The VM doesn't need closure classes."; |
+ constructor •() → dynamic |
+ ; |
+ method call(dynamic a) → self::B |
+ return self::baz(a); |
+ get $type() → typ::ReifiedType |
+ return new typ::Interface::•(self::$declarations.[](9)); |
+} |
+static final field core::List<dec::Class> $declarations = (core::List<dec::Class> d) → core::List<dec::Class> { |
+ dec::init(d, 0, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 1, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 2, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ::Interface::•(d.[](1)), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
+ dec::init(d, 3, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ::Interface::•(d.[](0)), 0, <dynamic>[new typ::Interface::•(d.[](1))])); |
+ dec::init(d, 4, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), const typ::Dynamic::•(), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
+ dec::init(d, 5, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), const typ::Dynamic::•(), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
+ dec::init(d, 6, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ::Interface::•(d.[](1)), 0, <dynamic>[const typ::Dynamic::•()])); |
+ dec::init(d, 7, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ::Interface::•(d.[](1)), 0, <dynamic>[const typ::Dynamic::•()])); |
+ dec::init(d, 8, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), const typ::Dynamic::•(), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
+ dec::init(d, 9, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ::Interface::•(d.[](1)), 0, <dynamic>[const typ::Dynamic::•()])); |
+ dec::init(d, 10, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 11, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 12, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 13, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](26), <dynamic>[new typ::Interface::•(d.[](13))]), new typ::Interface::•(d.[](27))]); |
+ dec::init(d, 14, new typ::Interface::•(d.[](28))); |
+ dec::init(d, 15, new typ::Interface::•(d.[](28))); |
+ dec::init(d, 16, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 17, new typ::Interface::•(d.[](29))); |
+ dec::init(d, 18, new typ::Interface::•(d.[](29))); |
+ dec::init(d, 19, new typ::Interface::•(d.[](29))); |
+ dec::init(d, 20, new typ::Interface::•(d.[](29))); |
+ dec::init(d, 21, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](30))]); |
+ dec::init(d, 22, new typ::Interface::•(d.[](23))); |
+ dec::init(d, 23, new typ::Interface::•(d.[](29))); |
+ dec::init(d, 24, null); |
+ dec::init(d, 26, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 27, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 28, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface::•(d.[](26), <dynamic>[new typ::Interface::•(d.[](28))])]); |
+ dec::init(d, 29, new typ::Interface::•(d.[](24))); |
+ dec::init(d, 30, new typ::Interface::•(d.[](24))); |
+ return d; |
+}.call(dec::allocateDeclarations(<dynamic>["A", "B", "Closure#main#foo", "Closure#main#qux", "Closure#bar", "Closure#bar", "Closure#baz", "Closure#baz", "Closure#bar", "Closure#baz", "Function", "Null", "bool", "String", "int", "double", "Type", "AbstractClassInstantiationError", "NoSuchMethodError", "CyclicInitializationError", "UnsupportedError", "IntegerDivisionByZeroException", "RangeError", "ArgumentError", "Object", "HasRuntimeTypeGetter", "Comparable", "Pattern", "num", "Error", "Exception"], <dynamic>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0])); |
+static method bar(self::A a) → dynamic { |
+ return null; |
+} |
+static method baz(dynamic a) → self::B { |
+ return null; |
+} |
+static method main() → dynamic { |
+ final (self::A) → self::B foo = new self::Closure#main#foo::•(null); |
+ final (self::B) → self::A qux = new self::Closure#main#qux::•(null); |
+ tes::expectTrue(typ::isSubtypeOf(int::type(foo), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))]))); |
+ tes::expectTrue(!typ::isSubtypeOf(int::type(qux), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))]))); |
+ tes::expectTrue(!typ::isSubtypeOf(int::type(foo), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]))); |
+ tes::expectTrue(typ::isSubtypeOf(int::type(qux), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]))); |
+ tes::expectTrue(typ::isSubtypeOf(int::type(new self::Closure#bar::•()), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))]))); |
+ tes::expectTrue(!typ::isSubtypeOf(int::type(new self::Closure#bar::•()), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]))); |
+ tes::expectTrue(typ::isSubtypeOf(int::type(new self::Closure#baz::•()), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))]))); |
+ tes::expectTrue(!typ::isSubtypeOf(int::type(new self::Closure#baz::•()), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]))); |
+ dynamic rab = new self::Closure#bar::•(); |
+ dynamic zab = new self::Closure#baz::•(); |
+ tes::expectTrue(typ::isSubtypeOf(int::type(rab), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))]))); |
+ tes::expectTrue(!typ::isSubtypeOf(int::type(rab), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]))); |
+ tes::expectTrue(typ::isSubtypeOf(int::type(zab), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))]))); |
+ tes::expectTrue(!typ::isSubtypeOf(int::type(zab), new typ::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]))); |
+} |