| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: combined definitions |
| #evalPartial |
| -- in.cue -- |
| // Allow combining of structs within a definition |
| #D1: { |
| env: a: "A" |
| env: b: "B" |
| #def: {a: "A"} |
| #def: {b: "B"} |
| } |
| |
| d1: #D1 & {env: c: "C"} |
| |
| #D2: { |
| a: int |
| } |
| #D2: { |
| b: int |
| } |
| |
| #D3: { |
| env: a: "A" |
| } |
| #D3: { |
| env: b: "B" |
| } |
| |
| #D4: { |
| env: #DC |
| env: b: int |
| } |
| |
| #DC: {a: int} |
| -- out/def -- |
| // Allow combining of structs within a definition |
| #D1: { |
| env: { |
| a: "A" |
| b: "B" |
| } |
| #def: { |
| a: "A" |
| b: "B" |
| } |
| } |
| d1: #D1 & { |
| env: { |
| c: "C" |
| } |
| } |
| #D2: { |
| a: int |
| b: int |
| } |
| #D3: { |
| env: { |
| a: "A" |
| b: "B" |
| } |
| } |
| #D4: { |
| env: _|_ // field "b" not allowed in closed struct |
| } |
| #DC: { |
| a: int |
| } |
| -- out/legacy-debug -- |
| <0>{#D1: <1>C{env: <2>C{a: "A", b: "B"}, #def: <3>C{a: "A", b: "B"}}, d1: <4>C{env: _|_("C":field "c" not allowed in closed struct), #def: <5>C{a: "A", b: "B"}}, #D2: <6>C{a: int, b: int}, #D3: <7>C{env: <8>C{a: "A", b: "B"}}, #D4: <9>C{env: _|_(int:field "b" not allowed in closed struct)}, #DC: <10>C{a: int}} |
| -- out/compile -- |
| --- in.cue |
| { |
| #D1: { |
| env: { |
| a: "A" |
| } |
| env: { |
| b: "B" |
| } |
| #def: { |
| a: "A" |
| } |
| #def: { |
| b: "B" |
| } |
| } |
| d1: (〈0;#D1〉 & { |
| env: { |
| c: "C" |
| } |
| }) |
| #D2: { |
| a: int |
| } |
| #D2: { |
| b: int |
| } |
| #D3: { |
| env: { |
| a: "A" |
| } |
| } |
| #D3: { |
| env: { |
| b: "B" |
| } |
| } |
| #D4: { |
| env: 〈1;#DC〉 |
| env: { |
| b: int |
| } |
| } |
| #DC: { |
| a: int |
| } |
| } |
| -- out/eval -- |
| Errors: |
| #D4.env: field not allowed: b: |
| ./in.cue:26:7 |
| ./in.cue:27:7 |
| ./in.cue:30:6 |
| d1.env: field not allowed: c: |
| ./in.cue:3:7 |
| ./in.cue:4:7 |
| ./in.cue:9:5 |
| ./in.cue:9:17 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| #D1: (#struct){ |
| env: (#struct){ |
| a: (string){ "A" } |
| b: (string){ "B" } |
| } |
| #def: (#struct){ |
| a: (string){ "A" } |
| b: (string){ "B" } |
| } |
| } |
| d1: (_|_){ |
| // [eval] |
| env: (_|_){ |
| // [eval] |
| a: (string){ "A" } |
| b: (string){ "B" } |
| c: (_|_){ |
| // [eval] d1.env: field not allowed: c: |
| // ./in.cue:3:7 |
| // ./in.cue:4:7 |
| // ./in.cue:9:5 |
| // ./in.cue:9:17 |
| } |
| } |
| #def: (#struct){ |
| a: (string){ "A" } |
| b: (string){ "B" } |
| } |
| } |
| #D2: (#struct){ |
| a: (int){ int } |
| b: (int){ int } |
| } |
| #D3: (#struct){ |
| env: (#struct){ |
| a: (string){ "A" } |
| b: (string){ "B" } |
| } |
| } |
| #D4: (_|_){ |
| // [eval] |
| env: (_|_){ |
| // [eval] |
| a: (int){ int } |
| b: (_|_){ |
| // [eval] #D4.env: field not allowed: b: |
| // ./in.cue:26:7 |
| // ./in.cue:27:7 |
| // ./in.cue:30:6 |
| } |
| } |
| } |
| #DC: (#struct){ |
| a: (int){ int } |
| } |
| } |