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

decoder: Add support for LiteralType as Constraint #186

Merged
merged 8 commits into from
Mar 20, 2023

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Jan 16, 2023

Part of hashicorp/terraform-ls#496


Existing tests were updated as part of 6990693 (not part of this PR) and yield either comparable or better results, except for reference collection, which:

  • we agreed to leave for a separate PR
  • involves other constraints which aren't implemented yet

UX

2023-03-16 20 12 50

@radeksimko radeksimko added the enhancement New feature or request label Jan 16, 2023
@radeksimko radeksimko force-pushed the f-expr-cons-literal-type branch 4 times, most recently from e7e068d to fb1fc7a Compare January 23, 2023 13:53
@radeksimko radeksimko self-assigned this Jan 23, 2023
@radeksimko radeksimko force-pushed the f-expr-cons-literal-type branch 5 times, most recently from 3dc35cf to 0358cd7 Compare January 27, 2023 14:08
@radeksimko radeksimko removed their assignment Feb 16, 2023
@radeksimko radeksimko changed the title decoder/schema: Add support for LiteralType as Constraint decoder: Add support for LiteralType as Constraint Mar 7, 2023
@radeksimko radeksimko self-assigned this Mar 15, 2023
@radeksimko radeksimko force-pushed the f-expr-cons-literal-type branch 7 times, most recently from cfdd98f to 680c316 Compare March 15, 2023 14:17
@radeksimko radeksimko force-pushed the f-expr-cons-literal-type branch 5 times, most recently from b7b2a80 to 25ca427 Compare March 16, 2023 13:53
@radeksimko radeksimko force-pushed the f-expr-cons-literal-type branch 2 times, most recently from cdd0ea8 to f5566d6 Compare March 16, 2023 18:08
@radeksimko radeksimko marked this pull request as ready for review March 16, 2023 20:20
@radeksimko radeksimko requested a review from a team as a code owner March 16, 2023 20:20
decoder/expr_literal_type_hover.go Outdated Show resolved Hide resolved
decoder/expr_literal_type_semtok.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

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

Small concerns. Great work!

decoder/expr_literal_type_semtok.go Outdated Show resolved Hide resolved
decoder/expr_literal_type_completion.go Show resolved Hide resolved
decoder/expr_literal_type_hover.go Show resolved Hide resolved
decoder/expr_literal_type_ref_targets.go Show resolved Hide resolved
decoder/expr_literal_type_semtok.go Show resolved Hide resolved
@radeksimko
Copy link
Member Author

radeksimko commented Mar 20, 2023

I added LiteralType validation for nil Type and also another one to ensure there's either Constraint or Expr, so that should ensure integrity on a higher level and ensure there's no nil Constraint.

If we still somehow end up with nil constraint further down then I would call that a really bad bug which needs to be fixed in the place that produces the schema, not down here. In other words, we shouldn't be producing invalid schema in the first place anywhere and then hiding that fact, so crash is the right thing to do in such a case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants