Skip to content

Commit

Permalink
internal/core/adt: fix bug in notification
Browse files Browse the repository at this point in the history
Node should be directly scheduled, instead of being
added as an arc. This is now fixed. Note that this
change now mimics how the old evaluator worked.

Note that the test output changed. Even though the
errors are now reported elsewhere, it does not
materially change the output. If nothing else, it
is now more analogous to eval V2.

Note that the newly added test has counter issues,
and thus a new line in the counter issue list was
added. This is likely related to a pre-exisiting
condition.

Fixes #3437

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I0dae66eedfd488375225a7697e623c6e8e1c916b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202773
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mpvl committed Oct 21, 2024
1 parent 0fa94ff commit 1a30763
Show file tree
Hide file tree
Showing 4 changed files with 3,388 additions and 32 deletions.
72 changes: 41 additions & 31 deletions cue/testdata/cycle/chain.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,25 @@ issue2052: full: {
d: #Depth & {#in: tree}
}
-- out/evalalpha/stats --
Leaks: 13628
Freed: 1534
Reused: 1533
Allocs: 13629
Leaks: 12701
Freed: 1308
Reused: 1307
Allocs: 12702
Retain: 0

Unifications: 5379
Conjuncts: 72236
Disjuncts: 9483
Unifications: 5010
Conjuncts: 66031
Disjuncts: 8699
-- out/evalalpha --
Errors:
issue2052.t1.#Depth: adding field #basic not allowed as field set was already referenced:
./issue2052.cue:8:20
issue2052.t1.d: adding field #basic not allowed as field set was already referenced:
./issue2052.cue:8:20
issue2052.t2.#Depth: adding field #basic not allowed as field set was already referenced:
./issue2052.cue:41:20
issue2052.t2.d: adding field #basic not allowed as field set was already referenced:
./issue2052.cue:41:20

Result:
(_|_){
Expand Down Expand Up @@ -316,7 +320,9 @@ Result:
}
}
tree: (string){ "bar" }
d: (#struct){
d: (_|_){
// [eval] issue2052.t1.d: adding field #basic not allowed as field set was already referenced:
// ./issue2052.cue:8:20
#in: (string){ "bar" }
#maxiter: (int){ 4 }
#funcs: (#struct){
Expand All @@ -342,8 +348,6 @@ Result:
out: (int){ 1 }
}
}
#basic: ((null|string)){ |((string){ string }, (null){ null }) }
out: (int){ 1 }
}
}
t2: (_|_){
Expand Down Expand Up @@ -385,7 +389,9 @@ Result:
}
}
tree: (string){ "bar" }
d: (#struct){
d: (_|_){
// [eval] issue2052.t2.d: adding field #basic not allowed as field set was already referenced:
// ./issue2052.cue:41:20
#in: (string){ "bar" }
#maxiter: (int){ 4 }
#funcs: (#struct){
Expand All @@ -411,8 +417,6 @@ Result:
out: (int){ 1 }
}
}
#basic: ((null|string)){ |((string){ string }, (null){ null }) }
out: (int){ 1 }
}
}
full: (struct){
Expand Down Expand Up @@ -725,37 +729,41 @@ diff old new
-Reused: 1816
-Allocs: 70
-Retain: 169
+Leaks: 13628
+Freed: 1534
+Reused: 1533
+Allocs: 13629
+Leaks: 12701
+Freed: 1308
+Reused: 1307
+Allocs: 12702
+Retain: 0

-Unifications: 801
-Conjuncts: 3177
-Disjuncts: 1979
+Unifications: 5379
+Conjuncts: 72236
+Disjuncts: 9483
+Unifications: 5010
+Conjuncts: 66031
+Disjuncts: 8699
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -1,4 +1,12 @@
@@ -1,4 +1,16 @@
-(struct){
+Errors:
+issue2052.t1.#Depth: adding field #basic not allowed as field set was already referenced:
+ ./issue2052.cue:8:20
+issue2052.t1.d: adding field #basic not allowed as field set was already referenced:
+ ./issue2052.cue:8:20
+issue2052.t2.#Depth: adding field #basic not allowed as field set was already referenced:
+ ./issue2052.cue:41:20
+issue2052.t2.d: adding field #basic not allowed as field set was already referenced:
+ ./issue2052.cue:41:20
+
+Result:
+(_|_){
+ // [eval]
chain: (struct){
t1: (struct){
#maxiter: (int){ 2 }
@@ -27,15 +35,11 @@
@@ -27,15 +39,11 @@
}
}
}
Expand All @@ -776,7 +784,7 @@ diff old new
}
}
X: (int){ 1 }
@@ -51,148 +55,148 @@
@@ -51,148 +59,148 @@
}
}
}
Expand Down Expand Up @@ -915,6 +923,8 @@ diff old new
- }
- }
- #in: (string){ "bar" }
- #basic: ((null|string)){ |((string){ string }, (null){ null }) }
- out: (int){ 1 }
+ issue2052: (_|_){
+ // [eval]
+ t1: (_|_){
Expand Down Expand Up @@ -956,7 +966,9 @@ diff old new
+ }
+ }
+ tree: (string){ "bar" }
+ d: (#struct){
+ d: (_|_){
+ // [eval] issue2052.t1.d: adding field #basic not allowed as field set was already referenced:
+ // ./issue2052.cue:8:20
+ #in: (string){ "bar" }
+ #maxiter: (int){ 4 }
+ #funcs: (#struct){
Expand All @@ -982,8 +994,6 @@ diff old new
+ out: (int){ 1 }
+ }
+ }
+ #basic: ((null|string)){ |((string){ string }, (null){ null }) }
+ out: (int){ 1 }
+ }
+ }
+ t2: (_|_){
Expand Down Expand Up @@ -1025,7 +1035,9 @@ diff old new
+ }
+ }
+ tree: (string){ "bar" }
+ d: (#struct){
+ d: (_|_){
+ // [eval] issue2052.t2.d: adding field #basic not allowed as field set was already referenced:
+ // ./issue2052.cue:41:20
+ #in: (string){ "bar" }
+ #maxiter: (int){ 4 }
+ #funcs: (#struct){
Expand All @@ -1051,8 +1063,6 @@ diff old new
+ out: (int){ 1 }
+ }
+ }
#basic: ((null|string)){ |((string){ string }, (null){ null }) }
out: (int){ 1 }
}
}
full: (struct){
Expand All @@ -1062,7 +1072,7 @@ diff old new
#maxiter: (int){ |(*(int){ 4 }, (int){ &(>=0, int) }) }
#funcFactory: (#struct){
#next: (_){ _ }
@@ -339,49 +343,7 @@
@@ -339,49 +347,7 @@
}
cow: (string){ "moo" }
}
Expand Down Expand Up @@ -1113,7 +1123,7 @@ diff old new
#in: (#struct){
a: (#struct){
foo: (string){ "bar" }
@@ -393,6 +355,142 @@
@@ -393,6 +359,142 @@
}
cow: (string){ "moo" }
}
Expand Down
Loading

0 comments on commit 1a30763

Please sign in to comment.