Martin Atkins 0b64543c96 hclsyntax: Parse indexing brackets with a string literal as a traversal
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.
2019-06-18 09:38:56 -07:00
..
2018-03-04 14:04:54 -08:00
2018-02-23 08:41:58 -08:00
2018-12-11 16:49:03 -08:00
2018-01-14 11:24:19 -08:00
2018-01-14 11:51:05 -08:00
2019-04-12 15:16:41 -07:00
2019-01-03 08:46:02 -08:00