#name: field comprehensions with templates
#evalFull
-- in.cue --
num: 1
a: {
	if num < 5 {
		[A=string]: [B=string]: {
			name: A
			kind: B
		}
	}
}
a: b: c: d: "bar"
-- out/def --
num: 1
a: {
	{[A=string]: {
		[B=string]: {
			name: A, kind: B
		}
	}}
	b: {
		{[B=string]: {
			name: "b", kind: B
		}}
		c: {
			name: "b"
			kind: "c"
			d:    "bar"
		}
	}
}
-- out/export --
num: 1
a: {
	b: {
		c: {
			name: "b"
			kind: "c"
			d:    "bar"
		}
	}
}
-- out/yaml --
num: 1
a:
  b:
    c:
      name: b
      kind: c
      d: bar
-- out/json --
{"num":1,"a":{"b":{"c":{"name":"b","kind":"c","d":"bar"}}}}
-- out/legacy-debug --
<0>{num: 1, a: <1>{[]: <2>(A: string)-><3>{[]: <4>(B: string)-><5>{name: <2>.A, kind: <4>.B}, }, b: <6>{[]: <7>(B: string)-><8>{name: <9>.A, kind: <7>.B}, c: <10>{name: "b", kind: "c", d: "bar"}}}}
-- out/compile --
--- in.cue
{
  num: 1
  a: {
    if (〈1;num〉 < 5) {
      [string]: {
        [string]: {
          name: 〈2;-〉
          kind: 〈1;-〉
        }
      }
    }
  }
  a: {
    b: {
      c: {
        d: "bar"
      }
    }
  }
}
-- out/eval/stats --
Leaks:  0
Freed:  8
Reused: 3
Allocs: 5
Retain: 0

Unifications: 8
Conjuncts:    12
Disjuncts:    8
-- out/eval --
(struct){
  num: (int){ 1 }
  a: (struct){
    b: (struct){
      c: (struct){
        d: (string){ "bar" }
        name: (string){ "b" }
        kind: (string){ "c" }
      }
    }
  }
}
