-- references.cue --
missingField: {
	a: {}
	r: a.b
}

missingFieldClosed: {
	#a: {}
	r: #a.b
}

missingFieldNested: {
	a: {}
	// Must refer to `b` in error
	r: a.b.c
}

missingFieldNestedClosed: {
	#a: {}

	// Must refer to `d` in error
	r: #a.d.c
}

missingFieldNestedInInterpolation: {
	a: {}
	// Must refer to `b` in error
	r1: "\(a.b.c)"
	// Must refer to `d` in error: in case only one error is shown for a
	// a location, ensure it doesn't alphabetically sort and pick `c` instead.
	r2: "\(a.d.c)"
}
-- out/compile --
--- references.cue
{
  missingField: {
    a: {}
    r: 〈0;a〉.b
  }
  missingFieldClosed: {
    #a: {}
    r: 〈0;#a〉.b
  }
  missingFieldNested: {
    a: {}
    r: 〈0;a〉.b.c
  }
  missingFieldNestedClosed: {
    #a: {}
    r: 〈0;#a〉.d.c
  }
  missingFieldNestedInInterpolation: {
    a: {}
    r1: "\(〈0;a〉.b.c)"
    r2: "\(〈0;a〉.d.c)"
  }
}
