Skip to content

Commit 635fbdd

Browse files
committed
internal/core/eval: fix spurious cycle for bulk constraints
Fixes #502 Change-Id: I697007d0f7d0fabfedb919c10f4a044b1a6b45de Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7501 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent aee9955 commit 635fbdd

File tree

5 files changed

+729
-64
lines changed

5 files changed

+729
-64
lines changed

cue/testdata/cycle/issue502.txtar

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
-- in.cue --
2+
#T : {
3+
config: _
4+
body: _
5+
mas: [string]: {
6+
cfg: _
7+
_link: #T
8+
link: _link & {config: cfg}
9+
}
10+
}
11+
12+
#a: #T & {
13+
config: a: int
14+
body: config.a
15+
mas: one: {
16+
cfg: b: config.a
17+
_link: {
18+
config: b: int
19+
body: config.b
20+
mas: two : {
21+
cfg: c: config.b
22+
_link: {
23+
config: c: int
24+
body: config.c
25+
}
26+
}
27+
}
28+
}
29+
}
30+
31+
a: #a & {config: a: 34}
32+
-- out/eval --
33+
(struct){
34+
#T: (#struct){
35+
config: (_){ _ }
36+
body: (_){ _ }
37+
mas: (#struct){
38+
}
39+
}
40+
#a: (#struct){
41+
config: (#struct){
42+
a: (int){ int }
43+
}
44+
body: (int){ int }
45+
mas: (#struct){
46+
one: (#struct){
47+
cfg: (#struct){
48+
b: (int){ int }
49+
}
50+
_link: (#struct){
51+
config: (#struct){
52+
b: (int){ int }
53+
}
54+
body: (int){ int }
55+
mas: (#struct){
56+
two: (#struct){
57+
cfg: (#struct){
58+
c: (int){ int }
59+
}
60+
_link: (#struct){
61+
config: (#struct){
62+
c: (int){ int }
63+
}
64+
body: (int){ int }
65+
mas: (#struct){
66+
}
67+
}
68+
link: (#struct){
69+
config: (#struct){
70+
c: (int){ int }
71+
}
72+
body: (int){ int }
73+
mas: (#struct){
74+
}
75+
}
76+
}
77+
}
78+
}
79+
link: (#struct){
80+
config: (#struct){
81+
b: (int){ int }
82+
}
83+
body: (int){ int }
84+
mas: (#struct){
85+
two: (#struct){
86+
cfg: (#struct){
87+
c: (int){ int }
88+
}
89+
_link: (#struct){
90+
config: (#struct){
91+
c: (int){ int }
92+
}
93+
body: (int){ int }
94+
mas: (#struct){
95+
}
96+
}
97+
link: (#struct){
98+
config: (#struct){
99+
c: (int){ int }
100+
}
101+
body: (int){ int }
102+
mas: (#struct){
103+
}
104+
}
105+
}
106+
}
107+
}
108+
}
109+
}
110+
}
111+
a: (#struct){
112+
config: (#struct){
113+
a: (int){ 34 }
114+
}
115+
body: (int){ 34 }
116+
mas: (#struct){
117+
one: (#struct){
118+
cfg: (#struct){
119+
b: (int){ 34 }
120+
}
121+
_link: (#struct){
122+
config: (#struct){
123+
b: (int){ int }
124+
}
125+
body: (int){ int }
126+
mas: (#struct){
127+
two: (#struct){
128+
cfg: (#struct){
129+
c: (int){ int }
130+
}
131+
_link: (#struct){
132+
config: (#struct){
133+
c: (int){ int }
134+
}
135+
body: (int){ int }
136+
mas: (#struct){
137+
}
138+
}
139+
link: (#struct){
140+
config: (#struct){
141+
c: (int){ int }
142+
}
143+
body: (int){ int }
144+
mas: (#struct){
145+
}
146+
}
147+
}
148+
}
149+
}
150+
link: (#struct){
151+
config: (#struct){
152+
b: (int){ 34 }
153+
}
154+
body: (int){ 34 }
155+
mas: (#struct){
156+
two: (#struct){
157+
cfg: (#struct){
158+
c: (int){ 34 }
159+
}
160+
_link: (#struct){
161+
config: (#struct){
162+
c: (int){ int }
163+
}
164+
body: (int){ int }
165+
mas: (#struct){
166+
}
167+
}
168+
link: (#struct){
169+
config: (#struct){
170+
c: (int){ 34 }
171+
}
172+
body: (int){ 34 }
173+
mas: (#struct){
174+
}
175+
}
176+
}
177+
}
178+
}
179+
}
180+
}
181+
}
182+
}
183+
-- out/compile --
184+
--- in.cue
185+
{
186+
#T: {
187+
config: _
188+
body: _
189+
mas: {
190+
[string]: {
191+
cfg: _
192+
_link: 〈3;#T〉
193+
link: (〈0;_link〉 & {
194+
config: 〈1;cfg〉
195+
})
196+
}
197+
}
198+
}
199+
#a: (〈0;#T〉 & {
200+
config: {
201+
a: int
202+
}
203+
body: 〈0;config〉.a
204+
mas: {
205+
one: {
206+
cfg: {
207+
b: 〈3;config〉.a
208+
}
209+
_link: {
210+
config: {
211+
b: int
212+
}
213+
body: 〈0;config〉.b
214+
mas: {
215+
two: {
216+
cfg: {
217+
c: 〈3;config〉.b
218+
}
219+
_link: {
220+
config: {
221+
c: int
222+
}
223+
body: 〈0;config〉.c
224+
}
225+
}
226+
}
227+
}
228+
}
229+
}
230+
})
231+
a: (〈0;#a〉 & {
232+
config: {
233+
a: 34
234+
}
235+
})
236+
}

0 commit comments

Comments
 (0)