Skip to content

Commit 748a685

Browse files
committed
internal/core/adt: use per-field comprehensions
This introduces the new comprehension algorithm. It is described in internal/core/adt/comprehension.go. Test file changes: - comp*.txtar: note that the permanent errors are now incomplete errors (cycle errors, to be precise), as these are recoverable by making a configuration more specific. - Some orderings have changed as a result of the algorithmic changes. Note that there are currently no ordering guarantees. - Some cycle errors disappeared. This is okay as long as at least one of the values in the cycle has the error (see the 021_delayed_constraints_failure test, for instance). - Some error paths now reflect the field to which the comprehension was "pushed", rather than the original. - This nothwithstanding, the comprehension error should also be recorded at the original location. Fixes #1130 Fixes #1083 Fixes #1732 Change-Id: I5baeef5128ab9e7e28055bf084a43618cfc73bb8 Signed-off-by: Marcel van Lohuizen <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/529524 Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 0b0f1d3 commit 748a685

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1990
-733
lines changed

cue/syntax_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func TestSyntax(t *testing.T) {
8484
options: o(cue.ResolveReferences(true)),
8585
out: `
8686
{
87-
b: _|_ // #List.next: structural cycle
87+
b: _|_ // #List.next: structural cycle (and 1 more errors)
8888
}`,
8989
}, {
9090
name: "resolveReferences",

cue/testdata/comprehensions/closed.txtar

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ disallowed: {
3636
Errors:
3737
disallowed.vErr.d: field not allowed: d:
3838
./in.cue:26:6
39+
./in.cue:27:3
40+
./in.cue:27:12
41+
./in.cue:28:4
3942
./in.cue:32:8
4043
./in.cue:32:14
4144

@@ -74,6 +77,9 @@ Result:
7477
d: (_|_){
7578
// [eval] disallowed.vErr.d: field not allowed: d:
7679
// ./in.cue:26:6
80+
// ./in.cue:27:3
81+
// ./in.cue:27:12
82+
// ./in.cue:28:4
7783
// ./in.cue:32:8
7884
// ./in.cue:32:14
7985
}

cue/testdata/comprehensions/iferror.txtar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ Result:
148148
}
149149
useDefault: (struct){
150150
a: (struct){
151-
x: (string){ |(*(string){ "foo" }, (string){ string }) }
152151
y: (string){ |(*(string){ "foo" }, (string){ string }) }
152+
x: (string){ |(*(string){ "foo" }, (string){ string }) }
153153
}
154154
issue809: (struct){
155155
#A: (#struct){

0 commit comments

Comments
 (0)