From 7327a8cc3f8b38b16bc722203aa6418670d5b510 Mon Sep 17 00:00:00 2001 From: Morgan Date: Wed, 18 Dec 2024 13:08:45 +0100 Subject: [PATCH] chore(gnovm): add suggestion to build for bodyless funcs error (#3363) trying to avoid reports like #3361 --- gnovm/pkg/gnolang/preprocess.go | 2 +- gnovm/tests/files/native0.gno | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 gnovm/tests/files/native0.gno diff --git a/gnovm/pkg/gnolang/preprocess.go b/gnovm/pkg/gnolang/preprocess.go index 8951c2c04cf..d47067854ca 100644 --- a/gnovm/pkg/gnolang/preprocess.go +++ b/gnovm/pkg/gnolang/preprocess.go @@ -4404,7 +4404,7 @@ func tryPredefine(store Store, last BlockNode, d Decl) (un Name) { if fv.body == nil && store != nil { fv.nativeBody = store.GetNative(pkg.PkgPath, d.Name) if fv.nativeBody == nil { - panic(fmt.Sprintf("function %s does not have a body but is not natively defined", d.Name)) + panic(fmt.Sprintf("function %s does not have a body but is not natively defined (did you build after pulling from the repository?)", d.Name)) } fv.NativePkg = pkg.PkgPath fv.NativeName = d.Name diff --git a/gnovm/tests/files/native0.gno b/gnovm/tests/files/native0.gno new file mode 100644 index 00000000000..a6b8f3e67bf --- /dev/null +++ b/gnovm/tests/files/native0.gno @@ -0,0 +1,10 @@ +package main + +func invalidNative() string + +func main() { + println(invalidNative()) +} + +// Error: +// main/files/native0.gno:3:1: function invalidNative does not have a body but is not natively defined (did you build after pulling from the repository?)