-
Notifications
You must be signed in to change notification settings - Fork 352
evaluator: improve error "new field not allowed by earlier comprehension or reference cycle" #2615
Copy link
Copy link
Open
Description
What version of CUE are you using (cue version)?
$ cue version
cue version v0.0.0-20230926131433-a9a6965188f7
go version go1.21.1
-buildmode exe
-compiler gc
DefaultGODEBUG panicnil=1
CGO_ENABLED 1
GOARCH arm64
GOOS linux
vcs git
vcs.revision a9a6965188f751fca54251b803dfe4883c1f42bc
vcs.time 2023-09-26T13:14:33Z
vcs.modified false
Does this issue reproduce with the latest release?
Yes
What did you do?
exec cue export x.cue
-- x.cue --
repos?: [n=string]: {
trybot: *false | bool
name!: string
}
// Define the CUE repo
repos: "cue": {
trybot: true
}
// Template that for repos which define trybot == true
// that there should be an associated -trybot repo
for n, r in repos
if r.trybot {
repos: "\(n)-trybot": {
trybot: false
}
}
Playground: https://tip.cuelang.org/play/?id=obQKQuIiCIY#cue@export@cue
What did you expect to see?
Passing test, I think.
What did you see instead?
> exec cue export x.cue
[stderr]
repos: field "cue-trybot" not allowed by earlier comprehension or reference cycle
[exit status 1]
FAIL: /tmp/testscript2321507989/repro.txtar/script.txtar:1: unexpected command failure
The set of repos where trybot == true is disjoint from the set where disjoint == false. Hence it's possible to view this as not being a cycle, I think.
Reactions are currently unavailable