Report undefined interface errors before checking implemented interfaces

This commit is contained in:
Gaith Hallak 2021-11-26 19:03:41 +02:00
parent 03413ab0d4
commit df676ff6e9
4 changed files with 13 additions and 5 deletions

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() = ()