Add failing tests

This commit is contained in:
Gaith Hallak 2022-11-11 20:31:13 +03:00
parent d063040ac1
commit ed2ef02d68
7 changed files with 50 additions and 1 deletions

View File

@ -3768,7 +3768,7 @@ mk_error({unpreserved_payablity, Kind, ContractCon, InterfaceCon}) ->
contract -> "contract"; contract -> "contract";
contract_interface -> "interface" contract_interface -> "interface"
end, end,
Msg = io_lib:format("Non-payable ~s ~s cannot implement payable interface ~s", Msg = io_lib:format("Non-payable ~s `~s` cannot implement payable interface `~s`",
[KindStr, name(ContractCon), name(InterfaceCon)]), [KindStr, name(ContractCon), name(InterfaceCon)]),
mk_t_err(pos(ContractCon), Msg); mk_t_err(pos(ContractCon), Msg);
mk_error(Err) -> mk_error(Err) ->

View File

@ -1155,6 +1155,26 @@ failing_contracts() ->
"to arguments\n" "to arguments\n"
" `Chain.create : (value : int, var_args) => 'c`">> " `Chain.create : (value : int, var_args) => 'c`">>
]) ])
, ?TYPE_ERROR(polymorphism_add_stateful_entrypoint,
[<<?Pos(5,25)
"`f` cannot be stateful because the entrypoint `f` in the interface `I` is not stateful">>
])
, ?TYPE_ERROR(polymorphism_change_entrypoint_to_function,
[<<?Pos(6,14)
"`f` must be declared as an entrypoint instead of a function in order to implement the entrypoint `f` from the interface `I`">>
])
, ?TYPE_ERROR(polymorphism_non_payable_contract_implement_payable,
[<<?Pos(4,10)
"Non-payable contract `C` cannot implement payable interface `I`">>
])
, ?TYPE_ERROR(polymorphism_non_payable_interface_implement_payable,
[<<?Pos(4,20)
"Non-payable interface `H` cannot implement payable interface `I`">>
])
, ?TYPE_ERROR(polymorphism_remove_payable_entrypoint,
[<<?Pos(5,16)
"`f` must be payable because the entrypoint `f` in the interface `I` is payable">>
])
]. ].
validation_test_() -> validation_test_() ->

View File

@ -0,0 +1,5 @@
contract interface I =
entrypoint f : () => int
contract C : I =
stateful entrypoint f() = 1

View File

@ -0,0 +1,6 @@
contract interface I =
entrypoint f : () => int
contract C : I =
entrypoint init() = ()
function f() = 1

View File

@ -0,0 +1,5 @@
payable contract interface I =
payable entrypoint f : () => int
contract C : I =
entrypoint f() = 123

View File

@ -0,0 +1,8 @@
payable contract interface I =
payable entrypoint f : () => int
contract interface H : I =
payable entrypoint f : () => int
payable contract C : H =
entrypoint f() = 123

View File

@ -0,0 +1,5 @@
contract interface I =
payable entrypoint f : () => int
contract C : I =
entrypoint f() = 1