Skip to content

Commit a7ab473

Browse files
mpvlmvdan
authored andcommitted
internal/core/adt: add tests for 3946
Issue #3946 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I24459e8882ad34d82799a445e84f5d61089fd33e Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1216022 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1216576 Reviewed-by: Roger Peppe <[email protected]>
1 parent 85e1230 commit a7ab473

File tree

1 file changed

+102
-10
lines changed

1 file changed

+102
-10
lines changed

cue/testdata/eval/issue3919.txtar

Lines changed: 102 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,31 @@ issue3931: full: {
5353
expr?: [...string]
5454
}
5555
}
56+
-- issue3946.cue --
57+
issue3946: reduced:{
58+
out: [for _, v in _inputs { v }]
59+
_inputs: [_]: {
60+
doExtra?: bool
61+
if doExtra != _|_ {
62+
if true {
63+
extra: "yes"
64+
}
65+
}
66+
}
67+
if true {
68+
_inputs: input1: name: "input1"
69+
}
70+
}
5671
-- out/eval/stats --
57-
Leaks: 7
58-
Freed: 44
59-
Reused: 38
60-
Allocs: 13
61-
Retain: 3
72+
Leaks: 10
73+
Freed: 51
74+
Reused: 45
75+
Allocs: 16
76+
Retain: 6
6277

63-
Unifications: 47
64-
Conjuncts: 73
65-
Disjuncts: 54
78+
Unifications: 57
79+
Conjuncts: 86
80+
Disjuncts: 67
6681
-- out/evalalpha --
6782
(struct){
6883
full: (struct){
@@ -77,6 +92,16 @@ Disjuncts: 54
7792
a: (int){ 30080 }
7893
port: (int){ |(*(int){ 30080 }, (int){ int }) }
7994
}
95+
issue3946: (struct){
96+
reduced: (_|_){
97+
// [incomplete] issue3946.reduced._inputs.input1.name: cyclic reference to field input1:
98+
// ./issue3946.cue:11:2
99+
out: (#list){
100+
}
101+
_inputs: (struct){
102+
}
103+
}
104+
}
80105
issue3931: (struct){
81106
full: (struct){
82107
bar: (struct){
@@ -146,7 +171,29 @@ Disjuncts: 54
146171
diff old new
147172
--- old
148173
+++ new
149-
@@ -45,10 +45,7 @@
174+
@@ -12,18 +12,12 @@
175+
port: (int){ |(*(int){ 30080 }, (int){ int }) }
176+
}
177+
issue3946: (struct){
178+
- reduced: (struct){
179+
+ reduced: (_|_){
180+
+ // [incomplete] issue3946.reduced._inputs.input1.name: cyclic reference to field input1:
181+
+ // ./issue3946.cue:11:2
182+
out: (#list){
183+
- 0: (struct){
184+
- name: (string){ "input1" }
185+
- doExtra?: (bool){ bool }
186+
- }
187+
}
188+
_inputs: (struct){
189+
- input1: (struct){
190+
- name: (string){ "input1" }
191+
- doExtra?: (bool){ bool }
192+
- }
193+
}
194+
}
195+
}
196+
@@ -61,10 +55,7 @@
150197
foo: (struct){
151198
fooData: (struct){
152199
total: (struct){
@@ -158,7 +205,7 @@ diff old new
158205
}
159206
_hidden: (struct){
160207
extra: (struct){
161-
@@ -56,12 +53,7 @@
208+
@@ -72,12 +63,7 @@
162209
}
163210
}
164211
shared: (struct){
@@ -186,6 +233,22 @@ diff old new
186233
a: (int){ 30080 }
187234
port: (int){ |(*(int){ 30080 }, (int){ int }) }
188235
}
236+
issue3946: (struct){
237+
reduced: (struct){
238+
out: (#list){
239+
0: (struct){
240+
name: (string){ "input1" }
241+
doExtra?: (bool){ bool }
242+
}
243+
}
244+
_inputs: (struct){
245+
input1: (struct){
246+
name: (string){ "input1" }
247+
doExtra?: (bool){ bool }
248+
}
249+
}
250+
}
251+
}
189252
issue3931: (struct){
190253
full: (struct){
191254
bar: (struct){
@@ -281,6 +344,35 @@ diff old new
281344
port: (int|*30080)
282345
}
283346
}
347+
--- issue3946.cue
348+
{
349+
issue3946: {
350+
reduced: {
351+
out: [
352+
for _, v in 〈1;_inputs〉 {
353+
〈1;v〉
354+
},
355+
]
356+
_inputs: {
357+
[_]: {
358+
doExtra?: bool
359+
if (〈0;doExtra〉 != _|_(explicit error (_|_ literal) in source)) {
360+
if true {
361+
extra: "yes"
362+
}
363+
}
364+
}
365+
}
366+
if true {
367+
_inputs: {
368+
input1: {
369+
name: "input1"
370+
}
371+
}
372+
}
373+
}
374+
}
375+
}
284376
--- let.cue
285377
{
286378
issue3931: {

0 commit comments

Comments
 (0)