Polymorphism support #848

Merged
ghallak merged 53 commits from ghallak/307 into master 2022-06-17 18:09:07 +09:00
4 changed files with 13 additions and 5 deletions
Showing only changes of commit df676ff6e9 - Show all commits

View File

@ -855,6 +855,8 @@ infer1(Env, [{Contract, Ann, ConName, Impls, Code} | Rest], Acc, Options)
_ -> ok _ -> ok
end end
end, Impls), end, Impls),
destroy_and_report_type_errors(Env),
create_type_errors(),
case What of case What of
contract -> contract ->
ImplementedInterfaces = [proplists:get_value(Name, AllInterfaces) || Name <- ImplsNames], ImplementedInterfaces = [proplists:get_value(Name, AllInterfaces) || Name <- ImplsNames],

View File

@ -844,6 +844,10 @@ failing_contracts() ->
"Unimplemented function f from the interface J in the contract C">> "Unimplemented function f from the interface J in the contract C">>
]) ])
, ?TYPE_ERROR(contract_polymorphism_undefined_interface, , ?TYPE_ERROR(contract_polymorphism_undefined_interface,
[<<?Pos(1,14)
"Trying to implement or extend an undefined interface I at line 1, column 14">>
])
, ?TYPE_ERROR(contract_interface_polymorphism_undefined_interface,
[<<?Pos(1,24) [<<?Pos(1,24)
"Trying to implement or extend an undefined interface H at line 1, column 24">> "Trying to implement or extend an undefined interface H at line 1, column 24">>
]) ])

View File

@ -0,0 +1,5 @@
contract interface I : H =
entrypoint f : () => unit
contract C =
entrypoint g() = ()

View File

@ -1,5 +1,2 @@
contract interface I : H = contract C : I =
entrypoint f : () => unit entrypoint f() = ()
contract C =
entrypoint g() = ()