Fix: Get the type of Chain.create() from its application #898

Merged
ghallak merged 5 commits from ghallak/404 into master 2022-08-04 05:24:23 +09:00
2 changed files with 24 additions and 0 deletions
Showing only changes of commit e3c82e954d - Show all commits

View File

@ -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",

View File

@ -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)