Skip to content

Commit 682462a

Browse files
committed
internal/core/adt: add test for 3681
Issue #3681 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Ifb7f5cdd58f4d794c92ec59edc39df6c3b8c9406 Reviewed-on: https://gerrithub.io/c/cue-lang/cue/+/1207319 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 8a73d2b commit 682462a

File tree

1 file changed

+57
-8
lines changed

1 file changed

+57
-8
lines changed

cue/testdata/eval/disjunctions.txtar

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,24 @@ issue3672: {
227227
v: #def
228228
v: x: [{y: true}] // Should be one element
229229
}
230+
issue3681: {
231+
// Order dependent! These two fields need to go first.
232+
out: one: #strDefaultDef
233+
out: two: "\(strDefault)"
234+
235+
strDefault: *"fallback" | string
236+
#strDefaultDef: strDefault
237+
}
230238
-- out/eval/stats --
231239
Leaks: 10
232-
Freed: 625
233-
Reused: 611
240+
Freed: 637
241+
Reused: 623
234242
Allocs: 24
235243
Retain: 39
236244

237-
Unifications: 326
238-
Conjuncts: 1213
239-
Disjuncts: 640
245+
Unifications: 332
246+
Conjuncts: 1229
247+
Disjuncts: 652
240248
-- out/evalalpha --
241249
Errors:
242250
f: 2 errors in empty disjunction:
@@ -306,6 +314,17 @@ Result:
306314
}
307315
}
308316
}
317+
issue3681: (struct){
318+
out: (struct){
319+
one: (string){ |(*(string){ "fallback" }, (string){ string }) }
320+
two: (_|_){
321+
// [incomplete] issue3681.out.two: invalid interpolation: non-concrete value _ (type _):
322+
// ./dependencies.cue:26:12
323+
}
324+
}
325+
strDefault: (string){ |(*(string){ "fallback" }, (string){ string }) }
326+
#strDefaultDef: (string){ |(*(string){ "fallback" }, (string){ string }) }
327+
}
309328
a: (int){ |(*(int){ 1 }, (int){ int }) }
310329
aa: (int){ |(*(int){ 1 }, *(int){ 2 }, (int){ int }) }
311330
b: (struct){ |((struct){
@@ -628,7 +647,19 @@ diff old new
628647
}
629648
#S: ((string|struct)){ |((string){ string }, (#struct){
630649
}) }
631-
@@ -102,19 +91,12 @@
650+
@@ -80,7 +69,10 @@
651+
issue3681: (struct){
652+
out: (struct){
653+
one: (string){ |(*(string){ "fallback" }, (string){ string }) }
654+
- two: (string){ "fallback" }
655+
+ two: (_|_){
656+
+ // [incomplete] issue3681.out.two: invalid interpolation: non-concrete value _ (type _):
657+
+ // ./dependencies.cue:26:12
658+
+ }
659+
}
660+
strDefault: (string){ |(*(string){ "fallback" }, (string){ string }) }
661+
#strDefaultDef: (string){ |(*(string){ "fallback" }, (string){ string }) }
662+
@@ -110,19 +102,12 @@
632663
// [eval] f: 2 errors in empty disjunction:
633664
// f.name: conflicting values "int" and "str":
634665
// ./in.cue:5:8
@@ -649,7 +680,7 @@ diff old new
649680
}
650681
e1: (struct){
651682
a: ((null|struct)){ |((null){ null }, (struct){
652-
@@ -226,8 +208,8 @@
683+
@@ -234,8 +219,8 @@
653684
e: (struct){
654685
foobar: (#struct){
655686
b: (#struct){
@@ -659,7 +690,7 @@ diff old new
659690
}
660691
}
661692
}
662-
@@ -329,6 +311,9 @@
693+
@@ -337,6 +322,9 @@
663694
let Ok#1 = (bool){ true }
664695
}, (#struct){
665696
_ok: (bool){ true }
@@ -756,6 +787,14 @@ Result:
756787
}
757788
}
758789
}
790+
issue3681: (struct){
791+
out: (struct){
792+
one: (string){ |(*(string){ "fallback" }, (string){ string }) }
793+
two: (string){ "fallback" }
794+
}
795+
strDefault: (string){ |(*(string){ "fallback" }, (string){ string }) }
796+
#strDefaultDef: (string){ |(*(string){ "fallback" }, (string){ string }) }
797+
}
759798
a: (int){ |(*(int){ 1 }, (int){ int }) }
760799
aa: (int){ |(*(int){ 1 }, *(int){ 2 }, (int){ int }) }
761800
b: (struct){ |((struct){
@@ -1077,6 +1116,16 @@ Result:
10771116
]
10781117
}
10791118
}
1119+
issue3681: {
1120+
out: {
1121+
one: 〈1;#strDefaultDef〉
1122+
}
1123+
out: {
1124+
two: "\(〈1;strDefault〉)"
1125+
}
1126+
strDefault: (*"fallback"|string)
1127+
#strDefaultDef: 〈0;strDefault〉
1128+
}
10801129
}
10811130
--- in.cue
10821131
{

0 commit comments

Comments
 (0)