Skip to content

Commit cff2d7e

Browse files
committed
internal/core/adt: add tests for 3931
Issue #3931 Issue #3919 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I49983eeddc6cad4c24502e4b6a076617595a6a53 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1215498 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 8f841ee commit cff2d7e

File tree

1 file changed

+170
-11
lines changed

1 file changed

+170
-11
lines changed

cue/testdata/eval/issue3919.txtar

Lines changed: 170 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,39 @@ related: {
3838
}
3939
}
4040
}
41+
-- let.cue --
42+
issue3931: full: {
43+
bar: [string]: spec?: Spec
44+
if true {
45+
foo: label: "foo"
46+
bar: bar1: spec: selector: foo
47+
}
48+
let Spec = {
49+
selector?: Selector
50+
}
51+
let Selector = {
52+
label?: string
53+
expr?: [...string]
54+
}
55+
}
4156
-- out/eval/stats --
42-
Leaks: 2
43-
Freed: 32
44-
Reused: 26
45-
Allocs: 8
46-
Retain: 1
57+
Leaks: 7
58+
Freed: 44
59+
Reused: 38
60+
Allocs: 13
61+
Retain: 3
4762

48-
Unifications: 30
49-
Conjuncts: 51
50-
Disjuncts: 35
63+
Unifications: 47
64+
Conjuncts: 73
65+
Disjuncts: 54
5166
-- out/evalalpha --
52-
(struct){
67+
Errors:
68+
issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
69+
./let.cue:8:14
70+
71+
Result:
72+
(_|_){
73+
// [eval]
5374
full: (struct){
5475
out: (struct){
5576
env: (struct){
@@ -62,6 +83,40 @@ Disjuncts: 35
6283
a: (int){ 30080 }
6384
port: (int){ |(*(int){ 30080 }, (int){ int }) }
6485
}
86+
issue3931: (_|_){
87+
// [eval]
88+
full: (_|_){
89+
// [eval]
90+
bar: (_|_){
91+
// [eval]
92+
bar1: (_|_){
93+
// [eval]
94+
spec: (_|_){
95+
// [eval]
96+
selector: (_|_){
97+
// [eval] issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
98+
// ./let.cue:8:14
99+
}
100+
}
101+
}
102+
}
103+
foo: (struct){
104+
label: (string){ "foo" }
105+
}
106+
let Spec#1 = (struct){
107+
selector?: (struct){
108+
label?: (string){ string }
109+
expr?: (list){
110+
}
111+
}
112+
}
113+
let Selector#2 = (struct){
114+
label?: (string){ string }
115+
expr?: (list){
116+
}
117+
}
118+
}
119+
}
65120
related: (struct){
66121
foo: (struct){
67122
fooData: (struct){
@@ -101,7 +156,48 @@ Disjuncts: 35
101156
diff old new
102157
--- old
103158
+++ new
104-
@@ -15,10 +15,7 @@
159+
@@ -1,4 +1,10 @@
160+
-(struct){
161+
+Errors:
162+
+issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
163+
+ ./let.cue:8:14
164+
+
165+
+Result:
166+
+(_|_){
167+
+ // [eval]
168+
full: (struct){
169+
out: (struct){
170+
env: (struct){
171+
@@ -11,15 +17,19 @@
172+
a: (int){ 30080 }
173+
port: (int){ |(*(int){ 30080 }, (int){ int }) }
174+
}
175+
- issue3931: (struct){
176+
- full: (struct){
177+
- bar: (struct){
178+
- bar1: (struct){
179+
- spec: (struct){
180+
- selector: (struct){
181+
- label: (string){ "foo" }
182+
- expr?: (list){
183+
- }
184+
+ issue3931: (_|_){
185+
+ // [eval]
186+
+ full: (_|_){
187+
+ // [eval]
188+
+ bar: (_|_){
189+
+ // [eval]
190+
+ bar1: (_|_){
191+
+ // [eval]
192+
+ spec: (_|_){
193+
+ // [eval]
194+
+ selector: (_|_){
195+
+ // [eval] issue3931.full.bar.bar1.spec.selector: adding field expr not allowed as field set was already referenced:
196+
+ // ./let.cue:8:14
197+
}
198+
}
199+
}
200+
@@ -45,10 +55,7 @@
105201
foo: (struct){
106202
fooData: (struct){
107203
total: (struct){
@@ -113,7 +209,7 @@ diff old new
113209
}
114210
_hidden: (struct){
115211
extra: (struct){
116-
@@ -26,12 +23,7 @@
212+
@@ -56,12 +63,7 @@
117213
}
118214
}
119215
shared: (struct){
@@ -141,6 +237,36 @@ diff old new
141237
a: (int){ 30080 }
142238
port: (int){ |(*(int){ 30080 }, (int){ int }) }
143239
}
240+
issue3931: (struct){
241+
full: (struct){
242+
bar: (struct){
243+
bar1: (struct){
244+
spec: (struct){
245+
selector: (struct){
246+
label: (string){ "foo" }
247+
expr?: (list){
248+
}
249+
}
250+
}
251+
}
252+
}
253+
foo: (struct){
254+
label: (string){ "foo" }
255+
}
256+
let Spec#1 = (struct){
257+
selector?: (struct){
258+
label?: (string){ string }
259+
expr?: (list){
260+
}
261+
}
262+
}
263+
let Selector#2 = (struct){
264+
label?: (string){ string }
265+
expr?: (list){
266+
}
267+
}
268+
}
269+
}
144270
related: (struct){
145271
foo: (struct){
146272
fooData: (struct){
@@ -206,6 +332,39 @@ diff old new
206332
port: (int|*30080)
207333
}
208334
}
335+
--- let.cue
336+
{
337+
issue3931: {
338+
full: {
339+
bar: {
340+
[string]: {
341+
spec?: 〈2;let Spec#1〉
342+
}
343+
}
344+
if true {
345+
foo: {
346+
label: "foo"
347+
}
348+
bar: {
349+
bar1: {
350+
spec: {
351+
selector: 〈3;foo〉
352+
}
353+
}
354+
}
355+
}
356+
let Spec#1 = {
357+
selector?: 〈1;let Selector#2〉
358+
}
359+
let Selector#2 = {
360+
label?: string
361+
expr?: [
362+
...string,
363+
]
364+
}
365+
}
366+
}
367+
}
209368
--- secondary.cue
210369
{
211370
related: {

0 commit comments

Comments
 (0)