Skip to content

Commit

Permalink
internal/core/adt: add test for issue 3178
Browse files Browse the repository at this point in the history
Issue #3178

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I3a13c6a79af14ce8a0e1142162e97e54f5367ffc
Dispatch-Trailer: {"type":"trybot","CL":1206317,"patchset":1,"ref":"refs/changes/17/1206317/1","targetBranch":"master"}
  • Loading branch information
mpvl authored and cueckoo committed Dec 24, 2024
1 parent 09f4187 commit fe53545
Showing 1 changed file with 84 additions and 11 deletions.
95 changes: 84 additions & 11 deletions cue/testdata/cycle/freeze.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,30 @@ comprehension: moreSpecific: err: {
}
}
}
-- issue3178.cue --
issue3178: {
// This should pass. Reasoning:
// - second comprehension runs
// - in order to satisfy, first comprehension must run
// - first comprehension runs and completes
input: [ "Value" ]
output: {...}
for name in input {
output: "\(name)": true
}
for name, v in output {
}
}
-- out/eval/stats --
Leaks: 0
Freed: 67
Reused: 59
Freed: 72
Reused: 64
Allocs: 8
Retain: 12
Retain: 15

Unifications: 67
Conjuncts: 119
Disjuncts: 76
Unifications: 72
Conjuncts: 127
Disjuncts: 83
-- out/evalalpha --
Errors:
comprehension.t2.err.a: adding field xq not allowed as field set was already referenced:
Expand All @@ -144,6 +158,8 @@ comprehension.t3.err.a: adding field xq not allowed as field set was already ref
./comprehension.cue:82:13
comprehension.moreSpecific.err.a.x: adding field z not allowed as field set was already referenced:
./comprehension.cue:114:9
issue3178.output: adding field Value not allowed as field set was already referenced:
./issue3178.cue:9:23

Result:
(_|_){
Expand Down Expand Up @@ -279,12 +295,23 @@ Result:
}
}
}
issue3178: (_|_){
// [eval] issue3178.output: adding field Value not allowed as field set was already referenced:
// ./issue3178.cue:9:23
input: (#list){
0: (string){ "Value" }
}
output: (_|_){
// [eval] issue3178.output: adding field Value not allowed as field set was already referenced:
// ./issue3178.cue:9:23
}
}
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -1,11 +1,10 @@
@@ -1,11 +1,12 @@
Errors:
-comprehension.moreSpecific.err.a: field z not allowed by earlier comprehension or reference cycle
-comprehension.t1.ok.p0.x: field z not allowed by earlier comprehension or reference cycle
Expand All @@ -299,10 +326,12 @@ diff old new
+ ./comprehension.cue:82:13
+comprehension.moreSpecific.err.a.x: adding field z not allowed as field set was already referenced:
+ ./comprehension.cue:114:9
+issue3178.output: adding field Value not allowed as field set was already referenced:
+ ./issue3178.cue:9:23

Result:
(_|_){
@@ -12,73 +11,65 @@
@@ -12,73 +13,65 @@
// [eval]
comprehension: (_|_){
// [eval]
Expand Down Expand Up @@ -426,7 +455,7 @@ diff old new
}
}
}
@@ -89,9 +80,9 @@
@@ -89,9 +82,9 @@
err: (_|_){
// [eval]
a: (_|_){
Expand All @@ -439,7 +468,7 @@ diff old new
}
}
}
@@ -99,16 +90,14 @@
@@ -99,16 +92,14 @@
// [eval]
err: (_|_){
// [eval]
Expand All @@ -462,7 +491,7 @@ diff old new
}
}
}
@@ -132,10 +121,10 @@
@@ -132,10 +123,10 @@
err: (_|_){
// [eval]
a: (_|_){
Expand All @@ -475,6 +504,25 @@ diff old new
}
}
}
@@ -151,12 +142,15 @@
}
}
}
- issue3178: (struct){
+ issue3178: (_|_){
+ // [eval] issue3178.output: adding field Value not allowed as field set was already referenced:
+ // ./issue3178.cue:9:23
input: (#list){
0: (string){ "Value" }
}
- output: (struct){
- Value: (bool){ true }
+ output: (_|_){
+ // [eval] issue3178.output: adding field Value not allowed as field set was already referenced:
+ // ./issue3178.cue:9:23
}
}
}
-- diff/todo/p3 --
Error path location could improve.
-- diff/explanation --
Expand Down Expand Up @@ -634,6 +682,14 @@ Result:
}
}
}
issue3178: (struct){
input: (#list){
0: (string){ "Value" }
}
output: (struct){
Value: (bool){ true }
}
}
}
-- out/compile --
--- comprehension.cue
Expand Down Expand Up @@ -909,3 +965,20 @@ Result:
}
}
}
--- issue3178.cue
{
issue3178: {
input: [
"Value",
]
output: {
...
}
for _, name in 〈0;input〉 {
output: {
"\(〈2;name〉)": true
}
}
for name, v in 〈0;output〉 {}
}
}

0 comments on commit fe53545

Please sign in to comment.