# 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
x: fact1.uc
-- a2.cue --
package bug

x: fact1.uc
y: fact2.uc
-- x.cue --
package bug

fact1: #MCS & {lc: fact2.lc}
fact2: #MCS & {lc: "foo"}

#MCS: #MultiCaseString
#MultiCaseString: {
	lc: string
	uc: lc
}
-- out/compile --
--- a1.cue
{
  y: 〈0;fact2〉.uc
  x: 〈0;fact1〉.uc
}
--- a2.cue
{
  x: 〈0;fact1〉.uc
  y: 〈0;fact2〉.uc
}
--- x.cue
{
  fact1: (〈0;#MCS〉 & {
    lc: 〈1;fact2〉.lc
  })
  fact2: (〈0;#MCS〉 & {
    lc: "foo"
  })
  #MCS: 〈0;#MultiCaseString〉
  #MultiCaseString: {
    lc: string
    uc: 〈0;lc〉
  }
}
