Skip to content

Commit

Permalink
internal/core/eval: fix spurious cycle for bulk constraints
Browse files Browse the repository at this point in the history
Fixes #502

Change-Id: I697007d0f7d0fabfedb919c10f4a044b1a6b45de
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7501
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Oct 23, 2020
1 parent aee9955 commit 635fbdd
Show file tree
Hide file tree
Showing 5 changed files with 729 additions and 64 deletions.
236 changes: 236 additions & 0 deletions cue/testdata/cycle/issue502.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
-- in.cue --
#T : {
config: _
body: _
mas: [string]: {
cfg: _
_link: #T
link: _link & {config: cfg}
}
}

#a: #T & {
config: a: int
body: config.a
mas: one: {
cfg: b: config.a
_link: {
config: b: int
body: config.b
mas: two : {
cfg: c: config.b
_link: {
config: c: int
body: config.c
}
}
}
}
}

a: #a & {config: a: 34}
-- out/eval --
(struct){
#T: (#struct){
config: (_){ _ }
body: (_){ _ }
mas: (#struct){
}
}
#a: (#struct){
config: (#struct){
a: (int){ int }
}
body: (int){ int }
mas: (#struct){
one: (#struct){
cfg: (#struct){
b: (int){ int }
}
_link: (#struct){
config: (#struct){
b: (int){ int }
}
body: (int){ int }
mas: (#struct){
two: (#struct){
cfg: (#struct){
c: (int){ int }
}
_link: (#struct){
config: (#struct){
c: (int){ int }
}
body: (int){ int }
mas: (#struct){
}
}
link: (#struct){
config: (#struct){
c: (int){ int }
}
body: (int){ int }
mas: (#struct){
}
}
}
}
}
link: (#struct){
config: (#struct){
b: (int){ int }
}
body: (int){ int }
mas: (#struct){
two: (#struct){
cfg: (#struct){
c: (int){ int }
}
_link: (#struct){
config: (#struct){
c: (int){ int }
}
body: (int){ int }
mas: (#struct){
}
}
link: (#struct){
config: (#struct){
c: (int){ int }
}
body: (int){ int }
mas: (#struct){
}
}
}
}
}
}
}
}
a: (#struct){
config: (#struct){
a: (int){ 34 }
}
body: (int){ 34 }
mas: (#struct){
one: (#struct){
cfg: (#struct){
b: (int){ 34 }
}
_link: (#struct){
config: (#struct){
b: (int){ int }
}
body: (int){ int }
mas: (#struct){
two: (#struct){
cfg: (#struct){
c: (int){ int }
}
_link: (#struct){
config: (#struct){
c: (int){ int }
}
body: (int){ int }
mas: (#struct){
}
}
link: (#struct){
config: (#struct){
c: (int){ int }
}
body: (int){ int }
mas: (#struct){
}
}
}
}
}
link: (#struct){
config: (#struct){
b: (int){ 34 }
}
body: (int){ 34 }
mas: (#struct){
two: (#struct){
cfg: (#struct){
c: (int){ 34 }
}
_link: (#struct){
config: (#struct){
c: (int){ int }
}
body: (int){ int }
mas: (#struct){
}
}
link: (#struct){
config: (#struct){
c: (int){ 34 }
}
body: (int){ 34 }
mas: (#struct){
}
}
}
}
}
}
}
}
}
-- out/compile --
--- in.cue
{
#T: {
config: _
body: _
mas: {
[string]: {
cfg: _
_link: 〈3;#T〉
link: (〈0;_link〉 & {
config: 〈1;cfg〉
})
}
}
}
#a: (〈0;#T〉 & {
config: {
a: int
}
body: 〈0;config〉.a
mas: {
one: {
cfg: {
b: 〈3;config〉.a
}
_link: {
config: {
b: int
}
body: 〈0;config〉.b
mas: {
two: {
cfg: {
c: 〈3;config〉.b
}
_link: {
config: {
c: int
}
body: 〈0;config〉.c
}
}
}
}
}
}
})
a: (〈0;#a〉 & {
config: {
a: 34
}
})
}

0 comments on commit 635fbdd

Please sign in to comment.