Skip to content

Commit

Permalink
internal/core/adt: fix bug that ignores field type
Browse files Browse the repository at this point in the history
evalv3 would ignore the field type of a referenced
arc if it was only partially processed.
This change ensures that this is checked.

Revisit this change once cyclic handling is
completed for evalv3.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I4681256aa6bee78a4f12f596dde0450c9180be8e
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199917
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Matthew Sackman <matthew@cue.works>
  • Loading branch information
mpvl committed Aug 23, 2024
1 parent 196dc98 commit a3f1a0f
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 281 deletions.
161 changes: 97 additions & 64 deletions cue/testdata/cycle/compbottomnofinal.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,10 @@ Disjuncts: 215
#userHostPort: (string){ "^(:(?P<port>\\d+))?$" }
p1: (struct){
#Y: (_|_){
// [incomplete] small.p1.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:28:7
// [incomplete] small.p1.#Y: undefined field: port:
// ./in.cue:28:50
// small.p1.#X.port: cyclic reference to field port:
// ./in.cue:31:4
}
#X: (_|_){
// [incomplete] small.p1.#X.port: cyclic reference to field port:
Expand All @@ -396,17 +398,19 @@ Disjuncts: 215
// ./in.cue:42:4
}
#Y: (_|_){
// [incomplete] small.p2.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:50:7
// [incomplete] small.p2.#Y: undefined field: port:
// ./in.cue:50:50
}
}
}
medium: (struct){
#userHostPort: (string){ "^(:(?P<port>\\d+))?$" }
p1: (struct){
#Y: (_|_){
// [incomplete] medium.p1.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:58:7
// [incomplete] medium.p1.#Y: undefined field: port:
// ./in.cue:58:50
// medium.p1.#X.port: cyclic reference to field port:
// ./in.cue:70:4
}
Y: (struct){
}
Expand All @@ -417,8 +421,10 @@ Disjuncts: 215
}
p2: (struct){
#Y: (_|_){
// [incomplete] medium.p2.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:80:7
// [incomplete] medium.p2.#Y: undefined field: port:
// ./in.cue:80:50
// medium.p2.#X.port: cyclic reference to field port:
// ./in.cue:86:4
}
#X: (_|_){
// [incomplete] medium.p2.#X.port: cyclic reference to field port:
Expand All @@ -431,8 +437,10 @@ Disjuncts: 215
Y: (struct){
}
#Y: (_|_){
// [incomplete] medium.p3.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:108:7
// [incomplete] medium.p3.#Y: undefined field: port:
// ./in.cue:108:50
// medium.p3.#X.port: cyclic reference to field port:
// ./in.cue:114:4
}
#X: (_|_){
// [incomplete] medium.p3.#X.port: cyclic reference to field port:
Expand All @@ -447,8 +455,10 @@ Disjuncts: 215
// ./in.cue:134:4
}
#Y: (_|_){
// [incomplete] medium.p4.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:142:7
// [incomplete] medium.p4.#X.port: cyclic reference to field port:
// ./in.cue:134:4
// medium.p4.#Y: undefined field: port:
// ./in.cue:142:50
}
}
p5: (struct){
Expand All @@ -457,8 +467,8 @@ Disjuncts: 215
// ./in.cue:150:4
}
#Y: (_|_){
// [incomplete] medium.p5.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:158:7
// [incomplete] medium.p5.#Y: undefined field: port:
// ./in.cue:158:50
}
Y: (struct){
}
Expand All @@ -471,8 +481,8 @@ Disjuncts: 215
Y: (struct){
}
#Y: (_|_){
// [incomplete] medium.p6.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:186:7
// [incomplete] medium.p6.#Y: undefined field: port:
// ./in.cue:186:50
}
}
}
Expand All @@ -486,6 +496,8 @@ Disjuncts: 215
X: (_|_){
// [incomplete] large.p1.X: undefined field: port:
// ./in.cue:199:33
// large.p1.#X.port: cyclic reference to field port:
// ./in.cue:211:4
}
#X: (_|_){
// [incomplete] large.p1.#X.port: cyclic reference to field port:
Expand All @@ -494,14 +506,16 @@ Disjuncts: 215
host: (string){ "mod.test" }
}
#Y: (_|_){
// [incomplete] large.p1.X: undefined field: port:
// ./in.cue:199:33
// [incomplete] large.p1.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
// ./in.cue:231:7
}
}
p2: (struct){
X: (_|_){
// [incomplete] large.p2.X: undefined field: port:
// ./in.cue:235:33
// large.p2.#X.port: cyclic reference to field port:
// ./in.cue:252:4
}
Y: (struct){
userinfo: (string){ "user" }
Expand All @@ -522,6 +536,8 @@ Disjuncts: 215
X: (_|_){
// [incomplete] large.p3.X: undefined field: port:
// ./in.cue:276:33
// large.p3.#X.port: cyclic reference to field port:
// ./in.cue:288:4
}
#X: (_|_){
// [incomplete] large.p3.#X.port: cyclic reference to field port:
Expand All @@ -542,6 +558,8 @@ Disjuncts: 215
X: (_|_){
// [incomplete] large.p4.X: undefined field: port:
// ./in.cue:317:33
// large.p4.#X.port: cyclic reference to field port:
// ./in.cue:329:4
}
#X: (_|_){
// [incomplete] large.p4.#X.port: cyclic reference to field port:
Expand All @@ -564,7 +582,7 @@ Disjuncts: 215
diff old new
--- old
+++ new
@@ -1,35 +1,34 @@
@@ -1,35 +1,36 @@
(struct){
minimal: (struct){
a: (_|_){
Expand Down Expand Up @@ -602,8 +620,10 @@ diff old new
- // [cycle] small.p2.#Y: cycle with field #X.port:
- // ./in.cue:50:47
+ #Y: (_|_){
+ // [incomplete] small.p1.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:28:7
+ // [incomplete] small.p1.#Y: undefined field: port:
+ // ./in.cue:28:50
+ // small.p1.#X.port: cyclic reference to field port:
+ // ./in.cue:31:4
+ }
+ #X: (_|_){
+ // [incomplete] small.p1.#X.port: cyclic reference to field port:
Expand All @@ -616,12 +636,12 @@ diff old new
+ // ./in.cue:42:4
+ }
+ #Y: (_|_){
+ // [incomplete] small.p2.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:50:7
+ // [incomplete] small.p2.#Y: undefined field: port:
+ // ./in.cue:50:50
}
}
}
@@ -36,65 +35,61 @@
@@ -36,65 +37,69 @@
medium: (struct){
#userHostPort: (string){ "^(:(?P<port>\\d+))?$" }
p1: (struct){
Expand Down Expand Up @@ -652,31 +672,11 @@ diff old new
- Y: (_|_){
- // [cycle] medium.p3.#X: cycle with field Y.port:
- // ./in.cue:114:7
- }
- #Y: (_|_){
- // [incomplete] medium.p3.#Y: undefined field: port:
- // ./in.cue:108:47
- }
- #X: (_|_){
- // [cycle] medium.p3.#X: cycle with field Y.port:
- // ./in.cue:114:7
- }
- }
- p4: (struct){
- Y: (_|_){
- // [cycle] medium.p4.#X: cycle with field Y.port:
- // ./in.cue:134:7
- }
- #X: (_|_){
- // [cycle] medium.p4.#X: cycle with field Y.port:
- // ./in.cue:134:7
- }
- #Y: (_|_){
- // [cycle] medium.p4.#X: cycle with field Y.port:
- // ./in.cue:134:7
+ #Y: (_|_){
+ // [incomplete] medium.p1.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:58:7
+ // [incomplete] medium.p1.#Y: undefined field: port:
+ // ./in.cue:58:50
+ // medium.p1.#X.port: cyclic reference to field port:
+ // ./in.cue:70:4
+ }
+ Y: (struct){
+ }
Expand All @@ -687,8 +687,10 @@ diff old new
+ }
+ p2: (struct){
+ #Y: (_|_){
+ // [incomplete] medium.p2.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:80:7
+ // [incomplete] medium.p2.#Y: undefined field: port:
+ // ./in.cue:80:50
+ // medium.p2.#X.port: cyclic reference to field port:
+ // ./in.cue:86:4
+ }
+ #X: (_|_){
+ // [incomplete] medium.p2.#X.port: cyclic reference to field port:
Expand All @@ -699,10 +701,31 @@ diff old new
+ }
+ p3: (struct){
+ Y: (struct){
+ }
+ #Y: (_|_){
+ // [incomplete] medium.p3.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:108:7
}
#Y: (_|_){
// [incomplete] medium.p3.#Y: undefined field: port:
- // ./in.cue:108:47
- }
- #X: (_|_){
- // [cycle] medium.p3.#X: cycle with field Y.port:
- // ./in.cue:114:7
- }
- }
- p4: (struct){
- Y: (_|_){
- // [cycle] medium.p4.#X: cycle with field Y.port:
- // ./in.cue:134:7
- }
- #X: (_|_){
- // [cycle] medium.p4.#X: cycle with field Y.port:
- // ./in.cue:134:7
- }
- #Y: (_|_){
- // [cycle] medium.p4.#X: cycle with field Y.port:
- // ./in.cue:134:7
+ // ./in.cue:108:50
+ // medium.p3.#X.port: cyclic reference to field port:
+ // ./in.cue:114:4
+ }
+ #X: (_|_){
+ // [incomplete] medium.p3.#X.port: cyclic reference to field port:
Expand All @@ -717,8 +740,10 @@ diff old new
+ // ./in.cue:134:4
+ }
+ #Y: (_|_){
+ // [incomplete] medium.p4.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:142:7
+ // [incomplete] medium.p4.#X.port: cyclic reference to field port:
+ // ./in.cue:134:4
+ // medium.p4.#Y: undefined field: port:
+ // ./in.cue:142:50
}
}
p5: (struct){
Expand All @@ -733,12 +758,12 @@ diff old new
+ // ./in.cue:150:4
+ }
+ #Y: (_|_){
+ // [incomplete] medium.p5.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:158:7
+ // [incomplete] medium.p5.#Y: undefined field: port:
+ // ./in.cue:158:50
}
Y: (struct){
}
@@ -101,14 +96,14 @@
@@ -101,14 +106,14 @@
}
p6: (struct){
#X: (_|_){
Expand All @@ -756,12 +781,12 @@ diff old new
+ Y: (struct){
+ }
+ #Y: (_|_){
+ // [incomplete] medium.p6.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:186:7
+ // [incomplete] medium.p6.#Y: undefined field: port:
+ // ./in.cue:186:50
}
}
}
@@ -115,81 +110,83 @@
@@ -115,81 +120,91 @@
large: (struct){
#userHostPort: (string){ "^((?P<userinfo>[[:alnum:]]*)@)?(?P<host>[[:alnum:].]+)(:(?P<port>\\d+))?$" }
p1: (struct){
Expand Down Expand Up @@ -847,6 +872,8 @@ diff old new
+ X: (_|_){
+ // [incomplete] large.p1.X: undefined field: port:
+ // ./in.cue:199:33
+ // large.p1.#X.port: cyclic reference to field port:
+ // ./in.cue:211:4
+ }
+ #X: (_|_){
+ // [incomplete] large.p1.#X.port: cyclic reference to field port:
Expand All @@ -855,14 +882,16 @@ diff old new
+ host: (string){ "mod.test" }
+ }
+ #Y: (_|_){
+ // [incomplete] large.p1.X: undefined field: port:
+ // ./in.cue:199:33
+ // [incomplete] large.p1.#Y: error in call to regexp.FindNamedSubmatch: non-concrete value _:
+ // ./in.cue:231:7
+ }
+ }
+ p2: (struct){
+ X: (_|_){
+ // [incomplete] large.p2.X: undefined field: port:
+ // ./in.cue:235:33
+ // large.p2.#X.port: cyclic reference to field port:
+ // ./in.cue:252:4
+ }
+ Y: (struct){
+ userinfo: (string){ "user" }
Expand All @@ -883,6 +912,8 @@ diff old new
+ X: (_|_){
+ // [incomplete] large.p3.X: undefined field: port:
+ // ./in.cue:276:33
+ // large.p3.#X.port: cyclic reference to field port:
+ // ./in.cue:288:4
+ }
+ #X: (_|_){
+ // [incomplete] large.p3.#X.port: cyclic reference to field port:
Expand All @@ -903,6 +934,8 @@ diff old new
+ X: (_|_){
+ // [incomplete] large.p4.X: undefined field: port:
+ // ./in.cue:317:33
+ // large.p4.#X.port: cyclic reference to field port:
+ // ./in.cue:329:4
+ }
+ #X: (_|_){
+ // [incomplete] large.p4.#X.port: cyclic reference to field port:
Expand Down
Loading

0 comments on commit a3f1a0f

Please sign in to comment.