Skip to content

Commit

Permalink
internal/core/adt: fix some references under projections
Browse files Browse the repository at this point in the history
The main issue here was that structs were too agressively
evaluated. Like V2, eval V3 now evaluates only the arcs
of inline structs by default.

This required some tweaking to the evaluation here and
there to make things work properly.

Fixes #3182

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: Iecfe347f9a06d0321db18af375435f46a69b8d6b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202783
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mpvl committed Oct 21, 2024
1 parent cc04ebe commit 6418113
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 107 deletions.
46 changes: 21 additions & 25 deletions cue/testdata/cycle/evaluate.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Conjuncts: 299
Disjuncts: 192
-- out/evalalpha --
Errors:
closeCycle.c: structural cycle
printCycle.a.X: structural cycle
structCycle.c: structural cycle
letCycleOK.t2.a.X: structural cycle:
Expand All @@ -138,8 +139,6 @@ disjunctionCycle.b: cannot use 1 (type int) as type list:
./in.cue:56:9
b: structural cycle:
./in.cue:62:6
closeCycle.c: structural cycle:
./in.cue:73:11
structural cycle:
./in.cue:85:12
listAddCycle.c: structural cycle:
Expand Down Expand Up @@ -252,17 +251,15 @@ Result:
}
closeCycle: (_|_){
// [structural cycle]
a: (_|_){
// [structural cycle] closeCycle.c: structural cycle:
// ./in.cue:73:11
}
a: ~(closeCycle.b)
b: (_|_){
// [structural cycle] closeCycle.c: structural cycle:
// ./in.cue:73:11
// [structural cycle]
d: (_|_){
// [structural cycle] closeCycle.c: structural cycle
}
}
c: (_|_){
// [structural cycle] closeCycle.c: structural cycle:
// ./in.cue:73:11
// [structural cycle] closeCycle.c: structural cycle
}
}
structCycle: (_|_){
Expand Down Expand Up @@ -353,7 +350,7 @@ Result:
diff old new
--- old
+++ new
@@ -1,50 +1,50 @@
@@ -1,50 +1,49 @@
Errors:
-closeCycle.a: structural cycle
-closeCycle.b.d: structural cycle
Expand All @@ -368,6 +365,7 @@ diff old new
-disjunctionCycle.a: cannot use 1 (type int) as type list:
- ./in.cue:56:5
- ./in.cue:56:9
+closeCycle.c: structural cycle
+printCycle.a.X: structural cycle
+structCycle.c: structural cycle
+letCycleOK.t2.a.X: structural cycle:
Expand All @@ -382,15 +380,14 @@ diff old new
- ./in.cue:56:9
b: structural cycle:
./in.cue:62:6
closeCycle.c: structural cycle:
-closeCycle.c: structural cycle:
- ./in.cue:73:15
-structCycle.c: structural cycle:
- ./in.cue:79:14
-embedCycle: structural cycle:
- ./in.cue:85:11
-printCycle.a.X.X: structural cycle:
- ./in.cue:113:6
+ ./in.cue:73:11
+structural cycle:
+ ./in.cue:85:12
+listAddCycle.c: structural cycle:
Expand Down Expand Up @@ -431,7 +428,7 @@ diff old new
}
}
}
@@ -59,20 +59,16 @@
@@ -59,20 +58,16 @@
// [structural cycle] letCycleFail.t1.a.X: structural cycle
}
c: (_|_){
Expand Down Expand Up @@ -462,7 +459,7 @@ diff old new
}
x: (struct){
y: (string){ "" }
@@ -88,17 +84,17 @@
@@ -88,17 +83,17 @@
disjunctionCycle: (_|_){
// [eval]
a: (_|_){
Expand Down Expand Up @@ -491,7 +488,7 @@ diff old new
// ./in.cue:56:5
// ./in.cue:56:9
}
@@ -124,80 +120,79 @@
@@ -124,80 +119,77 @@
}
b: (struct){
}
Expand All @@ -503,7 +500,7 @@ diff old new
}
closeCycle: (_|_){
// [structural cycle]
a: (_|_){
- a: (_|_){
- // [structural cycle] closeCycle.a: structural cycle
- }
- b: (_|_){
Expand All @@ -515,16 +512,15 @@ diff old new
- c: (_|_){
- // [structural cycle] closeCycle.c: structural cycle:
- // ./in.cue:73:15
+ // [structural cycle] closeCycle.c: structural cycle:
+ // ./in.cue:73:11
+ }
+ a: ~(closeCycle.b)
+ b: (_|_){
+ // [structural cycle] closeCycle.c: structural cycle:
+ // ./in.cue:73:11
+ // [structural cycle]
+ d: (_|_){
+ // [structural cycle] closeCycle.c: structural cycle
+ }
+ }
+ c: (_|_){
+ // [structural cycle] closeCycle.c: structural cycle:
+ // ./in.cue:73:11
+ // [structural cycle] closeCycle.c: structural cycle
}
}
structCycle: (_|_){
Expand Down Expand Up @@ -622,7 +618,7 @@ diff old new
}
}
closeFail: (_|_){
@@ -207,21 +202,22 @@
@@ -207,21 +199,22 @@
}
x: (_|_){
// [eval]
Expand Down
Loading

0 comments on commit 6418113

Please sign in to comment.