Expand the tests for missing init function

This commit is contained in:
Gaith Hallak 2022-06-21 20:19:24 +04:00
parent 64682aa10c
commit 6b309c9381
5 changed files with 22 additions and 5 deletions

View File

@ -208,6 +208,7 @@ compilable_contracts() ->
"polymorphism_contract_interface_extensions", "polymorphism_contract_interface_extensions",
"polymorphism_contract_interface_same_decl_multi_interface", "polymorphism_contract_interface_same_decl_multi_interface",
"polymorphism_contract_interface_same_name_same_type", "polymorphism_contract_interface_same_name_same_type",
"missing_init_fun_state_unit",
"test" % Custom general-purpose test file. Keep it last on the list. "test" % Custom general-purpose test file. Keep it last on the list.
]. ].
@ -1035,9 +1036,14 @@ failing_contracts() ->
[<<?Pos(3,12) [<<?Pos(3,12)
"The event type cannot be parameterized">> "The event type cannot be parameterized">>
]) ])
, ?TYPE_ERROR(missing_init_function, , ?TYPE_ERROR(missing_init_fun_alias_to_type,
[<<?Pos(1,10) [<<?Pos(1,10)
"Missing `init` function for the contract `MissingInitFunction`.\n" "Missing `init` function for the contract `AliasToType`.\n"
"The `init` function can only be omitted if the state type is `unit`">>
])
, ?TYPE_ERROR(missing_init_fun_alias_to_alias_to_type,
[<<?Pos(1,10)
"Missing `init` function for the contract `AliasToAliasToType`.\n"
"The `init` function can only be omitted if the state type is `unit`">> "The `init` function can only be omitted if the state type is `unit`">>
]) ])
]. ].

View File

@ -0,0 +1,3 @@
contract AliasToAliasToType =
type alias = int * int
type state = alias

View File

@ -0,0 +1,2 @@
contract AliasToType =
type state = int * int

View File

@ -0,0 +1,9 @@
contract AliasToAliasToUnit =
type alias = unit
type state = alias
contract AliasToUnit =
type state = unit
main contract ImplicitState =
type sometype = int

View File

@ -1,3 +0,0 @@
contract MissingInitFunction =
type state = int * int