Skip to content

Commit bb2204f

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

File tree

1 file changed

+161
-9
lines changed

1 file changed

+161
-9
lines changed

cue/testdata/eval/disjunctions.txtar

Lines changed: 161 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,40 @@ issue3899: full: {
294294
deployImage: _versions[spec.image]
295295
}
296296
}
297+
-- issue3891.cue --
298+
issue3891: reduced: {
299+
{x: _} | null
300+
{x: _} | null
301+
x: *a.y | _
302+
a: b
303+
b: y: 1
304+
}
305+
issue3891: full: {
306+
out: #Foo | "never"
307+
out: #Foo | "never"
308+
out: _fooTemplate & {
309+
_input: (_transform & {in: sub1: sub2: "bar"}).out
310+
}
311+
_transform: {
312+
in: _
313+
out: in
314+
}
315+
#Foo: foo?: _
316+
_fooTemplate: {
317+
_input: _
318+
foo: *_input.sub1.sub2 | _
319+
}
320+
}
297321
-- out/eval/stats --
298-
Leaks: 36
299-
Freed: 739
300-
Reused: 725
301-
Allocs: 50
302-
Retain: 95
322+
Leaks: 40
323+
Freed: 837
324+
Reused: 825
325+
Allocs: 52
326+
Retain: 130
303327

304-
Unifications: 430
305-
Conjuncts: 1449
306-
Disjuncts: 803
328+
Unifications: 506
329+
Conjuncts: 1619
330+
Disjuncts: 936
307331
-- out/evalalpha --
308332
Errors:
309333
f: 2 errors in empty disjunction:
@@ -720,6 +744,36 @@ Result:
720744
}) }
721745
}
722746
}
747+
issue3891: (struct){
748+
reduced: (struct){
749+
x: (_){ _ }
750+
a: ~(issue3891.reduced.b)
751+
b: (struct){
752+
y: (int){ 1 }
753+
}
754+
}
755+
full: (struct){
756+
out: (#struct){
757+
_input: (struct){
758+
sub1: (struct){
759+
sub2: (string){ "bar" }
760+
}
761+
}
762+
foo: (_){ _ }
763+
}
764+
_transform: (struct){
765+
in: (_){ _ }
766+
out: (_){ _ }
767+
}
768+
#Foo: (#struct){
769+
foo?: (_){ _ }
770+
}
771+
_fooTemplate: (struct){
772+
_input: (_){ _ }
773+
foo: (_){ _ }
774+
}
775+
}
776+
}
723777
issue3899: (struct){
724778
reduced: (struct){
725779
p1: (struct){
@@ -849,7 +903,29 @@ diff old new
849903
x: (bool){ true }
850904
}) }
851905
bar: (#struct){ |((#struct){
852-
@@ -443,14 +422,14 @@
906+
@@ -436,10 +415,8 @@
907+
}
908+
issue3891: (struct){
909+
reduced: (struct){
910+
- x: (_){ |(*(int){ 1 }, (_){ _ }) }
911+
- a: (struct){
912+
- y: (int){ 1 }
913+
- }
914+
+ x: (_){ _ }
915+
+ a: ~(issue3891.reduced.b)
916+
b: (struct){
917+
y: (int){ 1 }
918+
}
919+
@@ -451,7 +428,7 @@
920+
sub2: (string){ "bar" }
921+
}
922+
}
923+
- foo: (_){ |(*(string){ "bar" }, (_){ _ }) }
924+
+ foo: (_){ _ }
925+
}
926+
_transform: (struct){
927+
in: (_){ _ }
928+
@@ -475,14 +452,14 @@
853929
}
854930
full: (struct){
855931
out: (#struct){
@@ -1313,6 +1389,38 @@ Result:
13131389
}) }
13141390
}
13151391
}
1392+
issue3891: (struct){
1393+
reduced: (struct){
1394+
x: (_){ |(*(int){ 1 }, (_){ _ }) }
1395+
a: (struct){
1396+
y: (int){ 1 }
1397+
}
1398+
b: (struct){
1399+
y: (int){ 1 }
1400+
}
1401+
}
1402+
full: (struct){
1403+
out: (#struct){
1404+
_input: (struct){
1405+
sub1: (struct){
1406+
sub2: (string){ "bar" }
1407+
}
1408+
}
1409+
foo: (_){ |(*(string){ "bar" }, (_){ _ }) }
1410+
}
1411+
_transform: (struct){
1412+
in: (_){ _ }
1413+
out: (_){ _ }
1414+
}
1415+
#Foo: (#struct){
1416+
foo?: (_){ _ }
1417+
}
1418+
_fooTemplate: (struct){
1419+
_input: (_){ _ }
1420+
foo: (_){ _ }
1421+
}
1422+
}
1423+
}
13161424
issue3899: (struct){
13171425
reduced: (struct){
13181426
p1: (struct){
@@ -1835,6 +1943,50 @@ Result:
18351943
}
18361944
}
18371945
}
1946+
--- issue3891.cue
1947+
{
1948+
issue3891: {
1949+
reduced: {
1950+
({
1951+
x: _
1952+
}|null)
1953+
({
1954+
x: _
1955+
}|null)
1956+
x: (*〈0;a〉.y|_)
1957+
a: 〈0;b〉
1958+
b: {
1959+
y: 1
1960+
}
1961+
}
1962+
}
1963+
issue3891: {
1964+
full: {
1965+
out: (〈0;#Foo〉|"never")
1966+
out: (〈0;#Foo〉|"never")
1967+
out: (〈0;_fooTemplate〉 & {
1968+
_input: (〈1;_transform〉 & {
1969+
in: {
1970+
sub1: {
1971+
sub2: "bar"
1972+
}
1973+
}
1974+
}).out
1975+
})
1976+
_transform: {
1977+
in: _
1978+
out: 〈0;in〉
1979+
}
1980+
#Foo: {
1981+
foo?: _
1982+
}
1983+
_fooTemplate: {
1984+
_input: _
1985+
foo: (*〈0;_input〉.sub1.sub2|_)
1986+
}
1987+
}
1988+
}
1989+
}
18381990
--- issue3899.cue
18391991
{
18401992
issue3899: {

0 commit comments

Comments
 (0)