internal/core/adt: add path location for majority of errors
Change-Id: I8a7b19851af88ecd09ae9032d659ade3570b73e3
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6650
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/internal/core/validate/validate_test.go b/internal/core/validate/validate_test.go
index ab70286..4813ef5 100644
--- a/internal/core/validate/validate_test.go
+++ b/internal/core/validate/validate_test.go
@@ -42,7 +42,7 @@
#foo: { use: string }
`,
lookup: "#foo",
- out: "incomplete\nincomplete value string",
+ out: "incomplete\n#foo.use: incomplete value string",
}, {
desc: "definitions not considered for completeness",
cfg: &Config{Concrete: true},
@@ -71,14 +71,14 @@
in: `
x: 1 & 2
`,
- out: "eval\nincompatible values 2 and 1",
+ out: "eval\nx: incompatible values 2 and 1",
}, {
desc: "first error",
in: `
x: 1 & 2
y: 2 & 4
`,
- out: "eval\nincompatible values 2 and 1",
+ out: "eval\nx: incompatible values 2 and 1",
}, {
desc: "all errors",
cfg: &Config{AllErrors: true},
@@ -87,8 +87,8 @@
y: 2 & 4
`,
out: `eval
-incompatible values 2 and 1
-incompatible values 4 and 2`,
+x: incompatible values 2 and 1
+y: incompatible values 4 and 2`,
}, {
desc: "incomplete",
cfg: &Config{Concrete: true},
@@ -96,7 +96,7 @@
y: 2 + x
x: string
`,
- out: "incomplete\nnon-concrete value string in operand to +:\n test:2:6",
+ out: "incomplete\ny: non-concrete value string in operand to +:\n test:2:6",
}, {
desc: "allowed incomplete cycle",
in: `
@@ -142,7 +142,7 @@
y: string
x: 1 & 2
`,
- out: "eval\nincompatible values 2 and 1",
+ out: "eval\nx: incompatible values 2 and 1",
}}
r := runtime.New()
@@ -163,7 +163,7 @@
v = v.Lookup(adt.MakeIdentLabel(r, tc.lookup))
}
- b := Validate(r, v, tc.cfg)
+ b := Validate(ctx, v, tc.cfg)
w := &strings.Builder{}
if b != nil {