Fail gracefully on bad top-level declaration

This commit is contained in:
Ulf Norell
2019-09-03 17:24:06 +02:00
parent 412b0b8b6d
commit 325d69e96d
3 changed files with 16 additions and 1 deletions
+2
View File
@@ -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).
+3
View File
@@ -0,0 +1,3 @@
function square(x) = x ^ 2
contract Main =
entrypoint main() = square(10)