| Age | Commit message (Collapse) | Author |
|
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.
|
|
* [COMPLIANCE] Add Copyright and License Headers
* add copywrite file and revert headers in testdata
---------
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>
|
|
When we first implemented these helpers we tried to anticipate a few
situations that seemed likely to come up and implement specialized error
messages for them, but in the intervening years we've seen a number of
other situations crop up with some regularity.
Given that, I've added a few more specialized error message cases to both
of these functions, so we'll return the most generic error messages in
fewer situations.
Because hcl.Index and hcl.GetAttr are quite general functions used for
lots of different application-specific purposes alongside their part in
the implementation of the index and attribute access operators, I've
intentionally kept these messages quite vague in the suggestions they
make, which does mean that unfortunately users will probably need to do
some further research to find a suitable resolution to these messages.
Hopefully the extra context at least gives the user a better hook for that
further research.
Later we could consider putting some pre-checks in the actual operator
implementations that would catch some of these prior to calling the
generic functions and return a more directly-prescriptive error message
which assumes we're in an expression evaluation context, but I'd like to
see how these new messages are received in practice first, to see if that
additional complexity would be warranted.
|
|
|
|
We need to unmark the result of HasIndex in order to compare it with
true or false without a panic.
|
|
|
|
The main HCL package is more visible this way, and so it's easier than
having to pick it out from dozens of other package directories.
|