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 23 additions and 1 deletions
Showing only changes of commit a87eb36778 - Show all commits

View File

@ -202,7 +202,6 @@ 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",
@ -1026,6 +1025,20 @@ failing_contracts() ->
"Cannot unify `Animal` and `Cat` in a covariant context\n"
"when checking the type of the pattern `q15 : oracle_query(Cat, Cat)` against the expected type `oracle_query(Cat, Animal)`">>
])
, ?TYPE_ERROR(polymorphism_variance_switching_chain_create,
[<<?Pos(26,23)
"I is not implemented.\n"
"when resolving arguments of variadic function `Chain.create`">>,
<<?Pos(27,13)
"Cannot unify `I` and `C1` in a covariant context\n"
"when checking the type of the pattern `c2 : C1` against the expected type `I`">>,
<<?Pos(27,23)
"I is not implemented.\n"
"when resolving arguments of variadic function `Chain.create`">>,
<<?Pos(28,23)
"I is not implemented.\n"
"when resolving arguments of variadic function `Chain.create`">>
])
, ?TYPE_ERROR(missing_definition,
[<<?Pos(2,14)
"Missing definition of function `foo`">>

View File

@ -21,3 +21,12 @@ main contract Main =
stateful entrypoint test2() =
let c = Make.new2()
Make.new(c)
stateful entrypoint test3() =
let c1 : I = Chain.create() // fails
let c2 : C1 = Chain.create() : I // fails
let c3 = Chain.create() : I // fails
let c4 = Chain.create() : C1 // succeeds
let c5 : I = Chain.create() : C1 // succeeds
let c6 : C1 = Chain.create() // succeeds
()