diff --git a/gnovm/pkg/gnolang/static_analysis.go b/gnovm/pkg/gnolang/static_analysis.go index 311a0d42feb..7094ccbb4c8 100644 --- a/gnovm/pkg/gnolang/static_analysis.go +++ b/gnovm/pkg/gnolang/static_analysis.go @@ -108,6 +108,8 @@ func (s *staticAnalysis) staticAnalysisExpr(expr Expr) bool { // indicating whether a statement is terminating or not func (s *staticAnalysis) staticAnalysisStmt(stmt Stmt) bool { switch n := stmt.(type) { + case *BlockStmt: + return s.staticAnalysisBlockStmt(n.Body) case *BranchStmt: switch n.Op { case BREAK: diff --git a/gnovm/tests/files/block0.gno b/gnovm/tests/files/block0.gno new file mode 100644 index 00000000000..b6d554ce500 --- /dev/null +++ b/gnovm/tests/files/block0.gno @@ -0,0 +1,14 @@ +package main + +func foo() int { + { + return 1 + } +} + +func main() { + println(foo()) +} + +// Output: +// 1