diff --git a/internal/shader/expr.go b/internal/shader/expr.go index 1c063820f..f5460a831 100644 --- a/internal/shader/expr.go +++ b/internal/shader/expr.go @@ -199,7 +199,7 @@ func (cs *compileState) parseExpr(block *block, fname string, expr ast.Expr, mar return nil, nil, nil, false } for _, expr := range es { - if expr.Type == shaderir.FunctionExpr { + if expr.Type == shaderir.FunctionExpr || expr.Type == shaderir.BuiltinFuncExpr { cs.addError(e.Pos(), fmt.Sprintf("function name cannot be an argument: %s", e.Fun)) return nil, nil, nil, false } diff --git a/internal/shader/syntax_test.go b/internal/shader/syntax_test.go index 61512ee2e..3c07065b2 100644 --- a/internal/shader/syntax_test.go +++ b/internal/shader/syntax_test.go @@ -1897,6 +1897,16 @@ func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 { Foo(Bar()) return color } +`)); err == nil { + t.Errorf("error must be non-nil but was nil") + } + // Issue #2965 + if _, err := compileToIR([]byte(`package main + +func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 { + abs(sign) + return color +} `)); err == nil { t.Errorf("error must be non-nil but was nil") }