| -- in.cue -- |
| a: { |
| foo: a: 1 |
| [X = =~"foo"]: { |
| b: 1 |
| name: X |
| } |
| } |
| d: a & { |
| "foobar": { |
| c: 2 |
| } |
| } |
| |
| t1: { |
| #a: { |
| [>"e" & <"z"]: int |
| } |
| b: #a & { f: 4 } |
| c: #a & { z: 4 } |
| } |
| |
| t2: { |
| #a: { |
| ["x" | "y"]: int |
| } |
| b: #a & { x: 4 } |
| c: #a & { z: 4 } |
| } |
| |
| -- out/eval -- |
| Errors: |
| t1.c: field `z` not allowed: |
| ./in.cue:15:7 |
| ./in.cue:19:6 |
| ./in.cue:19:13 |
| t2.c: field `z` not allowed: |
| ./in.cue:23:7 |
| ./in.cue:27:6 |
| ./in.cue:27:13 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| a: (struct){ |
| foo: (struct){ |
| a: (int){ 1 } |
| b: (int){ 1 } |
| name: (string){ "foo" } |
| } |
| } |
| d: (struct){ |
| foo: (struct){ |
| a: (int){ 1 } |
| b: (int){ 1 } |
| name: (string){ "foo" } |
| } |
| foobar: (struct){ |
| c: (int){ 2 } |
| b: (int){ 1 } |
| name: (string){ "foobar" } |
| } |
| } |
| t1: (_|_){ |
| // [eval] |
| #a: (#struct){ |
| } |
| b: (#struct){ |
| f: (int){ 4 } |
| } |
| c: (_|_){ |
| // [eval] |
| z: (_|_){ |
| // [eval] t1.c: field `z` not allowed: |
| // ./in.cue:15:7 |
| // ./in.cue:19:6 |
| // ./in.cue:19:13 |
| } |
| } |
| } |
| t2: (_|_){ |
| // [eval] |
| #a: (#struct){ |
| } |
| b: (#struct){ |
| x: (int){ 4 } |
| } |
| c: (_|_){ |
| // [eval] |
| z: (_|_){ |
| // [eval] t2.c: field `z` not allowed: |
| // ./in.cue:23:7 |
| // ./in.cue:27:6 |
| // ./in.cue:27:13 |
| } |
| } |
| } |
| } |
| -- out/compile -- |
| --- in.cue |
| { |
| a: { |
| foo: { |
| a: 1 |
| } |
| [=~"foo"]: { |
| b: 1 |
| name: 〈1;-〉 |
| } |
| } |
| d: (〈0;a〉 & { |
| foobar: { |
| c: 2 |
| } |
| }) |
| t1: { |
| #a: { |
| [(>"e" & <"z")]: int |
| } |
| b: (〈0;#a〉 & { |
| f: 4 |
| }) |
| c: (〈0;#a〉 & { |
| z: 4 |
| }) |
| } |
| t2: { |
| #a: { |
| [("x"|"y")]: int |
| } |
| b: (〈0;#a〉 & { |
| x: 4 |
| }) |
| c: (〈0;#a〉 & { |
| z: 4 |
| }) |
| } |
| } |