Fail gracefully on bad top-level declaration
This commit is contained in:
@@ -493,6 +493,8 @@ failing_contracts() ->
|
||||
[<<?Pos(7, 28)
|
||||
"The 'init' function is called exclusively by the create contract transaction\n"
|
||||
"and cannot be called from the contract code.">>])
|
||||
, ?TEST(bad_top_level_decl,
|
||||
[<<?Pos(1, 1) "The definition of 'square' must appear inside a contract or namespace.">>])
|
||||
].
|
||||
|
||||
-define(Path(File), "code_errors/" ??File).
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
function square(x) = x ^ 2
|
||||
contract Main =
|
||||
entrypoint main() = square(10)
|
||||
Reference in New Issue
Block a user