# Tests that evaluation of multi-file packages is deterministic regardless of
# field declaration order across files. The two input files a1.cue and a2.cue
# define the same fields x and y but in opposite orders; both must yield the same
# result. Also tests that #MCS (MultiCaseString, with uc: lc) correctly propagates
# concrete values when fact1 and fact2 cross-reference each other.
-- a1.cue --
package bug

y: fact2.uc @test(eq, "foo")
x: fact1.uc @test(eq, "foo")
-- a2.cue --
package bug

x: fact1.uc @test(eq, "foo")
y: fact2.uc @test(eq, "foo")
-- x.cue --
package bug

fact1: #MCS & {lc: fact2.lc} @test(eq, {lc: "foo", uc: "foo"}) @test(closed)
fact2: #MCS & {lc: "foo"}    @test(eq, {lc: "foo", uc: "foo"}) @test(closed)

#MCS: #MultiCaseString @test(eq, {lc: string, uc: string}) @test(closed) @test(shareID=MCS)
#MultiCaseString: {
	@test(shareID=MCS)
	@test(eq, {lc: string, uc: string})
	@test(closed)
	lc: string
	uc: lc
}
-- out/eval/stats --
Leaks:  0
Freed:  15
Reused: 8
Allocs: 7
Retain: 21

Unifications: 15
Conjuncts:    45
Disjuncts:    31
