| Age | Commit message (Collapse) | Author |
|
Co-authored-by: hashicorp-tsccr[bot] <hashicorp-tsccr[bot]@users.noreply.github.com>
|
|
|
|
docs: fix typo under "Dynamic Attributes Processing"
|
|
|
|
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
|
|
Preserve marks when traversing unknown values
|
|
When traversing an unknown value or a DynamicVal, the marks from that
initial value must be preserved for HCL Index and GetAttr operations.
This mirrors the behavior of GetAttr and Index when used directly the
underlying cty values.
|
|
Prepare for v2.22.0 release
|
|
|
|
Update Changelog.md
|
|
|
|
hashicorp/support-incomplete-references-in-object-items
feat: return an `ExprSyntaxError` for invalid references that end in a dot
|
|
(commonly occurs in editors for completions)
Detect value expressions of the ExprSyntaxError type when parsing object constructor expressions and use them to add an item to the result even though we skip parsing the object due to recovery after the invalid expression.
This allows the Terraform language server to support completions for object attributes after a dot was typed.
|
|
|
|
Co-authored-by: hashicorp-tsccr[bot] <hashicorp-tsccr[bot]@users.noreply.github.com>
|
|
|
|
Similar to the previously-added UnknownBody, the new optional interface
MarkedBody allows hcl.Body implementations to suggest a set of marks that
ought to be applied to any value that's generated to represent the content
of that body.
The dynblock extension then uses this to get hcldec to mark the whole
object representing any block that was generated by a dynamic block whose
for_each was marked, for a better representation of the fact that a
block's existence was decided based on a marked value.
|
|
Previously if the for_each expression was marked then expansion would
fail because marked expressions are never directly iterable.
Now instead we'll allow marked for_each and preserve the marks into the
values produced by the resulting block as much as we can. This runs into
the classic problem that HCL blocks are not values themselves and so
cannot carry marks directly, but we can at least make sure that the values
of any leaf arguments end up marked.
|
|
We were calling .Range() on any unknown sourceVal, without first checking
whether it was marked. That method panics if called on a marked value,
so we need to strip that off first.
While testing this I found some return paths that weren't properly
transferring the source value's marks to the output, and so this also
addresses those so that all return paths preserve whatever markings are
present on the source value.
In particular, if a non-list/set/tuple value gets "upgraded" into a tuple
then we must transfer its marks onto the tuple, because the decision about
constructing that value was based on characteristics of the source value.
|
|
|
|
Co-authored-by: hashicorp-tsccr[bot] <hashicorp-tsccr[bot]@users.noreply.github.com>
|
|
|
|
* Add additional function for parsing traversals with [*] keys
* add more context around skipped test cases
|
|
|
|
Due to the quite messy heritage of this codebase -- including a large part
of it being just a fork of my earlier personal project ZCL -- there were
many different conventions for how to pretty-print and diff values in the
tests in different parts of the codebase.
To reduce the dependency sprawl, this commit now standardizes on:
- github.com/davecgh/go-spew for pretty-printing
- github.com/google/go-cmp for diffing
These two dependencies were already present anyway, are the most general
out of all of the candidates, and are also already in use by at least some
of HCL's most significant callers, such as HashiCorp Terraform.
The version of go-cmp we were previously using seems to have a bug that
causes the tests to crash when run under the Go race detector, so I've
also upgraded that dependency to latest here to clear that bug.
|
|
add `ExprSyntaxError`
|
|
|
|
|
|
|
|
for namespaced functions
|
|
|
|
Use new make targets in CI
|
|
|
|
Add make targets for common checks + fixes
|
|
Fix license headers
|
|
Run unit tests on macOS
|
|
This is to make it easier for existing and new maintainers and contributors to run checks on the codebase.
|
|
|
|
|
|
|
|
This reduces the number of places to update whenever we upgrade Go version.
|
|
|
|
|
|
|
|
|
|
|
|
In theory we could use the latest (v0.18.0) version of the x/tools module but that would also bring upgrade of x/sys (transitive dependency of go-cty) from current v0.5.0 and full understanding of implications of that upgrade.
|
|
hclwrite: Fix formatting of namespaced functions
|
|
|
|
|