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

function/stdlib: Fix setproduct bug with unknowns #109

Merged

Conversation

alisdair
Copy link
Contributor

If an argument to setproduct is a set with unknown values, its length is unknown, as the unknown values may be duplicates of others in the set. This should result in returning an unknown value propagating all marks.

Previously this crashed due to a misuse of .Mark(marks) instead of .WithMarks(marks). This commit also fixes an issue with the previous logic, which would shortcut return and omit marks from any arguments after the set with unknown length.

Also includes a couple of tests for setproduct that were in my local working copy for some reason.

Downstream issue: hashicorp/terraform#28984

If an argument to setproduct is a set with unknown values, its length is
unknown, as the unknown values may be duplicates of others in the set.
This should result in returning an unknown value propagating all marks.

Previously this crashed due to a misuse of `.Mark(marks)` instead of
`.WithMarks(marks)`. This commit also fixes an issue with the previous
logic, which would shortcut return and omit marks from any arguments
after the set with unknown length.

Also includes a couple of tests for setproduct that were in my local
working copy for some reason.
@apparentlymart
Copy link
Collaborator

This looks great. Thanks!

@apparentlymart apparentlymart merged commit 7ef3c08 into zclconf:main Jun 21, 2021
@alisdair alisdair deleted the fix-setproduct-with-unknown-set-value branch June 21, 2021 16:06
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.

2 participants