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

unknown upgraded splat values may have no elements #495

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Dec 1, 2021

Follow up for #493, which ensured the value of an upgraded splat expression on an unknown value is unknown, but could result in the wrong type. When the previous PR was updated to allow specific types for expressions with attribute selectors after the splat, the resulting types were still unknown tuples even though the number of elements could not be determined.

When upgrading an unknown splat value, the resulting collection may have 0 elements if the value ends up being null. Since the final result may be a tuple type with 0 or 1 elements, the unknown value must also be dynamic.

When upgrading an unknown splat value, the resulting collection may have
0 elements if the value ends up being `null`. This means the type must
be dynamic.
Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loss of the type information here is unfortunate for sure, but I think it makes pragmatic sense given the various different permutations this operator supports in order to match as closely as possible how Terraform v0.11 and earlier treated .* in resource references; it isn't really a thing that was designed with precise type information in mind, after all.

@jbardin jbardin merged commit 25697c8 into main Dec 1, 2021
@jbardin jbardin deleted the jbardin/unknown-splat branch December 1, 2021 17:24
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