# Tests that the or() builtin does not panic when called with a non-concrete
# (empty) list, such as when no comprehension entries are produced.
# The #JobID field should be an incomplete error in the base definition, but
# successfully resolve to a concrete string once jobs has at least one entry.
#name: or builtin should not fail on non-concrete empty list
#evalFull
-- in.cue --
#Workflow: {
	jobs: {
		[jobID=string]: {
		}
	}
	#JobID: or([for k, _ in jobs {k}]) @test(err, code=incomplete, contains="empty list in call to or", pos=[0:10])
	// #JobID is incomplete when jobs has no entries — or([]) is not allowed.
}

foo: #Workflow & {
	jobs: foo: {
	}
} @test(eq, {jobs: {foo: {}}, #JobID: "foo"})
-- out/errors.txt --
[incomplete] #Workflow.#JobID: error in call to or: empty list in call to or:
    ./in.cue:6:10
-- out/eval/stats --
Leaks:  2
Freed:  12
Reused: 5
Allocs: 9
Retain: 0

Unifications: 11
Conjuncts:    24
Disjuncts:    2

NumCloseIDs: 10
