0b64543c96
A sequence like "foo" is represented in the AST as a TemplateExpr with a single string literal inside rather than as a string literal node directly, so we need to recognize that situation during parsing and treat it as a special case so we can get the intended behavior of representing that index as a traversal step rather than as a dynamic index operation. Most of the time this distinction doesn't matter, but it's important for static analysis use-cases. In particular, hcl.AbsTraversalForExpr will now accept an expression like foo["bar"] where before it would've rejected it. This also includes a better error message for when an expression cannot be recognized as a single traversal. There isn't really any context here to return a direct reference to the construct that was problematic, which is what we'd ideally do, but at least this new message includes a summary of what is allowed and some examples of things that are not allowed as an aid to understanding what "static variable reference" means. |
||
---|---|---|
.. | ||
hclsyntax | ||
integrationtest | ||
json | ||
spectests | ||
diagnostic_text_test.go | ||
diagnostic_text.go | ||
diagnostic.go | ||
didyoumean.go | ||
doc.go | ||
eval_context.go | ||
expr_call.go | ||
expr_list.go | ||
expr_map.go | ||
expr_unwrap.go | ||
merged_test.go | ||
merged.go | ||
ops_test.go | ||
ops.go | ||
pos_scanner_test.go | ||
pos_scanner.go | ||
pos_test.go | ||
pos.go | ||
schema.go | ||
spec.md | ||
static_expr.go | ||
structure_at_pos.go | ||
structure.go | ||
traversal_for_expr_test.go | ||
traversal_for_expr.go | ||
traversal.go |