cue/errors: always add error
If this is a duplicate, it will be removed later.
Change-Id: I2a20418e2a8c4bcd7042a543f69082298212b99f
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2541
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/ast.go b/cue/ast.go
index d64a5af..c6a7c7d 100644
--- a/cue/ast.go
+++ b/cue/ast.go
@@ -45,11 +45,9 @@
// inserting. For now, we accept errors that did not make it up to the tree.
result := v.walk(f)
if isBottom(result) {
- if v.errors != nil {
- return v.errors
- }
- v := newValueRoot(v.ctx(), result)
- return v.toErr(result.(*bottom))
+ val := newValueRoot(v.ctx(), result)
+ v.errors = errors.Append(v.errors, val.toErr(result.(*bottom)))
+ return v.errors
}
return nil