Skip to content

Commit

Permalink
internal/core/debug: omit ConjunctGroups in compact mode
Browse files Browse the repository at this point in the history
Displaying conjunct groups are usuful in some test outputs, but not
really in error messages. It seems reasonable to only print them
in non-compact mode.

This also fixes a test breakages in the API.

Issue #3060

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ic9ae9a31f4067349b7dcc7baf75e60552b5bb617
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1193957
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
  • Loading branch information
mpvl committed Apr 29, 2024
1 parent 8b6705c commit c6701b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
32 changes: 16 additions & 16 deletions cue/testdata/cycle/structural.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,13 @@ d3.config.0: structural cycle:
./in.cue:315:13
d3.x.0: structural cycle:
./in.cue:315:13
e4.a.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & (a|{}) & [{c:1}]]]]]]]:
e4.a.0.0: cannot combine regular field "c" with [1,{c:1} & (a|{}) & [{c:1}]]:
./in.cue:399:11
e4.a.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
e4.a.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
./in.cue:399:11
e4.b.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & [{c:1}] & (b|{})]]]]]]:
e4.b.0.0: cannot combine regular field "c" with [1,{c:1} & [{c:1}] & (b|{})]:
./in.cue:401:11
e4.b.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
e4.b.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
./in.cue:401:11
nestedList.v1e.y.0.0: incompatible list lengths (1 and 2):
./in.cue:416:6
Expand Down Expand Up @@ -1422,9 +1422,9 @@ Result:
// ./in.cue:398:10
// ./in.cue:399:6
// e4.a.0.0.0: structural cycle
// e4.a.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & (a|{}) & [{c:1}]]]]]]]:
// e4.a.0.0: cannot combine regular field "c" with [1,{c:1} & (a|{}) & [{c:1}]]:
// ./in.cue:399:11
// e4.a.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
// e4.a.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
// ./in.cue:399:11
}
}
Expand All @@ -1447,9 +1447,9 @@ Result:
// ./in.cue:401:6
// ./in.cue:402:10
// e4.b.0.0.0: structural cycle
// e4.b.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & [{c:1}] & (b|{})]]]]]]:
// e4.b.0.0: cannot combine regular field "c" with [1,{c:1} & [{c:1}] & (b|{})]:
// ./in.cue:401:11
// e4.b.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
// e4.b.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
// ./in.cue:401:11
}
}
Expand Down Expand Up @@ -1895,13 +1895,13 @@ diff old new
+ ./in.cue:315:13
+d3.x.0: structural cycle:
+ ./in.cue:315:13
+e4.a.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & (a|{}) & [{c:1}]]]]]]]:
+e4.a.0.0: cannot combine regular field "c" with [1,{c:1} & (a|{}) & [{c:1}]]:
+ ./in.cue:399:11
+e4.a.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
+e4.a.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
+ ./in.cue:399:11
+e4.b.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & [{c:1}] & (b|{})]]]]]]:
+e4.b.0.0: cannot combine regular field "c" with [1,{c:1} & [{c:1}] & (b|{})]:
+ ./in.cue:401:11
+e4.b.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
+e4.b.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
+ ./in.cue:401:11
+nestedList.v1e.y.0.0: incompatible list lengths (1 and 2):
+ ./in.cue:416:6
Expand Down Expand Up @@ -2396,9 +2396,9 @@ diff old new
+ // ./in.cue:398:10
+ // ./in.cue:399:6
+ // e4.a.0.0.0: structural cycle
+ // e4.a.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & (a|{}) & [{c:1}]]]]]]]:
+ // e4.a.0.0: cannot combine regular field "c" with [1,{c:1} & (a|{}) & [{c:1}]]:
+ // ./in.cue:399:11
+ // e4.a.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
+ // e4.a.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
+ // ./in.cue:399:11
+ }
+ }
Expand Down Expand Up @@ -2426,9 +2426,9 @@ diff old new
+ // ./in.cue:401:6
+ // ./in.cue:402:10
+ // e4.b.0.0.0: structural cycle
+ // e4.b.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[{c:1} & [{c:1}] & (b|{})]]]]]]:
+ // e4.b.0.0: cannot combine regular field "c" with [1,{c:1} & [{c:1}] & (b|{})]:
+ // ./in.cue:401:11
+ // e4.b.0.0.0: cannot combine regular field "c" with [1,&[&[&[&[&[&[{c:1}]]]]]]]:
+ // e4.b.0.0.0: cannot combine regular field "c" with [1,{c:1}]:
+ // ./in.cue:401:11
}
}
Expand Down
2 changes: 1 addition & 1 deletion cue/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3792,7 +3792,7 @@ func TestExpr(t *testing.T) {
}}
for _, tc := range testCases {
runMatrix(t, tc.input, func(t *testing.T, cfg *evalConfig) {
TODO_V3(t, cfg)
TODO_Sharing(t, cfg)

v := cfg.getValue(t, tc.input).Lookup("v")
got := exprStr(v)
Expand Down
2 changes: 0 additions & 2 deletions internal/core/debug/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,12 @@ func (w *compactPrinter) node(n adt.Node) {
}

case *adt.ConjunctGroup:
w.string("&[")
for i, c := range *x {
if i > 0 {
w.string(" & ")
}
w.node(c.Expr())
}
w.string("]")

case *adt.Disjunction:
for i, c := range x.Values {
Expand Down

0 comments on commit c6701b4

Please sign in to comment.