Nice type error if contract function is called as from a namespace

This commit is contained in:
Ulf Norell
2019-10-01 13:40:01 +02:00
parent 2d6d506d63
commit 5e6ff6c9a7
3 changed files with 30 additions and 10 deletions
+4
View File
@@ -577,6 +577,10 @@ failing_contracts() ->
[<<?Pos(2, 3)
"Only the main contract can contain defined functions or entrypoints.\n"
"Fix: replace the definition of 'foo' by a type signature.">>])
, ?TYPE_ERROR(contract_as_namespace,
[<<?Pos(5, 28)
"Invalid call to contract entrypoint 'Foo.foo'.\n"
"It must be called as 'c.foo' for some c : Foo.">>])
].
-define(Path(File), "code_errors/" ??File).
+6
View File
@@ -0,0 +1,6 @@
contract Foo =
entrypoint foo : () => int
contract Fail =
entrypoint bad() : int = Foo.foo()