From b21bf6169880c0e50778ba1a8076e179610b6fec Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sat, 28 Jul 2018 15:44:44 -0700 Subject: [PATCH] hclsyntax: Annotate diags from IndexExpr with source expr information --- hcl/hclsyntax/expression.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hcl/hclsyntax/expression.go b/hcl/hclsyntax/expression.go index e92361f..500eba3 100644 --- a/hcl/hclsyntax/expression.go +++ b/hcl/hclsyntax/expression.go @@ -604,7 +604,9 @@ func (e *IndexExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { diags = append(diags, collDiags...) diags = append(diags, keyDiags...) - return hcl.Index(coll, key, &e.SrcRange) + val, diags := hcl.Index(coll, key, &e.SrcRange) + setDiagEvalContext(diags, e, ctx) + return val, diags } func (e *IndexExpr) Range() hcl.Range {