Skip to content

Commit

Permalink
chore(gnovm): add suggestion to build for bodyless funcs error (#3363)
Browse files Browse the repository at this point in the history
trying to avoid reports like #3361
  • Loading branch information
thehowl authored Dec 18, 2024
1 parent 2fed38d commit 7327a8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gnovm/pkg/gnolang/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions gnovm/tests/files/native0.gno
Original file line number Diff line number Diff line change
@@ -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?)

0 comments on commit 7327a8c

Please sign in to comment.