diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index a10c885..d2fb5b6 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -202,6 +202,7 @@ compilable_contracts() -> "polymorphism_contract_interface_extensions", "polymorphism_contract_interface_same_decl_multi_interface", "polymorphism_contract_interface_same_name_same_type", + "polymorphism_chain_create", "missing_init_fun_state_unit", "complex_compare_leq", "complex_compare", diff --git a/test/contracts/polymorphism_chain_create.aes b/test/contracts/polymorphism_chain_create.aes new file mode 100644 index 0000000..78fe9c8 --- /dev/null +++ b/test/contracts/polymorphism_chain_create.aes @@ -0,0 +1,23 @@ +contract interface I = + entrypoint f : () => int + +contract C1 : I = + entrypoint f() = 123 + +contract C2 : I = + entrypoint f() = 888 + +namespace Make = + stateful function new1() : I = Chain.create() : C1 + stateful function new2() : I = Chain.create() : C2 + + stateful function new(c : I) : int = c.f() + +main contract Main = + stateful entrypoint test1() = + let c = Make.new1() + Make.new(c) + + stateful entrypoint test2() = + let c = Make.new2() + Make.new(c)