Repository: openllb/hlb (go)

Issue:
env/localEnv parse issue
# Repro

`example.hlb`

```
fs example() {
  image "alpine"
  run "echo $TEST" with option {
    env localEnv "TEST"
  }
}
```

# Expected results

Syntax error while parsing file

# Actual results

```#1 compiling [example]
panic: runtime error: index out of range [0] with length 0goroutine 91 [running]:
github.com/openllb/hlb/codegen.(*CodeGen).EmitStringChainStmt(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc00026c8c0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/chain.go:849 +0x20b2
github.com/openllb/hlb/codegen.(*CodeGen).EmitStringExpr(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc00026c8c0, 0x0, 0x0, 0x0, 0x0)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/expr.go:15 +0x9e
github.com/openllb/hlb/codegen.(*CodeGen).EmitExecOptions(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc0003387c2, 0x3, 0xc000010798, 0x1, 0x1, 0x17af0a0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/codegen.go:1019 +0xc65
github.com/openllb/hlb/codegen.(*CodeGen).EmitOptionBlock(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc0003387c2, 0x3, 0xc00026d950, 0x17af0a0, 0x1, 0x0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/codegen.go:437 +0x317
github.com/openllb/hlb/codegen.(*CodeGen).EmitOptionExpr(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc00026d9a0, 0x0, 0x0, 0x0, 0xc0003387c2, 0x3, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/expr.go:132 +0x452
github.com/openllb/hlb/codegen.(*CodeGen).EmitFilesystemBuiltinChainStmt(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc00026db30, 0xc0000106b8, 0x1, 0x1, 0xc0005c4fc0, 0x17af0a0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/chain.go:165 +0xc0
github.com/openllb/hlb/codegen.(*CodeGen).EmitFilesystemChainStmt(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc00026db30, 0xc0000106b8, 0x1, 0x1, 0xc0005c4fc0, 0x17af0a0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/chain.go:76 +0xd2
github.com/openllb/hlb/codegen.(*CodeGen).EmitChainStmt(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0x1725d8d, 0x2, 0xc0005bf340, 0x17af0a0, 0x17075a0, 0xc000270960, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/chain.go:35 +0x25f
github.com/openllb/hlb/codegen.(*CodeGen).EmitBlock(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0x1725d8d, 0x2, 0xc0005148c0, 0x2, 0x2, 0x17af0a0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/codegen.go:333 +0x21b
github.com/openllb/hlb/codegen.(*CodeGen).EmitFilesystemBlock(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e120, 0xc000270230, 0x17af0a0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/codegen.go:365 +0xf7
github.com/openllb/hlb/codegen.(*CodeGen).EmitFuncDecl(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc00048e0e0, 0xc000489bc0, 0x0, 0x0, 0x0, 0x17af0a0, 0x0, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/decl.go:37 +0x48d
github.com/openllb/hlb/codegen.(*CodeGen).Generate(0xc000432b80, 0x19de0e0, 0xc0001a5cc0, 0xc0000a5d10, 0xc00043af00, 0x1, 0x1, 0x0, 0xc0005e0580, 0xc0004a9c20, ...)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/codegen/codegen.go:164 +0xe57
github.com/openllb/hlb.Compile.func1(0x19de0e0, 0xc0001a5cc0, 0x0, 0x0)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/hlb.go:91 +0xff
github.com/openllb/hlb/solver.(*progressUI).Write.func2.1(0xc0000254a0, 0xc000190e08)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/solver/progress.go:172 +0x3b
github.com/openllb/hlb/solver.write(0x19d22a0, 0xc00048e200, 0xc00043e3e0, 0x13, 0xc000190f40, 0x0, 0x0)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/solver/progress.go:196 +0x278
github.com/openllb/hlb/solver.(*progressUI).Write.func2(0x0, 0x0)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/github.com/openllb/hlb/solver/progress.go:171 +0x119
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc00043ae10, 0xc0005c58c0)
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/golang.org/x/sync/errgroup/errgroup.go:57 +0x59
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/src/stash.corp.netflix.com/engtools/newt/vendor/golang.org/x/sync/errgroup/errgroup.go:54 +0x66

```

Pull request:
Fix checker error for using non-zero arg builtins as args
Fixes #143 

Patch:
diff --git a/checker/checker.go b/checker/checker.go
index 57cd9da..05cffe5 100644
--- a/checker/checker.go
+++ b/checker/checker.go
@@ -492,8 +492,11 @@ func (c *checker) checkExpr(scope *parser.Scope, typ parser.ObjType, expr *parse
 }
 
 func (c *checker) checkIdentArg(scope *parser.Scope, typ parser.ObjType, ident *parser.Ident) error {
-	_, ok := builtin.Lookup.ByType[typ].Func[ident.Name]
+	fun, ok := builtin.Lookup.ByType[typ].Func[ident.Name]
 	if ok {
+		if len(fun.Params) > 0 {
+			return ErrFuncArg{ident}
+		}
 		return nil
 	}
 


Test patch:
diff --git a/checker/checker_test.go b/checker/checker_test.go
index c84ff26..a758be3 100644
--- a/checker/checker_test.go
+++ b/checker/checker_test.go
@@ -352,6 +352,23 @@ func TestChecker_Check(t *testing.T) {
 				Name: "image",
 			},
 		},
+	}, {
+		"errors when non-zero arg builtin is used as arg",
+		`
+		fs default() {
+			env localEnv "TEST"
+		}
+		`,
+		ErrFuncArg{
+			Ident: &parser.Ident{
+				Pos: lexer.Position{
+					Filename: "<stdin>",
+					Line:     2,
+					Column:   5,
+				},
+				Name: "localEnv",
+			},
+		},
 	}} {
 		tc := tc
 		t.Run(tc.name, func(t *testing.T) {