#name: optional expanded before lookup
#evalFull
-- in.cue --
test: [ID=_]: {
	name: ID
}

test: A: {
	field1: "1"
	field2: "2"
}

B: test.A & {}
-- out/def --
test: {
	{[ID=string]: {
		name: ID
	}}
	A: {
		name:   "A"
		field1: "1"
		field2: "2"
	}
}
B: test.A & {}
-- out/export --
test: {
	A: {
		name:   "A"
		field1: "1"
		field2: "2"
	}
}
B: {
	name:   "A"
	field1: "1"
	field2: "2"
}
-- out/yaml --
test:
  A:
    name: A
    field1: "1"
    field2: "2"
B:
  name: A
  field1: "1"
  field2: "2"
-- out/json --
{"test":{"A":{"name":"A","field1":"1","field2":"2"}},"B":{"name":"A","field1":"1","field2":"2"}}
-- out/legacy-debug --
<0>{test: <1>{[]: <2>(ID: string)-><3>{name: <2>.ID}, A: <4>{name: "A", field1: "1", field2: "2"}}, B: <5>{name: "A", field1: "1", field2: "2"}}
-- out/compile --
--- in.cue
{
  test: {
    [_]: {
      name: 〈1;-〉
    }
  }
  test: {
    A: {
      field1: "1"
      field2: "2"
    }
  }
  B: (〈0;test〉.A & {})
}
-- out/eval/stats --
Leaks:  0
Freed:  10
Reused: 6
Allocs: 4
Retain: 0

Unifications: 10
Conjuncts:    15
Disjuncts:    10
-- out/eval --
(struct){
  test: (struct){
    A: (struct){
      field1: (string){ "1" }
      field2: (string){ "2" }
      name: (string){ "A" }
    }
  }
  B: (struct){
    field1: (string){ "1" }
    field2: (string){ "2" }
    name: (string){ "A" }
  }
}
