cue: delay evaluation of args in bottom
Change-Id: I72ec254756e075f37e95b8db5529b9870a7594e6
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2212
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/cue/ast.go b/cue/ast.go
index 15e6212..c0e93f8 100644
--- a/cue/ast.go
+++ b/cue/ast.go
@@ -126,12 +126,9 @@
func (v *astVisitor) errf(n ast.Node, format string, args ...interface{}) evaluated {
v.astState.errors.Add(&nodeError{
- path: v.appendPath(nil),
- n: n,
- Message: errors.Message{
- Format: format,
- Args: args,
- },
+ path: v.appendPath(nil),
+ n: n,
+ Message: errors.NewMessage(format, args),
})
arguments := append([]interface{}{format}, args...)
return v.mkErr(newNode(n), arguments...)
@@ -460,7 +457,7 @@
case *ast.BottomLit:
// TODO: record inline comment.
- value = &bottom{baseValue: newExpr(n), msg: "from source"}
+ value = &bottom{baseValue: newExpr(n), format: "from source"}
case *ast.BadDecl:
// nothing to do