zclsyntax: operation failure diagnostics apply to whole expr

This commit is contained in:
Martin Atkins 2017-06-12 07:14:09 -07:00
parent 9be04673c3
commit a0be779c9c

View File

@ -181,8 +181,7 @@ func (e *BinaryOpExpr) Value(ctx *zcl.EvalContext) (cty.Value, zcl.Diagnostics)
Severity: zcl.DiagError,
Summary: "Operation failed",
Detail: fmt.Sprintf("Error during operation: %s.", err),
Subject: e.RHS.Range().Ptr(),
Context: &e.SrcRange,
Subject: &e.SrcRange,
})
return cty.UnknownVal(e.Op.Type), diags
}
@ -242,8 +241,7 @@ func (e *UnaryOpExpr) Value(ctx *zcl.EvalContext) (cty.Value, zcl.Diagnostics) {
Severity: zcl.DiagError,
Summary: "Operation failed",
Detail: fmt.Sprintf("Error during operation: %s.", err),
Subject: e.Val.Range().Ptr(),
Context: &e.SrcRange,
Subject: &e.SrcRange,
})
return cty.UnknownVal(e.Op.Type), diags
}