Open coryb opened 1 year ago
It's parsing the option block after echo second
as a func lit. I think this diff will fix it:
diff --git a/checker/checker.go b/checker/checker.go
index 54425fb..63c900b 100644
--- a/checker/checker.go
+++ b/checker/checker.go
@@ -114,9 +114,7 @@ func (c *checker) SemanticPass(mod *ast.Module) error {
},
// Function literals propagate its return type to its BlockStmt.
func(lit *ast.FuncLit) {
- if lit.Type.Kind != ast.Option {
- lit.Body.Type = lit.Type
- }
+ lit.Body.Type = lit.Type
},
// ImportDecl's BlockStmts have module-level scope.
func(_ *ast.ImportDecl, lit *ast.FuncLit) {
Cool, yeah, that is producing a checker error now
error: cannot bind, no closure in option blocks
parse.hlb:11:24:
│
10 │ run "echo second" option {
│ ------
│ option blocks have no closures outside of "with option {...}"
11 │ mount first localCwd as second
│ ^^
│ no closure for binding
build.hlb
file:Note
run "echo second" option
should be written asrun "echo second" with option
but I would not expect this panic from the source.go run ./cmd/hlb run --log-output plain -t second
causes: