Skip to content

Commit b75a12c

Browse files
committed
internal/core/adt: add tests for issue 3827
Issue #3827 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I0354729f2a13127205978e4526d798b48b286843 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211828 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 5414b41 commit b75a12c

File tree

1 file changed

+266
-0
lines changed

1 file changed

+266
-0
lines changed

cue/testdata/cycle/issue3827.txtar

+266
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
-- in.cue --
2+
reduced: {
3+
A: b: (A.c & {}).x
4+
A: null | { c: x: 1 }
5+
}
6+
7+
full: {
8+
out: #Workflow.#Step & {
9+
uses: "actions/upload-artifact@v3"
10+
with: {
11+
name: "foo"
12+
path: "bar"
13+
}
14+
}
15+
16+
Y=#Workflow: #Step: (Y.steps & {x: {}}).x
17+
18+
#Workflow: null | {
19+
steps: [string]: {
20+
uses?: string
21+
with?: [string]: string
22+
}
23+
}
24+
}
25+
-- out/eval/stats --
26+
Leaks: 6
27+
Freed: 29
28+
Reused: 22
29+
Allocs: 13
30+
Retain: 10
31+
32+
Unifications: 31
33+
Conjuncts: 57
34+
Disjuncts: 38
35+
-- out/evalalpha --
36+
Errors:
37+
full.#Workflow: conflicting values null and {#Step:(#Workflow.steps & {x:{}}).x} (mismatched types null and struct):
38+
./in.cue:15:15
39+
./in.cue:17:13
40+
full.out.uses: field not allowed:
41+
./in.cue:8:3
42+
full.out.with: field not allowed:
43+
./in.cue:9:3
44+
reduced.A: 2 errors in empty disjunction:
45+
reduced.A: conflicting values null and {b:(A.c & {}).x} (mismatched types null and struct):
46+
./in.cue:2:5
47+
./in.cue:3:5
48+
invalid operand A (found null, want list or struct):
49+
./in.cue:2:9
50+
full.#Workflow: 2 errors in empty disjunction::
51+
./in.cue:7:7
52+
invalid operand Y (found null, want list or struct):
53+
./in.cue:15:23
54+
55+
Result:
56+
(_|_){
57+
// [eval]
58+
reduced: (_|_){
59+
// [eval]
60+
A: (_|_){
61+
// [eval] reduced.A: 2 errors in empty disjunction:
62+
// reduced.A: conflicting values null and {b:(A.c & {}).x} (mismatched types null and struct):
63+
// ./in.cue:2:5
64+
// ./in.cue:3:5
65+
// invalid operand A (found null, want list or struct):
66+
// ./in.cue:2:9
67+
b: (_){ _ }
68+
}
69+
}
70+
full: (_|_){
71+
// [eval]
72+
out: (_|_){
73+
// [eval]
74+
uses: (_|_){
75+
// [eval] full.out.uses: field not allowed:
76+
// ./in.cue:8:3
77+
}
78+
with: (_|_){
79+
// [eval] full.out.with: field not allowed:
80+
// ./in.cue:9:3
81+
name: (_|_){
82+
// [eval] full.out.with.name: field not allowed:
83+
// ./in.cue:10:4
84+
}
85+
path: (_|_){
86+
// [eval] full.out.with.path: field not allowed:
87+
// ./in.cue:11:4
88+
}
89+
}
90+
}
91+
#Workflow: (_|_){
92+
// [eval] full.#Workflow: conflicting values null and {#Step:(#Workflow.steps & {x:{}}).x} (mismatched types null and struct):
93+
// ./in.cue:15:15
94+
// ./in.cue:17:13
95+
// full.#Workflow: 2 errors in empty disjunction::
96+
// ./in.cue:7:7
97+
// invalid operand Y (found null, want list or struct):
98+
// ./in.cue:15:23
99+
#Step: (_){ _ }
100+
}
101+
}
102+
}
103+
-- diff/-out/evalalpha<==>+out/eval --
104+
diff old new
105+
--- old
106+
+++ new
107+
@@ -1,28 +1,67 @@
108+
-(struct){
109+
- reduced: (struct){
110+
- A: (struct){
111+
- b: (int){ 1 }
112+
- c: (struct){
113+
- x: (int){ 1 }
114+
- }
115+
- }
116+
- }
117+
- full: (struct){
118+
- out: (#struct){
119+
- uses: (string){ "actions/upload-artifact@v3" }
120+
- with: (#struct){
121+
- name: (string){ "foo" }
122+
- path: (string){ "bar" }
123+
- }
124+
- }
125+
- #Workflow: (#struct){
126+
- #Step: (#struct){
127+
- uses?: (string){ string }
128+
- with?: (#struct){
129+
- }
130+
- }
131+
- steps: (#struct){
132+
- }
133+
+Errors:
134+
+full.#Workflow: conflicting values null and {#Step:(#Workflow.steps & {x:{}}).x} (mismatched types null and struct):
135+
+ ./in.cue:15:15
136+
+ ./in.cue:17:13
137+
+full.out.uses: field not allowed:
138+
+ ./in.cue:8:3
139+
+full.out.with: field not allowed:
140+
+ ./in.cue:9:3
141+
+reduced.A: 2 errors in empty disjunction:
142+
+reduced.A: conflicting values null and {b:(A.c & {}).x} (mismatched types null and struct):
143+
+ ./in.cue:2:5
144+
+ ./in.cue:3:5
145+
+invalid operand A (found null, want list or struct):
146+
+ ./in.cue:2:9
147+
+full.#Workflow: 2 errors in empty disjunction::
148+
+ ./in.cue:7:7
149+
+invalid operand Y (found null, want list or struct):
150+
+ ./in.cue:15:23
151+
+
152+
+Result:
153+
+(_|_){
154+
+ // [eval]
155+
+ reduced: (_|_){
156+
+ // [eval]
157+
+ A: (_|_){
158+
+ // [eval] reduced.A: 2 errors in empty disjunction:
159+
+ // reduced.A: conflicting values null and {b:(A.c & {}).x} (mismatched types null and struct):
160+
+ // ./in.cue:2:5
161+
+ // ./in.cue:3:5
162+
+ // invalid operand A (found null, want list or struct):
163+
+ // ./in.cue:2:9
164+
+ b: (_){ _ }
165+
+ }
166+
+ }
167+
+ full: (_|_){
168+
+ // [eval]
169+
+ out: (_|_){
170+
+ // [eval]
171+
+ uses: (_|_){
172+
+ // [eval] full.out.uses: field not allowed:
173+
+ // ./in.cue:8:3
174+
+ }
175+
+ with: (_|_){
176+
+ // [eval] full.out.with: field not allowed:
177+
+ // ./in.cue:9:3
178+
+ name: (_|_){
179+
+ // [eval] full.out.with.name: field not allowed:
180+
+ // ./in.cue:10:4
181+
+ }
182+
+ path: (_|_){
183+
+ // [eval] full.out.with.path: field not allowed:
184+
+ // ./in.cue:11:4
185+
+ }
186+
+ }
187+
+ }
188+
+ #Workflow: (_|_){
189+
+ // [eval] full.#Workflow: conflicting values null and {#Step:(#Workflow.steps & {x:{}}).x} (mismatched types null and struct):
190+
+ // ./in.cue:15:15
191+
+ // ./in.cue:17:13
192+
+ // full.#Workflow: 2 errors in empty disjunction::
193+
+ // ./in.cue:7:7
194+
+ // invalid operand Y (found null, want list or struct):
195+
+ // ./in.cue:15:23
196+
+ #Step: (_){ _ }
197+
}
198+
}
199+
}
200+
-- out/eval --
201+
(struct){
202+
reduced: (struct){
203+
A: (struct){
204+
b: (int){ 1 }
205+
c: (struct){
206+
x: (int){ 1 }
207+
}
208+
}
209+
}
210+
full: (struct){
211+
out: (#struct){
212+
uses: (string){ "actions/upload-artifact@v3" }
213+
with: (#struct){
214+
name: (string){ "foo" }
215+
path: (string){ "bar" }
216+
}
217+
}
218+
#Workflow: (#struct){
219+
#Step: (#struct){
220+
uses?: (string){ string }
221+
with?: (#struct){
222+
}
223+
}
224+
steps: (#struct){
225+
}
226+
}
227+
}
228+
}
229+
-- out/compile --
230+
--- in.cue
231+
{
232+
reduced: {
233+
A: {
234+
b: (〈1;A〉.c & {}).x
235+
}
236+
A: (null|{
237+
c: {
238+
x: 1
239+
}
240+
})
241+
}
242+
full: {
243+
out: (〈0;#Workflow〉.#Step & {
244+
uses: "actions/upload-artifact@v3"
245+
with: {
246+
name: "foo"
247+
path: "bar"
248+
}
249+
})
250+
#Workflow: {
251+
#Step: (〈1;#Workflow〉.steps & {
252+
x: {}
253+
}).x
254+
}
255+
#Workflow: (null|{
256+
steps: {
257+
[string]: {
258+
uses?: string
259+
with?: {
260+
[string]: string
261+
}
262+
}
263+
}
264+
})
265+
}
266+
}

0 commit comments

Comments
 (0)