# Tests that list.FlattenN does not spuriously report an "incomplete value"
# error when its input list is derived from a definition field passed through
# a conjunction. Previously FlattenN failed when the list element was abstract.
# https://cuelang.org/issue/332
-- in.cue --
import "list"

#d: {
	#x: string
	result: [#x]
}
#foo: {
	X=#x: _
	y:    list.FlattenN((#d & {#x: X}).result, 1)
}
r: #foo & {
	#x: "hello"
} @test(eq, {#x: "hello", y: ["hello"]})
-- out/eval/stats --
Leaks:  0
Freed:  21
Reused: 11
Allocs: 10
Retain: 0

Unifications: 19
Conjuncts:    44
Disjuncts:    0

NumCloseIDs: 15
