Skip to content

Panic during nested splat evaluation with nulls #723

@cam72cam

Description

@cam72cam

Initially reported in opentofu/opentofu#2327, it appears that null handling with nested splats can cause panics in seemingly valid HCL.

I traced it down to https://github.com/hashicorp/hcl/blob/b48ba6e/hclsyntax/expression.go#L1803. Instead of returning a tuple with a null element, it returns an empty tuple. When patched to instead return cty.TupleVal([]cty.Value{sourceVal}).WithSameMarks(sourceVal), it functions as expected in this particular scenario.

What I have not yet investigated is what the intended code path here is, should it be an error caught earlier in the process or should the patch above be accepted as the "correct" functionality here.

It looks like it was originally introduced in 2b184ca

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions