// Here one comprehension creates a number of distinct values, each of which
// with a disjunction, then another comprehension maps them back to the
// same value, creating a large number of disjunctions.
//
// The disjunctions cannot be identified as equal in the general case. If no
// care is taken, disjunction elimination will be exponential, causing over
// a billion disjuncts to process in the below example. With the proper
// optimizations, there is a small, constant number of disjunction ops per
// disjunct.
//
// Issue #651
-- in.cue --
list: [
	0, 1, 2, 3, 4, 5, 6, 7, 8,
	9, 10, 11, 12, 13, 14, 15, 16,
	17, 18, 19, 20, 21, 22, 23, 24,
	25, 26, 27, 28, 29, 30,
]

a: [X=string]: text: *"default" | string
a: {
	for i in list {
		"\(i)": text: string
	}
}

b: {
	for x in a {
		"\(x.text)": {text: x.text}
	}
} @test(eq, {default: {text: *"default" | string}})
-- out/eval/stats --
Leaks:  0
Freed:  283
Reused: 245
Allocs: 38
Retain: 0

Unifications: 99
Conjuncts:    530
Disjuncts:    184

NumCloseIDs: 35

ConjunctInfos:       194
MaxConjunctInfos:    32
MaxReqSets:          2
