Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix panic for partial provider defined functions in tuple expressions ([ provider:: ]) #664

Closed
wants to merge 2 commits into from

Conversation

ansgarm
Copy link
Member

@ansgarm ansgarm commented Mar 1, 2024

When parsing invalid provider defined functions, a nil expression is returned. While there are diagnostics that correctly tell us about invalid configuration, in the editor we still need to continue working with the invalid configuration.

This fix allows us to call Variables() on expressions that may have a nested nil in a tuple somewhere. We do this e.g. when collecting reference origins and instead of digging into the expressions at hand and deciding whether to call .Variables() or not, fixing it at the source seems more useful.

… (`[ provider:: ]`)

When parsing invalid provider defined functions, a `nil` expression is returned. While there are diagnostics that correctly tell us about invalid configuration, in the editor we still need to continue working with the invalid configuration.

This fix allows us to call `Variables()` on expressions that may have a nested nil in a tuple somewhere. We do this e.g. when [collecting reference origins](https://github.com/hashicorp/hcl-lang/blob/4db48f4b5961120c51b11216d040c095c0fd4a76/decoder/expr_any_ref_origins.go#L174) and instead of digging into the expressions at hand and deciding whether to call `.Variables()` or not, fixing it at the source seems more useful.
@ansgarm
Copy link
Member Author

ansgarm commented Mar 12, 2024

Closing in favor of #668

@ansgarm ansgarm closed this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant