Skip to content

Commit b17be30

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

File tree

1 file changed

+260
-28
lines changed

1 file changed

+260
-28
lines changed

cue/testdata/comprehensions/pushdown.txtar

Lines changed: 260 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,33 @@ issue3729: full: {
923923
}
924924
argoApp: spec: _syncpolicy: "selfhealprune"
925925
}
926+
-- pending.cue --
927+
// resolving comprehensions arcs across disjunctions.
928+
arcTypeAcrossTwo: {
929+
a?: b?: {
930+
c?: null | {}
931+
} | null
932+
if true {
933+
a: b: c: d: true
934+
}
935+
}
936+
issue3894: reduced: p1: {
937+
{a: string} | {b: value: string}
938+
if true { b: value: "true" }
939+
}
940+
issue3894: reduced: p2: {
941+
{b: value: string} | {a: string}
942+
if true { b: value: "true" }
943+
}
944+
issue3894: full: {
945+
#Output: {a?: string} | {b?: {value: string}}
946+
out: #Output
947+
out: {
948+
if true == true {
949+
b: {value: "true"}
950+
}
951+
}
952+
}
926953
-- out/evalalpha --
927954
Errors:
928955
embed.fail1.p: field not allowed:
@@ -1757,6 +1784,52 @@ Result:
17571784
}
17581785
}
17591786
}
1787+
arcTypeAcrossTwo: (struct){
1788+
a: (struct){
1789+
b: (struct){
1790+
c?: (struct){
1791+
d: (bool){ true }
1792+
}
1793+
}
1794+
}
1795+
}
1796+
issue3894: (struct){
1797+
reduced: (struct){
1798+
p1: (struct){ |((struct){
1799+
a: (string){ string }
1800+
}, (struct){
1801+
b: (struct){
1802+
value: (string){ "true" }
1803+
}
1804+
}) }
1805+
p2: (struct){ |((struct){
1806+
b: (struct){
1807+
value: (string){ "true" }
1808+
}
1809+
}, (struct){
1810+
b: (struct){
1811+
value: (string){ "true" }
1812+
}
1813+
a: (string){ string }
1814+
}) }
1815+
}
1816+
full: (struct){
1817+
#Output: (#struct){ |((#struct){
1818+
a?: (string){ string }
1819+
}, (#struct){
1820+
b?: (#struct){
1821+
value: (string){ string }
1822+
}
1823+
}) }
1824+
out: (#struct){ |((#struct){
1825+
a?: (string){ string }
1826+
}, (#struct){
1827+
b: (#struct){
1828+
value: (string){ "true" }
1829+
}
1830+
}) }
1831+
}
1832+
}
17601833
unifyDynamicReflectSuccess: (struct){
17611834
X: (struct){
17621835
X: (struct){
@@ -2119,55 +2192,93 @@ diff old new
21192192
}
21202193
#ApplicationSpec: (#struct){
21212194
syncPolicy?: ((null|struct)){ |((null){ null }, (#struct){
2195+
@@ -907,7 +834,7 @@
2196+
arcTypeAcrossTwo: (struct){
2197+
a: (struct){
2198+
b: (struct){
2199+
- c: (struct){
2200+
+ c?: (struct){
2201+
d: (bool){ true }
2202+
}
2203+
}
2204+
@@ -916,9 +843,6 @@
2205+
issue3894: (struct){
2206+
reduced: (struct){
2207+
p1: (struct){ |((struct){
2208+
- b: (struct){
2209+
- value: (string){ "true" }
2210+
- }
2211+
a: (string){ string }
2212+
}, (struct){
2213+
b: (struct){
2214+
@@ -944,11 +868,13 @@
2215+
value: (string){ string }
2216+
}
2217+
}) }
2218+
- out: (#struct){
2219+
- b: (#struct){
2220+
- value: (string){ "true" }
2221+
- }
2222+
- }
2223+
+ out: (#struct){ |((#struct){
2224+
+ a?: (string){ string }
2225+
+ }, (#struct){
2226+
+ b: (#struct){
2227+
+ value: (string){ "true" }
2228+
+ }
2229+
+ }) }
2230+
}
2231+
}
2232+
unifyDynamicReflectSuccess: (struct){
21222233
-- out/evalalpha/stats --
2123-
Leaks: 636
2234+
Leaks: 690
21242235
Freed: 0
21252236
Reused: 0
2126-
Allocs: 636
2237+
Allocs: 690
21272238
Retain: 0
21282239

2129-
Unifications: 578
2130-
Conjuncts: 965
2131-
Disjuncts: 32
2240+
Unifications: 602
2241+
Conjuncts: 1027
2242+
Disjuncts: 44
21322243

2133-
CloseIDElems: 210
2134-
NumCloseIDs: 176
2244+
CloseIDElems: 218
2245+
NumCloseIDs: 181
21352246
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
21362247
diff old new
21372248
--- old
21382249
+++ new
21392250
@@ -1,9 +1,12 @@
2140-
-Leaks: 63
2141-
-Freed: 518
2142-
-Reused: 510
2143-
-Allocs: 71
2251+
-Leaks: 73
2252+
-Freed: 553
2253+
-Reused: 548
2254+
-Allocs: 78
21442255
-Retain: 107
21452256
-
2146-
-Unifications: 545
2147-
-Conjuncts: 870
2148-
-Disjuncts: 641
2149-
+Leaks: 636
2257+
-Unifications: 578
2258+
-Conjuncts: 922
2259+
-Disjuncts: 686
2260+
+Leaks: 690
21502261
+Freed: 0
21512262
+Reused: 0
2152-
+Allocs: 636
2263+
+Allocs: 690
21532264
+Retain: 0
21542265
+
2155-
+Unifications: 578
2156-
+Conjuncts: 965
2157-
+Disjuncts: 32
2266+
+Unifications: 602
2267+
+Conjuncts: 1027
2268+
+Disjuncts: 44
21582269
+
2159-
+CloseIDElems: 210
2160-
+NumCloseIDs: 176
2270+
+CloseIDElems: 218
2271+
+NumCloseIDs: 181
21612272
-- out/eval/stats --
2162-
Leaks: 63
2163-
Freed: 518
2164-
Reused: 510
2165-
Allocs: 71
2273+
Leaks: 73
2274+
Freed: 553
2275+
Reused: 548
2276+
Allocs: 78
21662277
Retain: 107
21672278

2168-
Unifications: 545
2169-
Conjuncts: 870
2170-
Disjuncts: 641
2279+
Unifications: 578
2280+
Conjuncts: 922
2281+
Disjuncts: 686
21712282
-- diff/explanation --
21722283
cyclicError: improved error message.
21732284
nestedWithDynamicFieldOK: fixed bug.
@@ -3078,6 +3189,53 @@ Result:
30783189
}
30793190
}
30803191
}
3192+
arcTypeAcrossTwo: (struct){
3193+
a: (struct){
3194+
b: (struct){
3195+
c: (struct){
3196+
d: (bool){ true }
3197+
}
3198+
}
3199+
}
3200+
}
3201+
issue3894: (struct){
3202+
reduced: (struct){
3203+
p1: (struct){ |((struct){
3204+
b: (struct){
3205+
value: (string){ "true" }
3206+
}
3207+
a: (string){ string }
3208+
}, (struct){
3209+
b: (struct){
3210+
value: (string){ "true" }
3211+
}
3212+
}) }
3213+
p2: (struct){ |((struct){
3214+
b: (struct){
3215+
value: (string){ "true" }
3216+
}
3217+
}, (struct){
3218+
b: (struct){
3219+
value: (string){ "true" }
3220+
}
3221+
a: (string){ string }
3222+
}) }
3223+
}
3224+
full: (struct){
3225+
#Output: (#struct){ |((#struct){
3226+
a?: (string){ string }
3227+
}, (#struct){
3228+
b?: (#struct){
3229+
value: (string){ string }
3230+
}
3231+
}) }
3232+
out: (#struct){
3233+
b: (#struct){
3234+
value: (string){ "true" }
3235+
}
3236+
}
3237+
}
3238+
}
30813239
unifyDynamicReflectSuccess: (struct){
30823240
X: (struct){
30833241
X: (struct){
@@ -4268,6 +4426,80 @@ Result:
42684426
}
42694427
}
42704428
}
4429+
--- pending.cue
4430+
{
4431+
arcTypeAcrossTwo: {
4432+
a?: {
4433+
b?: ({
4434+
c?: (null|{})
4435+
}|null)
4436+
}
4437+
if true {
4438+
a: {
4439+
b: {
4440+
c: {
4441+
d: true
4442+
}
4443+
}
4444+
}
4445+
}
4446+
}
4447+
issue3894: {
4448+
reduced: {
4449+
p1: {
4450+
({
4451+
a: string
4452+
}|{
4453+
b: {
4454+
value: string
4455+
}
4456+
})
4457+
if true {
4458+
b: {
4459+
value: "true"
4460+
}
4461+
}
4462+
}
4463+
}
4464+
}
4465+
issue3894: {
4466+
reduced: {
4467+
p2: {
4468+
({
4469+
b: {
4470+
value: string
4471+
}
4472+
}|{
4473+
a: string
4474+
})
4475+
if true {
4476+
b: {
4477+
value: "true"
4478+
}
4479+
}
4480+
}
4481+
}
4482+
}
4483+
issue3894: {
4484+
full: {
4485+
#Output: ({
4486+
a?: string
4487+
}|{
4488+
b?: {
4489+
value: string
4490+
}
4491+
})
4492+
out: 〈0;#Output〉
4493+
out: {
4494+
if (true == true) {
4495+
b: {
4496+
value: "true"
4497+
}
4498+
}
4499+
}
4500+
}
4501+
}
4502+
}
42714503
--- reflect.cue
42724504
{
42734505
unifyDynamicReflectSuccess: {

0 commit comments

Comments
 (0)