| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: closing with comprehensions |
| #evalPartial |
| -- in.cue -- |
| #A: {f1: int, f2: int} |
| |
| for k, v in {f3: int} { |
| a: #A & {"\(k)": v} |
| } |
| |
| #B: { |
| for k, v in {f1: int} { |
| "\(k)": v |
| } |
| } |
| |
| #C: { |
| f1: _ |
| for k, v in {f1: int} { |
| "\(k)": v |
| } |
| } |
| |
| #D: { |
| for k, v in {f1: int} { |
| "\(k)": v |
| } |
| ... |
| } |
| |
| #E: #A & { |
| for k, v in {f3: int} { |
| "\(k)": v |
| } |
| } |
| -- out/def -- |
| #A: { |
| f1: int |
| f2: int |
| } |
| a: _|_ // field "f3" not allowed in closed struct |
| #B: { |
| f1: v |
| } |
| #C: { |
| f1: { |
| _ |
| v |
| ... |
| } |
| } |
| #D: { |
| f1: v |
| ... |
| } |
| #E: _|_ // field "f3" not allowed in closed struct |
| -- out/legacy-debug -- |
| <0>{#A: <1>C{f1: int, f2: int}, a: _|_(<2>.v:field "f3" not allowed in closed struct), #B: <3>C{f1: int}, #C: <4>C{f1: int}, #D: <5>{f1: int, ...}, #E: _|_(<6>.v:field "f3" not allowed in closed struct)} |
| -- out/compile -- |
| --- in.cue |
| { |
| #A: { |
| f1: int |
| f2: int |
| } |
| for k, v in { |
| f3: int |
| } { |
| a: (〈2;#A〉 & { |
| "\(〈2;k〉)": 〈2;v〉 |
| }) |
| } |
| #B: { |
| for k, v in { |
| f1: int |
| } { |
| "\(〈1;k〉)": 〈1;v〉 |
| } |
| } |
| #C: { |
| f1: _ |
| for k, v in { |
| f1: int |
| } { |
| "\(〈1;k〉)": 〈1;v〉 |
| } |
| } |
| #D: { |
| for k, v in { |
| f1: int |
| } { |
| "\(〈1;k〉)": 〈1;v〉 |
| } |
| ... |
| } |
| #E: (〈0;#A〉 & { |
| for k, v in { |
| f3: int |
| } { |
| "\(〈1;k〉)": 〈1;v〉 |
| } |
| }) |
| } |
| -- out/eval -- |
| Errors: |
| #E: field not allowed: f3: |
| ./in.cue:1:5 |
| ./in.cue:27:5 |
| ./in.cue:27:10 |
| ./in.cue:28:2 |
| ./in.cue:29:3 |
| a: field not allowed: f3: |
| ./in.cue:1:5 |
| ./in.cue:3:1 |
| ./in.cue:4:5 |
| ./in.cue:4:11 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| #A: (#struct){ |
| f1: (int){ int } |
| f2: (int){ int } |
| } |
| #B: (#struct){ |
| f1: (int){ int } |
| } |
| #C: (#struct){ |
| f1: (int){ int } |
| } |
| #D: (#struct){ |
| f1: (int){ int } |
| } |
| #E: (_|_){ |
| // [eval] |
| f1: (int){ int } |
| f2: (int){ int } |
| f3: (_|_){ |
| // [eval] #E: field not allowed: f3: |
| // ./in.cue:1:5 |
| // ./in.cue:27:5 |
| // ./in.cue:27:10 |
| // ./in.cue:28:2 |
| // ./in.cue:29:3 |
| } |
| } |
| a: (_|_){ |
| // [eval] |
| f1: (int){ int } |
| f2: (int){ int } |
| f3: (_|_){ |
| // [eval] a: field not allowed: f3: |
| // ./in.cue:1:5 |
| // ./in.cue:3:1 |
| // ./in.cue:4:5 |
| // ./in.cue:4:11 |
| } |
| } |
| } |