diff --git a/changelog/pending/20221109--pkg--panic-in-codegen-obj-expressions.yaml b/changelog/pending/20221109--pkg--panic-in-codegen-obj-expressions.yaml new file mode 100644 index 000000000000..777d9c80eed8 --- /dev/null +++ b/changelog/pending/20221109--pkg--panic-in-codegen-obj-expressions.yaml @@ -0,0 +1,4 @@ +changes: +- type: fix + scope: pkg + description: Fix a panic in codegen for an edge case involving object expressions without corresponding function arguments. diff --git a/pkg/codegen/pcl/invoke.go b/pkg/codegen/pcl/invoke.go index cb7af2d5e4ce..0e0e0cd644bd 100644 --- a/pkg/codegen/pcl/invoke.go +++ b/pkg/codegen/pcl/invoke.go @@ -150,7 +150,9 @@ func (b *binder) bindInvokeSignature(args []model.Expression) (model.StaticFunct // annotate the input args on the expression with the input type of the function if argsObject, isObjectExpression := args[1].(*model.ObjectConsExpression); isObjectExpression { - annotateObjectProperties(argsObject.Type(), fn.Inputs) + if fn.Inputs != nil { + annotateObjectProperties(argsObject.Type(), fn.Inputs) + } } return sig, nil