cue: move field name to end of error message
This avoid ambiguities for certain field names.
Fixes #956
Change-Id: Ia6009da4354efcd2aef7756528d50eaac8eb5bd3
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9723
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cmd/cue/cmd/testdata/script/vet_embed.txt b/cmd/cue/cmd/testdata/script/vet_embed.txt
index 9b4a60a..0e69793 100644
--- a/cmd/cue/cmd/testdata/script/vet_embed.txt
+++ b/cmd/cue/cmd/testdata/script/vet_embed.txt
@@ -31,19 +31,19 @@
e: 2
-- expect-foo --
-field c not allowed:
+field not allowed: c:
./foo.yaml:2:2
./schema.cue:1:1
./schema.cue:3:7
./schema.cue:7:1
-- expect-stream --
-field d not allowed:
+field not allowed: d:
./schema.cue:1:1
./schema.cue:3:7
./schema.cue:7:1
./stream.yaml:2:2
-- expect-stream --
-field d not allowed:
+field not allowed: d:
./schema.cue:1:1
./schema.cue:3:7
./schema.cue:7:1
diff --git a/cmd/cue/cmd/testdata/script/vet_expr.txt b/cmd/cue/cmd/testdata/script/vet_expr.txt
index 9ce3349..29d9e0a 100644
--- a/cmd/cue/cmd/testdata/script/vet_expr.txt
+++ b/cmd/cue/cmd/testdata/script/vet_expr.txt
@@ -3,7 +3,7 @@
-- expect-stderr --
translations.hello.lang: incomplete value string
-field skip not allowed:
+field not allowed: skip:
./data.yaml:20:1
./vet.cue:1:1
./vet.cue:1:8
diff --git a/cue/testdata/builtins/closed.txtar b/cue/testdata/builtins/closed.txtar
index e53e66d..1153a07 100644
--- a/cue/testdata/builtins/closed.txtar
+++ b/cue/testdata/builtins/closed.txtar
@@ -44,7 +44,7 @@
-- out/eval --
Errors:
-b: field x not allowed:
+b: field not allowed: x:
./in.cue:1:10
./in.cue:5:4
./in.cue:5:10
@@ -63,7 +63,7 @@
b: (int){ int }
}
x: (_|_){
- // [eval] b: field x not allowed:
+ // [eval] b: field not allowed: x:
// ./in.cue:1:10
// ./in.cue:5:4
// ./in.cue:5:10
diff --git a/cue/testdata/builtins/issue490.txtar b/cue/testdata/builtins/issue490.txtar
index 342c939..10780fe 100644
--- a/cue/testdata/builtins/issue490.txtar
+++ b/cue/testdata/builtins/issue490.txtar
@@ -9,7 +9,7 @@
}
-- out/eval --
Errors:
-B: field c not allowed:
+B: field not allowed: c:
./test.cue:1:10
./test.cue:6:4
./test.cue:7:2
@@ -26,7 +26,7 @@
a: (int){ 1 }
b: (int){ 2 }
c: (_|_){
- // [eval] B: field c not allowed:
+ // [eval] B: field not allowed: c:
// ./test.cue:1:10
// ./test.cue:6:4
// ./test.cue:7:2
diff --git a/cue/testdata/comprehensions/issue293.txtar b/cue/testdata/comprehensions/issue293.txtar
index 1072d23..187f29f 100644
--- a/cue/testdata/comprehensions/issue293.txtar
+++ b/cue/testdata/comprehensions/issue293.txtar
@@ -26,7 +26,7 @@
t: p: "foo"
-- out/eval --
Errors:
-z.x: field f2 not allowed:
+z.x: field not allowed: f2:
./in.cue:2:2
./in.cue:5:12
./in.cue:11:4
@@ -46,7 +46,7 @@
// [eval]
f1: (int){ 99 }
f2: (_|_){
- // [eval] z.x: field f2 not allowed:
+ // [eval] z.x: field not allowed: f2:
// ./in.cue:2:2
// ./in.cue:5:12
// ./in.cue:11:4
diff --git a/cue/testdata/cycle/compbottom2.txtar b/cue/testdata/cycle/compbottom2.txtar
index 13fc773..18569a5 100644
--- a/cue/testdata/cycle/compbottom2.txtar
+++ b/cue/testdata/cycle/compbottom2.txtar
@@ -148,12 +148,12 @@
}
-- out/eval --
Errors:
-mutual.mutualCycleFail.a: cycle: new field bar inserted by if clause that was previously evaluated by another if clause
-mutual.oneDirectionalConflictFail.p1.a: cycle: new field bar inserted by if clause that was previously evaluated by another if clause
-mutual.oneDirectionalConflictFail.p2.b: cycle: new field foo inserted by if clause that was previously evaluated by another if clause
-nestedChain.cycleFail.#E: cycle: new field x inserted by if clause that was previously evaluated by another if clause
-sameStruct.cycleFail: cycle: new field raises inserted by if clause that was previously evaluated by another if clause
-self.fail.a: cycle: new field b inserted by if clause that was previously evaluated by another if clause
+mutual.mutualCycleFail.a: cycle: field inserted by if clause that was previously evaluated by another if clause: bar
+mutual.oneDirectionalConflictFail.p1.a: cycle: field inserted by if clause that was previously evaluated by another if clause: bar
+mutual.oneDirectionalConflictFail.p2.b: cycle: field inserted by if clause that was previously evaluated by another if clause: foo
+nestedChain.cycleFail.#E: cycle: field inserted by if clause that was previously evaluated by another if clause: x
+sameStruct.cycleFail: cycle: field inserted by if clause that was previously evaluated by another if clause: raises
+self.fail.a: cycle: field inserted by if clause that was previously evaluated by another if clause: b
Result:
(_|_){
@@ -163,7 +163,7 @@
fail: (_|_){
// [eval]
a: (_|_){
- // [eval] self.fail.a: cycle: new field b inserted by if clause that was previously evaluated by another if clause
+ // [eval] self.fail.a: cycle: field inserted by if clause that was previously evaluated by another if clause: b
b: (int){ 1 }
}
}
@@ -193,7 +193,7 @@
b: (struct){
}
a: (_|_){
- // [eval] mutual.mutualCycleFail.a: cycle: new field bar inserted by if clause that was previously evaluated by another if clause
+ // [eval] mutual.mutualCycleFail.a: cycle: field inserted by if clause that was previously evaluated by another if clause: bar
bar: (string){ "" }
}
}
@@ -210,7 +210,7 @@
p1: (_|_){
// [eval]
a: (_|_){
- // [eval] mutual.oneDirectionalConflictFail.p1.a: cycle: new field bar inserted by if clause that was previously evaluated by another if clause
+ // [eval] mutual.oneDirectionalConflictFail.p1.a: cycle: field inserted by if clause that was previously evaluated by another if clause: bar
bar: (string){ "" }
}
b: (struct){
@@ -222,7 +222,7 @@
a: (struct){
}
b: (_|_){
- // [eval] mutual.oneDirectionalConflictFail.p2.b: cycle: new field foo inserted by if clause that was previously evaluated by another if clause
+ // [eval] mutual.oneDirectionalConflictFail.p2.b: cycle: field inserted by if clause that was previously evaluated by another if clause: foo
foo: (string){ "" }
}
}
@@ -247,7 +247,7 @@
}
}
cycleFail: (_|_){
- // [eval] sameStruct.cycleFail: cycle: new field raises inserted by if clause that was previously evaluated by another if clause
+ // [eval] sameStruct.cycleFail: cycle: field inserted by if clause that was previously evaluated by another if clause: raises
ret: (struct){
a: (int){ 1 }
}
@@ -268,7 +268,7 @@
cycleFail: (_|_){
// [eval]
#E: (_|_){
- // [eval] nestedChain.cycleFail.#E: cycle: new field x inserted by if clause that was previously evaluated by another if clause
+ // [eval] nestedChain.cycleFail.#E: cycle: field inserted by if clause that was previously evaluated by another if clause: x
x: (bool){ true }
}
}
diff --git a/cue/testdata/cycle/compbottomnofinal.txtar b/cue/testdata/cycle/compbottomnofinal.txtar
index 57a02e8..7153f25 100644
--- a/cue/testdata/cycle/compbottomnofinal.txtar
+++ b/cue/testdata/cycle/compbottomnofinal.txtar
@@ -359,18 +359,18 @@
}
-- out/eval --
Errors:
-large.p1.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
-large.p2.#Y: cycle: field userinfo was added after an if clause evaluated it
-large.p2.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
-large.p3.#Y: cycle: field userinfo was added after an if clause evaluated it
-large.p3.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
-large.p4.#Y: cycle: field userinfo was added after an if clause evaluated it
-medium.p1.#Y: cycle: field port was added after an if clause evaluated it
-medium.p2.#Y: cycle: field port was added after an if clause evaluated it
-medium.p3.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
-medium.p4.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
-minimal.b: cycle: new field port inserted by if clause that was previously evaluated by another if clause
-small.p1.#Y: cycle: field port was added after an if clause evaluated it
+large.p1.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
+large.p2.#Y: cycle: field was added after an if clause evaluated it: userinfo
+large.p2.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
+large.p3.#Y: cycle: field was added after an if clause evaluated it: userinfo
+large.p3.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
+large.p4.#Y: cycle: field was added after an if clause evaluated it: userinfo
+medium.p1.#Y: cycle: field was added after an if clause evaluated it: port
+medium.p2.#Y: cycle: field was added after an if clause evaluated it: port
+medium.p3.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
+medium.p4.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
+minimal.b: cycle: field inserted by if clause that was previously evaluated by another if clause: port
+small.p1.#Y: cycle: field was added after an if clause evaluated it: port
error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax:
./in.cue:104:23
error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax:
@@ -390,7 +390,7 @@
a: (struct){
}
b: (_|_){
- // [eval] minimal.b: cycle: new field port inserted by if clause that was previously evaluated by another if clause
+ // [eval] minimal.b: cycle: field inserted by if clause that was previously evaluated by another if clause: port
port: (string){ "" }
}
}
@@ -400,7 +400,7 @@
p1: (_|_){
// [eval]
#Y: (_|_){
- // [eval] small.p1.#Y: cycle: field port was added after an if clause evaluated it
+ // [eval] small.p1.#Y: cycle: field was added after an if clause evaluated it: port
port: (string){ "" }
}
#X: (#struct){
@@ -424,7 +424,7 @@
p1: (_|_){
// [eval]
#Y: (_|_){
- // [eval] medium.p1.#Y: cycle: field port was added after an if clause evaluated it
+ // [eval] medium.p1.#Y: cycle: field was added after an if clause evaluated it: port
port: (string){ "" }
}
Y: (struct){
@@ -436,7 +436,7 @@
p2: (_|_){
// [eval]
#Y: (_|_){
- // [eval] medium.p2.#Y: cycle: field port was added after an if clause evaluated it
+ // [eval] medium.p2.#Y: cycle: field was added after an if clause evaluated it: port
port: (string){ "" }
}
#X: (#struct){
@@ -448,7 +448,7 @@
p3: (_|_){
// [eval]
Y: (_|_){
- // [eval] medium.p3.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
+ // [eval] medium.p3.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
port: (_|_){
// [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax:
// ./in.cue:104:23
@@ -464,7 +464,7 @@
p4: (_|_){
// [eval]
Y: (_|_){
- // [eval] medium.p4.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
+ // [eval] medium.p4.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
port: (_|_){
// [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax:
// ./in.cue:126:23
@@ -508,7 +508,7 @@
p1: (_|_){
// [eval]
Y: (_|_){
- // [eval] large.p1.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
+ // [eval] large.p1.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
userinfo: (string){ "user" }
host: (string){ "example.com" }
port: (_|_){
@@ -532,7 +532,7 @@
// [eval]
X: (string){ "user@example.com" }
Y: (_|_){
- // [eval] large.p2.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
+ // [eval] large.p2.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
userinfo: (string){ "user" }
host: (string){ "example.com" }
port: (_|_){
@@ -546,7 +546,7 @@
port: (string){ "" }
}
#Y: (_|_){
- // [eval] large.p2.#Y: cycle: field userinfo was added after an if clause evaluated it
+ // [eval] large.p2.#Y: cycle: field was added after an if clause evaluated it: userinfo
host: (string){ "example.com" }
port: (string){ "" }
userinfo: (string){ "user" }
@@ -561,7 +561,7 @@
port: (string){ "" }
}
Y: (_|_){
- // [eval] large.p3.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause
+ // [eval] large.p3.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port
userinfo: (string){ "user" }
host: (string){ "example.com" }
port: (_|_){
@@ -570,7 +570,7 @@
}
}
#Y: (_|_){
- // [eval] large.p3.#Y: cycle: field userinfo was added after an if clause evaluated it
+ // [eval] large.p3.#Y: cycle: field was added after an if clause evaluated it: userinfo
host: (string){ "example.com" }
port: (string){ "" }
userinfo: (string){ "user" }
@@ -585,7 +585,7 @@
port: (string){ "" }
}
#Y: (_|_){
- // [eval] large.p4.#Y: cycle: field userinfo was added after an if clause evaluated it
+ // [eval] large.p4.#Y: cycle: field was added after an if clause evaluated it: userinfo
host: (string){ "example.com" }
port: (string){ "" }
userinfo: (string){ "user" }
@@ -594,7 +594,7 @@
// [eval]
userinfo: (string){ "user" }
host: (_|_){
- // [eval] large.p4.#Y: cycle: field userinfo was added after an if clause evaluated it
+ // [eval] large.p4.#Y: cycle: field was added after an if clause evaluated it: userinfo
}
}
}
diff --git a/cue/testdata/definitions/026_combined_definitions.txtar b/cue/testdata/definitions/026_combined_definitions.txtar
index 68e3d48..f0c7cd0 100644
--- a/cue/testdata/definitions/026_combined_definitions.txtar
+++ b/cue/testdata/definitions/026_combined_definitions.txtar
@@ -118,11 +118,11 @@
}
-- out/eval --
Errors:
-#D4.env: field b not allowed:
+#D4.env: field not allowed: b:
./in.cue:26:7
./in.cue:27:7
./in.cue:30:6
-d1.env: field c not allowed:
+d1.env: field not allowed: c:
./in.cue:3:7
./in.cue:4:7
./in.cue:9:5
@@ -148,7 +148,7 @@
a: (string){ "A" }
b: (string){ "B" }
c: (_|_){
- // [eval] d1.env: field c not allowed:
+ // [eval] d1.env: field not allowed: c:
// ./in.cue:3:7
// ./in.cue:4:7
// ./in.cue:9:5
@@ -176,7 +176,7 @@
// [eval]
a: (int){ int }
b: (_|_){
- // [eval] #D4.env: field b not allowed:
+ // [eval] #D4.env: field not allowed: b:
// ./in.cue:26:7
// ./in.cue:27:7
// ./in.cue:30:6
diff --git a/cue/testdata/definitions/032_definitions_with_embedding.txtar b/cue/testdata/definitions/032_definitions_with_embedding.txtar
index 7f0703c..2d7ecdb 100644
--- a/cue/testdata/definitions/032_definitions_with_embedding.txtar
+++ b/cue/testdata/definitions/032_definitions_with_embedding.txtar
@@ -81,7 +81,7 @@
}
-- out/eval --
Errors:
-#e1.a: field d not allowed:
+#e1.a: field not allowed: d:
./in.cue:2:5
./in.cue:6:2
./in.cue:7:5
@@ -110,7 +110,7 @@
b: (int){ int }
c: (int){ int }
d: (_|_){
- // [eval] #e1.a: field d not allowed:
+ // [eval] #e1.a: field not allowed: d:
// ./in.cue:2:5
// ./in.cue:6:2
// ./in.cue:7:5
diff --git "a/cue/testdata/definitions/033_Issue_\043153.txtar" "b/cue/testdata/definitions/033_Issue_\043153.txtar"
index f527be0..c850069 100644
--- "a/cue/testdata/definitions/033_Issue_\043153.txtar"
+++ "b/cue/testdata/definitions/033_Issue_\043153.txtar"
@@ -62,7 +62,7 @@
}
-- out/eval --
Errors:
-listOfCloseds.0: field b not allowed:
+listOfCloseds.0: field not allowed: b:
./in.cue:2:21
./in.cue:5:10
./in.cue:13:1
@@ -79,7 +79,7 @@
// [eval]
a: (int){ |(*(int){ 0 }, (int){ int }) }
b: (_|_){
- // [eval] listOfCloseds.0: field b not allowed:
+ // [eval] listOfCloseds.0: field not allowed: b:
// ./in.cue:2:21
// ./in.cue:5:10
// ./in.cue:13:1
diff --git a/cue/testdata/definitions/037_closing_with_comprehensions.txtar b/cue/testdata/definitions/037_closing_with_comprehensions.txtar
index 3be82c8..c0d9502 100644
--- a/cue/testdata/definitions/037_closing_with_comprehensions.txtar
+++ b/cue/testdata/definitions/037_closing_with_comprehensions.txtar
@@ -104,13 +104,13 @@
}
-- out/eval --
Errors:
-#E: field f3 not allowed:
+#E: field not allowed: f3:
./in.cue:1:5
./in.cue:27:5
./in.cue:27:10
./in.cue:28:2
./in.cue:29:3
-a: field f3 not allowed:
+a: field not allowed: f3:
./in.cue:1:5
./in.cue:3:1
./in.cue:4:5
@@ -137,7 +137,7 @@
f1: (int){ int }
f2: (int){ int }
f3: (_|_){
- // [eval] #E: field f3 not allowed:
+ // [eval] #E: field not allowed: f3:
// ./in.cue:1:5
// ./in.cue:27:5
// ./in.cue:27:10
@@ -150,7 +150,7 @@
f1: (int){ int }
f2: (int){ int }
f3: (_|_){
- // [eval] a: field f3 not allowed:
+ // [eval] a: field not allowed: f3:
// ./in.cue:1:5
// ./in.cue:3:1
// ./in.cue:4:5
diff --git a/cue/testdata/definitions/037_conjunction_of_optional_sets.txtar b/cue/testdata/definitions/037_conjunction_of_optional_sets.txtar
index b57c59c..2562d6b 100644
--- a/cue/testdata/definitions/037_conjunction_of_optional_sets.txtar
+++ b/cue/testdata/definitions/037_conjunction_of_optional_sets.txtar
@@ -52,14 +52,14 @@
}
-- out/eval --
Errors:
-c: field aaa not allowed:
+c: field not allowed: aaa:
./in.cue:2:2
./in.cue:4:5
./in.cue:8:5
./in.cue:8:10
./in.cue:9:5
./in.cue:9:11
-d: field aaa not allowed:
+d: field not allowed: aaa:
./in.cue:2:2
./in.cue:4:5
./in.cue:11:5
@@ -80,7 +80,7 @@
c: (_|_){
// [eval]
aaa: (_|_){
- // [eval] c: field aaa not allowed:
+ // [eval] c: field not allowed: aaa:
// ./in.cue:2:2
// ./in.cue:4:5
// ./in.cue:8:5
@@ -94,7 +94,7 @@
d: (_|_){
// [eval]
aaa: (_|_){
- // [eval] d: field aaa not allowed:
+ // [eval] d: field not allowed: aaa:
// ./in.cue:2:2
// ./in.cue:4:5
// ./in.cue:11:5
diff --git a/cue/testdata/definitions/038_continue_recursive_closing_for_optionals.txtar b/cue/testdata/definitions/038_continue_recursive_closing_for_optionals.txtar
index eb965c8..da1648a 100644
--- a/cue/testdata/definitions/038_continue_recursive_closing_for_optionals.txtar
+++ b/cue/testdata/definitions/038_continue_recursive_closing_for_optionals.txtar
@@ -38,7 +38,7 @@
}
-- out/eval --
Errors:
-a.v: field b not allowed:
+a.v: field not allowed: b:
./in.cue:2:12
./in.cue:4:4
./in.cue:5:6
@@ -53,7 +53,7 @@
v: (_|_){
// [eval]
b: (_|_){
- // [eval] a.v: field b not allowed:
+ // [eval] a.v: field not allowed: b:
// ./in.cue:2:12
// ./in.cue:4:4
// ./in.cue:5:6
diff --git a/cue/testdata/definitions/defembed.txtar b/cue/testdata/definitions/defembed.txtar
index 9952d67..eb94b02 100644
--- a/cue/testdata/definitions/defembed.txtar
+++ b/cue/testdata/definitions/defembed.txtar
@@ -8,7 +8,7 @@
#A: b: 1
-- out/eval --
Errors:
-a: field c not allowed:
+a: field not allowed: c:
./in.cue:1:4
./in.cue:2:5
./in.cue:5:4
@@ -21,7 +21,7 @@
// [eval]
b: (int){ 1 }
c: (_|_){
- // [eval] a: field c not allowed:
+ // [eval] a: field not allowed: c:
// ./in.cue:1:4
// ./in.cue:2:5
// ./in.cue:5:4
diff --git a/cue/testdata/definitions/embed.txtar b/cue/testdata/definitions/embed.txtar
index f76002f..15167cc 100644
--- a/cue/testdata/definitions/embed.txtar
+++ b/cue/testdata/definitions/embed.txtar
@@ -76,11 +76,11 @@
-- out/eval --
Errors:
-reclose1.z: field d not allowed:
+reclose1.z: field not allowed: d:
./in.cue:28:8
./in.cue:33:6
./in.cue:34:6
-recloseSimple.a: field b not allowed:
+recloseSimple.a: field not allowed: b:
./in.cue:16:9
./in.cue:17:6
./in.cue:17:7
@@ -113,7 +113,7 @@
a: (_|_){
// [eval]
b: (_|_){
- // [eval] recloseSimple.a: field b not allowed:
+ // [eval] recloseSimple.a: field not allowed: b:
// ./in.cue:16:9
// ./in.cue:17:6
// ./in.cue:17:7
@@ -138,7 +138,7 @@
// [eval]
c: (int){ int }
d: (_|_){
- // [eval] reclose1.z: field d not allowed:
+ // [eval] reclose1.z: field not allowed: d:
// ./in.cue:28:8
// ./in.cue:33:6
// ./in.cue:34:6
diff --git a/cue/testdata/definitions/hidden.txtar b/cue/testdata/definitions/hidden.txtar
index ae398ac..399e55b 100644
--- a/cue/testdata/definitions/hidden.txtar
+++ b/cue/testdata/definitions/hidden.txtar
@@ -35,7 +35,7 @@
-- out/eval --
Errors:
-e._name: field c not allowed:
+e._name: field not allowed: c:
./in.cue:6:10
./in.cue:13:13
./in.cue:16:10
@@ -68,7 +68,7 @@
// [eval]
d: (int){ int }
c: (_|_){
- // [eval] e._name: field c not allowed:
+ // [eval] e._name: field not allowed: c:
// ./in.cue:6:10
// ./in.cue:13:13
// ./in.cue:16:10
diff --git a/cue/testdata/definitions/issue271.txtar b/cue/testdata/definitions/issue271.txtar
index b88e44d..63cecf2 100644
--- a/cue/testdata/definitions/issue271.txtar
+++ b/cue/testdata/definitions/issue271.txtar
@@ -8,7 +8,7 @@
}
-- out/eval --
Errors:
-x: field b not allowed:
+x: field not allowed: b:
./in.cue:1:5
./in.cue:2:11
./in.cue:3:4
@@ -24,7 +24,7 @@
// [eval]
a: (string){ "hello" }
b: (_|_){
- // [eval] x: field b not allowed:
+ // [eval] x: field not allowed: b:
// ./in.cue:1:5
// ./in.cue:2:11
// ./in.cue:3:4
diff --git a/cue/testdata/definitions/issue320.txtar b/cue/testdata/definitions/issue320.txtar
index f3c144c..ef7fc05 100644
--- a/cue/testdata/definitions/issue320.txtar
+++ b/cue/testdata/definitions/issue320.txtar
@@ -12,7 +12,7 @@
}
-- out/eval --
Errors:
-foo: field y not allowed:
+foo: field not allowed: y:
./in.cue:1:7
./in.cue:3:2
./in.cue:6:8
@@ -31,7 +31,7 @@
// [eval]
x: (string){ "hello" }
y: (_|_){
- // [eval] foo: field y not allowed:
+ // [eval] foo: field not allowed: y:
// ./in.cue:1:7
// ./in.cue:3:2
// ./in.cue:6:8
diff --git a/cue/testdata/definitions/issue533.txtar b/cue/testdata/definitions/issue533.txtar
index 5db9de5..1832f44 100644
--- a/cue/testdata/definitions/issue533.txtar
+++ b/cue/testdata/definitions/issue533.txtar
@@ -20,11 +20,11 @@
}
-- out/eval --
Errors:
-x1: field Age not allowed:
+x1: field not allowed: Age:
./in.cue:3:5
./in.cue:11:5
./in.cue:13:2
-x2: field Age not allowed:
+x2: field not allowed: Age:
./in.cue:7:6
./in.cue:16:5
./in.cue:18:2
@@ -42,7 +42,7 @@
// [eval]
Name: (string){ "hello" }
Age: (_|_){
- // [eval] x1: field Age not allowed:
+ // [eval] x1: field not allowed: Age:
// ./in.cue:3:5
// ./in.cue:11:5
// ./in.cue:13:2
@@ -52,7 +52,7 @@
// [eval]
Name: (string){ "hello" }
Age: (_|_){
- // [eval] x2: field Age not allowed:
+ // [eval] x2: field not allowed: Age:
// ./in.cue:7:6
// ./in.cue:16:5
// ./in.cue:18:2
diff --git a/cue/testdata/disjunctions/errors.txtar b/cue/testdata/disjunctions/errors.txtar
index cddde7f..8b84c0d 100644
--- a/cue/testdata/disjunctions/errors.txtar
+++ b/cue/testdata/disjunctions/errors.txtar
@@ -35,16 +35,16 @@
-- out/eval --
Errors:
issue516.x: 2 errors in empty disjunction:
-issue516.x: field match not allowed:
+issue516.x: field not allowed: match:
./in.cue:20:9
./in.cue:22:8
./in.cue:23:8
-issue516.x.match.metrics: field foo not allowed:
+issue516.x.match.metrics: field not allowed: foo:
./in.cue:19:25
./in.cue:22:8
./in.cue:23:24
issue570.results: 2 errors in empty disjunction:
-issue570.results: field result not allowed:
+issue570.results: field not allowed: result:
./in.cue:2:14
./in.cue:3:14
./in.cue:7:9
@@ -62,7 +62,7 @@
// [eval]
results: (_|_){
// [eval] issue570.results: 2 errors in empty disjunction:
- // issue570.results: field result not allowed:
+ // issue570.results: field not allowed: result:
// ./in.cue:2:14
// ./in.cue:3:14
// ./in.cue:7:9
@@ -73,7 +73,7 @@
// ./in.cue:3:22
// ./in.cue:12:18
result: (_|_){
- // [eval] issue570.results: field result not allowed:
+ // [eval] issue570.results: field not allowed: result:
// ./in.cue:2:14
// ./in.cue:3:14
// ./in.cue:7:9
@@ -107,16 +107,16 @@
}) }
x: (_|_){
// [eval] issue516.x: 2 errors in empty disjunction:
- // issue516.x: field match not allowed:
+ // issue516.x: field not allowed: match:
// ./in.cue:20:9
// ./in.cue:22:8
// ./in.cue:23:8
- // issue516.x.match.metrics: field foo not allowed:
+ // issue516.x.match.metrics: field not allowed: foo:
// ./in.cue:19:25
// ./in.cue:22:8
// ./in.cue:23:24
match: (_|_){
- // [eval] issue516.x: field match not allowed:
+ // [eval] issue516.x: field not allowed: match:
// ./in.cue:20:9
// ./in.cue:22:8
// ./in.cue:23:8
diff --git a/cue/testdata/eval/bulk.txtar b/cue/testdata/eval/bulk.txtar
index b533f24..4731198 100644
--- a/cue/testdata/eval/bulk.txtar
+++ b/cue/testdata/eval/bulk.txtar
@@ -30,11 +30,11 @@
-- out/eval --
Errors:
-t1.c: field z not allowed:
+t1.c: field not allowed: z:
./in.cue:15:7
./in.cue:19:6
./in.cue:19:13
-t2.c: field z not allowed:
+t2.c: field not allowed: z:
./in.cue:23:7
./in.cue:27:6
./in.cue:27:13
@@ -71,7 +71,7 @@
c: (_|_){
// [eval]
z: (_|_){
- // [eval] t1.c: field z not allowed:
+ // [eval] t1.c: field not allowed: z:
// ./in.cue:15:7
// ./in.cue:19:6
// ./in.cue:19:13
@@ -88,7 +88,7 @@
c: (_|_){
// [eval]
z: (_|_){
- // [eval] t2.c: field z not allowed:
+ // [eval] t2.c: field not allowed: z:
// ./in.cue:23:7
// ./in.cue:27:6
// ./in.cue:27:13
diff --git a/cue/testdata/eval/closed_disjunction.txtar b/cue/testdata/eval/closed_disjunction.txtar
index 397f6e8..ea34b43 100644
--- a/cue/testdata/eval/closed_disjunction.txtar
+++ b/cue/testdata/eval/closed_disjunction.txtar
@@ -16,13 +16,13 @@
-- out/eval --
Errors:
b: 2 errors in empty disjunction:
-b: field c not allowed:
+b: field not allowed: c:
./in.cue:1:5
./in.cue:3:5
./in.cue:3:6
./in.cue:11:4
./in.cue:12:5
-b: field d not allowed:
+b: field not allowed: d:
./in.cue:1:5
./in.cue:3:5
./in.cue:3:11
@@ -43,20 +43,20 @@
}
b: (_|_){
// [eval] b: 2 errors in empty disjunction:
- // b: field c not allowed:
+ // b: field not allowed: c:
// ./in.cue:1:5
// ./in.cue:3:5
// ./in.cue:3:6
// ./in.cue:11:4
// ./in.cue:12:5
- // b: field d not allowed:
+ // b: field not allowed: d:
// ./in.cue:1:5
// ./in.cue:3:5
// ./in.cue:3:11
// ./in.cue:11:4
// ./in.cue:13:5
c: (_|_){
- // [eval] b: field c not allowed:
+ // [eval] b: field not allowed: c:
// ./in.cue:1:5
// ./in.cue:3:5
// ./in.cue:3:35
@@ -64,7 +64,7 @@
// ./in.cue:12:5
}
d: (_|_){
- // [eval] b: field d not allowed:
+ // [eval] b: field not allowed: d:
// ./in.cue:1:5
// ./in.cue:3:5
// ./in.cue:3:35
diff --git a/cue/testdata/eval/closedness.txtar b/cue/testdata/eval/closedness.txtar
index 7ebbe64..3c7ba0f 100644
--- a/cue/testdata/eval/closedness.txtar
+++ b/cue/testdata/eval/closedness.txtar
@@ -37,13 +37,13 @@
-- out/eval --
Errors:
-a.q: field e not allowed:
+a.q: field not allowed: e:
./in.cue:1:5
./in.cue:6:8
./in.cue:7:9
./in.cue:11:4
./in.cue:15:9
-issue852.a: field Foo not allowed:
+issue852.a: field not allowed: Foo:
./in.cue:22:7
./in.cue:26:6
./in.cue:28:6
@@ -69,7 +69,7 @@
c: (int){ 2 }
d: (int){ int }
e: (_|_){
- // [eval] a.q: field e not allowed:
+ // [eval] a.q: field not allowed: e:
// ./in.cue:1:5
// ./in.cue:6:8
// ./in.cue:7:9
@@ -85,7 +85,7 @@
a: (_|_){
// [eval]
Foo: (_|_){
- // [eval] issue852.a: field Foo not allowed:
+ // [eval] issue852.a: field not allowed: Foo:
// ./in.cue:22:7
// ./in.cue:26:6
// ./in.cue:28:6
diff --git a/cue/testdata/fulleval/035_optionals_with_label_filters.txtar b/cue/testdata/fulleval/035_optionals_with_label_filters.txtar
index 6b90b91..61f4bd6 100644
--- a/cue/testdata/fulleval/035_optionals_with_label_filters.txtar
+++ b/cue/testdata/fulleval/035_optionals_with_label_filters.txtar
@@ -102,13 +102,13 @@
}
-- out/eval --
Errors:
-jobs1: field foo1 not allowed:
+jobs1: field not allowed: foo1:
./in.cue:6:8
./in.cue:7:2
./in.cue:9:2
./in.cue:15:17
./in.cue:16:8
-jobs3: field fooTest1 not allowed:
+jobs3: field not allowed: fooTest1:
./in.cue:6:8
./in.cue:7:2
./in.cue:9:2
@@ -137,7 +137,7 @@
jobs1: (_|_){
// [eval]
foo1: (_|_){
- // [eval] jobs1: field foo1 not allowed:
+ // [eval] jobs1: field not allowed: foo1:
// ./in.cue:6:8
// ./in.cue:7:2
// ./in.cue:9:2
@@ -160,7 +160,7 @@
jobs3: (_|_){
// [eval]
fooTest1: (_|_){
- // [eval] jobs3: field fooTest1 not allowed:
+ // [eval] jobs3: field not allowed: fooTest1:
// ./in.cue:6:8
// ./in.cue:7:2
// ./in.cue:9:2
diff --git a/cue/testdata/resolve/025_definitions.txtar b/cue/testdata/resolve/025_definitions.txtar
index 52340ce..804669b 100644
--- a/cue/testdata/resolve/025_definitions.txtar
+++ b/cue/testdata/resolve/025_definitions.txtar
@@ -119,11 +119,11 @@
}
-- out/eval --
Errors:
-foo: field feild not allowed:
+foo: field not allowed: feild:
./in.cue:1:7
./in.cue:12:6
./in.cue:13:7
-foo1.recursive: field feild not allowed:
+foo1.recursive: field not allowed: feild:
./in.cue:3:13
./in.cue:15:7
./in.cue:19:3
@@ -148,7 +148,7 @@
field: (string){ string }
}
feild: (_|_){
- // [eval] foo: field feild not allowed:
+ // [eval] foo: field not allowed: feild:
// ./in.cue:1:7
// ./in.cue:12:6
// ./in.cue:13:7
@@ -161,7 +161,7 @@
// [eval]
field: (string){ string }
feild: (_|_){
- // [eval] foo1.recursive: field feild not allowed:
+ // [eval] foo1.recursive: field not allowed: feild:
// ./in.cue:3:13
// ./in.cue:15:7
// ./in.cue:19:3
diff --git a/cue/testdata/resolve/029_non-closed_definition_carries_over_closedness_to_enclosed_template.txtar b/cue/testdata/resolve/029_non-closed_definition_carries_over_closedness_to_enclosed_template.txtar
index 8252f79..64df57d 100644
--- a/cue/testdata/resolve/029_non-closed_definition_carries_over_closedness_to_enclosed_template.txtar
+++ b/cue/testdata/resolve/029_non-closed_definition_carries_over_closedness_to_enclosed_template.txtar
@@ -104,16 +104,16 @@
}
-- out/eval --
Errors:
-a.v: field b not allowed:
+a.v: field not allowed: b:
./in.cue:2:12
./in.cue:4:4
./in.cue:5:6
b.w: 1 errors in empty disjunction:
-b.w: field c not allowed:
+b.w: field not allowed: c:
./in.cue:8:12
./in.cue:10:4
./in.cue:11:6
-c.w.0: field d not allowed:
+c.w.0: field not allowed: d:
./in.cue:14:12
./in.cue:14:13
./in.cue:16:4
@@ -129,7 +129,7 @@
v: (_|_){
// [eval]
b: (_|_){
- // [eval] a.v: field b not allowed:
+ // [eval] a.v: field not allowed: b:
// ./in.cue:2:12
// ./in.cue:4:4
// ./in.cue:5:6
@@ -143,12 +143,12 @@
// [eval]
w: (_|_){
// [eval] b.w: 1 errors in empty disjunction:
- // b.w: field c not allowed:
+ // b.w: field not allowed: c:
// ./in.cue:8:12
// ./in.cue:10:4
// ./in.cue:11:6
c: (_|_){
- // [eval] b.w: field c not allowed:
+ // [eval] b.w: field not allowed: c:
// ./in.cue:8:12
// ./in.cue:8:23
// ./in.cue:10:4
@@ -166,7 +166,7 @@
0: (_|_){
// [eval]
d: (_|_){
- // [eval] c.w.0: field d not allowed:
+ // [eval] c.w.0: field not allowed: d:
// ./in.cue:14:12
// ./in.cue:14:13
// ./in.cue:16:4
diff --git a/cue/testdata/resolve/030_definitions_with_disjunctions.txtar b/cue/testdata/resolve/030_definitions_with_disjunctions.txtar
index ac29448..dea0346 100644
--- a/cue/testdata/resolve/030_definitions_with_disjunctions.txtar
+++ b/cue/testdata/resolve/030_definitions_with_disjunctions.txtar
@@ -62,7 +62,7 @@
-- out/eval --
Errors:
bar: 1 errors in empty disjunction:
-bar: field c not allowed:
+bar: field not allowed: c:
./in.cue:1:7
./in.cue:4:2
./in.cue:11:6
@@ -84,14 +84,14 @@
}
bar: (_|_){
// [eval] bar: 1 errors in empty disjunction:
- // bar: field c not allowed:
+ // bar: field not allowed: c:
// ./in.cue:1:7
// ./in.cue:4:2
// ./in.cue:11:6
// ./in.cue:12:7
field: (int){ int }
c: (_|_){
- // [eval] bar: field c not allowed:
+ // [eval] bar: field not allowed: c:
// ./in.cue:1:7
// ./in.cue:4:2
// ./in.cue:5:2
diff --git a/cue/testdata/resolve/035_excluded_embedding_from_closing.txtar b/cue/testdata/resolve/035_excluded_embedding_from_closing.txtar
index a7352a2..4ecc16b 100644
--- a/cue/testdata/resolve/035_excluded_embedding_from_closing.txtar
+++ b/cue/testdata/resolve/035_excluded_embedding_from_closing.txtar
@@ -64,12 +64,12 @@
}
-- out/eval --
Errors:
-V.b: field extra not allowed:
+V.b: field not allowed: extra:
./in.cue:6:10
./in.cue:7:5
./in.cue:9:4
./in.cue:11:5
-V.c: field e not allowed:
+V.c: field not allowed: e:
./in.cue:3:2
./in.cue:4:6
./in.cue:9:4
@@ -95,7 +95,7 @@
// [eval]
d: (int){ int }
e: (_|_){
- // [eval] V.c: field e not allowed:
+ // [eval] V.c: field not allowed: e:
// ./in.cue:3:2
// ./in.cue:4:6
// ./in.cue:9:4
@@ -109,7 +109,7 @@
// [eval]
open: (int){ int }
extra: (_|_){
- // [eval] V.b: field extra not allowed:
+ // [eval] V.b: field not allowed: extra:
// ./in.cue:6:10
// ./in.cue:7:5
// ./in.cue:9:4
diff --git a/cue/types.go b/cue/types.go
index 9360ae1..636fe52 100644
--- a/cue/types.go
+++ b/cue/types.go
@@ -1792,7 +1792,7 @@
defer ctx.PopArc(ctx.PushArc(parent))
label := a.Label.SelectorString(ctx)
parent.Accept(ctx, a.Label)
- return ctx.NewErrf("field %s not allowed", label)
+ return ctx.NewErrf("field not allowed: %s", label)
}
}
return nil
diff --git a/cue/types_test.go b/cue/types_test.go
index 88535a5..7208647 100644
--- a/cue/types_test.go
+++ b/cue/types_test.go
@@ -62,7 +62,7 @@
res := runSpec.Unify(v)
return res
},
- want: "_|_ // #runSpec: field ction not allowed",
+ want: "_|_ // #runSpec: field not allowed: ction",
}, {
// Issue #567
input: `
@@ -76,7 +76,7 @@
res := runSpec.Unify(v)
return res
},
- want: "_|_ // #runSpec.action: field Foo not allowed",
+ want: "_|_ // #runSpec.action: field not allowed: Foo",
}, {
input: `
#runSpec: v: {action: foo: int}
@@ -90,7 +90,7 @@
res := w.Unify(v)
return res
},
- want: "_|_ // w: field ction not allowed",
+ want: "_|_ // w: field not allowed: ction",
}}
for _, tc := range testCases {
if tc.skip {
diff --git a/internal/core/adt/closed2.go b/internal/core/adt/closed2.go
index 6f9a394..c253f5d 100644
--- a/internal/core/adt/closed2.go
+++ b/internal/core/adt/closed2.go
@@ -59,5 +59,5 @@
}
label := f.SelectorString(ctx)
- return false, ctx.NewErrf("field %s not allowed", label)
+ return false, ctx.NewErrf("field not allowed: %s", label)
}
diff --git a/internal/core/adt/eval.go b/internal/core/adt/eval.go
index 6ff29b9..d750776 100644
--- a/internal/core/adt/eval.go
+++ b/internal/core/adt/eval.go
@@ -652,13 +652,13 @@
for _, a := range n.node.Arcs {
if a.nonMonotonicInsertGen >= a.nonMonotonicLookupGen && a.nonMonotonicLookupGen > 0 {
err := ctx.Newf(
- "cycle: new field %s inserted by if clause that was previously evaluated by another if clause", a.Label.SelectorString(ctx))
+ "cycle: field inserted by if clause that was previously evaluated by another if clause: %s", a.Label)
err.AddPosition(n.node)
n.node.BaseValue = &Bottom{Err: err}
} else if a.nonMonotonicReject {
err := ctx.Newf(
- "cycle: field %s was added after an if clause evaluated it",
- a.Label.SelectorString(ctx))
+ "cycle: field was added after an if clause evaluated it: %s",
+ a.Label)
err.AddPosition(n.node)
n.node.BaseValue = &Bottom{Err: err}
}
diff --git a/internal/core/subsume/vertex.go b/internal/core/subsume/vertex.go
index cb9d7c2..07042fa 100644
--- a/internal/core/subsume/vertex.go
+++ b/internal/core/subsume/vertex.go
@@ -131,8 +131,7 @@
if b == nil {
// y.f is optional
if !aOpt {
- s.errf("required field %s is optional in subsumed value",
- f.SelectorString(ctx))
+ s.errf("required field is optional in subsumed value: %s", f)
return false
}
@@ -194,7 +193,7 @@
if s.Profile.IgnoreClosedness {
continue
}
- s.errf("field %s not allowed in closed struct", f)
+ s.errf("field not allowed in closed struct: %s", f)
return false
}