# 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}])
	// #JobID is incomplete when jobs has no entries — or([]) is not allowed.
}

foo: #Workflow & {
	jobs: foo: {}
}
-- out/compile --
--- in.cue
{
  #Workflow: {
    jobs: {
      [string]: {}
    }
    #JobID: or([
      for k, _ in 〈1;jobs〉 {
        〈1;k〉
      },
    ])
  }
  foo: (〈0;#Workflow〉 & {
    jobs: {
      foo: {}
    }
  })
}
