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

Remove schema.TupleConsExpr #175

Merged
merged 4 commits into from
Dec 13, 2022
Merged

Remove schema.TupleConsExpr #175

merged 4 commits into from
Dec 13, 2022

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Dec 8, 2022

Part of hashicorp/terraform-ls#496
Related terraform-schema PR: hashicorp/terraform-schema#169


Originally the TupleConsExpr constraint was meaning to express the "raw" HCL TupleConsExpr (essentially the [] square brackets) in context where the expression isn't interpreted as data.

However, as we will be making some bigger changes to expressions, this additional constraint is something we'd have to account for too, when we can instead just use any of the existing types, such as ListExpr, SetExpr or TupleExpr, on best-effort basis to express how the expression is treated and reduce the total number of constraints we have to deal with.

For example, in Terraform's data or resource block, we have depends_on = []. We can choose SetExpr with the reasoning that ordering of elements within doesn't matter and every element is of the same type.

hashicorp/terraform-schema#169 also uncovered one minor bug with rendering of collections types with multiple element constraints, so I added some more tests and fixed the bug.

Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants