| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: definitions with disjunctions |
| #evalPartial |
| -- in.cue -- |
| #Foo: { |
| field: int |
| |
| {a: 1} | |
| {b: 2} |
| } |
| |
| foo: #Foo |
| foo: {a: 1} |
| |
| bar: #Foo |
| bar: {c: 2} |
| |
| baz: #Foo |
| baz: {b: 2} |
| -- out/def -- |
| #Foo: { |
| field: int |
| a: 1 |
| } | { |
| field: int |
| b: 2 |
| } |
| foo: #Foo & { |
| a: 1 |
| } |
| bar: _|_ // |
| baz: #Foo & { |
| b: 2 |
| } |
| -- out/legacy-debug -- |
| <0>{#Foo: (<1>C{field: int, a: 1} | <2>C{field: int, b: 2}), foo: <3>C{field: int, a: 1}, bar: _|_(2:empty disjunction: field "c" not allowed in closed struct), baz: <4>C{field: int, b: 2}} |
| -- out/compile -- |
| --- in.cue |
| { |
| #Foo: { |
| field: int |
| ({ |
| a: 1 |
| }|{ |
| b: 2 |
| }) |
| } |
| foo: 〈0;#Foo〉 |
| foo: { |
| a: 1 |
| } |
| bar: 〈0;#Foo〉 |
| bar: { |
| c: 2 |
| } |
| baz: 〈0;#Foo〉 |
| baz: { |
| b: 2 |
| } |
| } |
| -- out/eval -- |
| Errors: |
| bar: 1 errors in empty disjunction: |
| bar: field c not allowed: |
| ./in.cue:1:7 |
| ./in.cue:4:2 |
| ./in.cue:11:6 |
| ./in.cue:12:7 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| #Foo: (#struct){ |((#struct){ |
| field: (int){ int } |
| a: (int){ 1 } |
| }, (#struct){ |
| field: (int){ int } |
| b: (int){ 2 } |
| }) } |
| foo: (#struct){ |
| field: (int){ int } |
| a: (int){ 1 } |
| } |
| bar: (_|_){ |
| // [eval] bar: 1 errors in empty disjunction: |
| // bar: field c not allowed: |
| // ./in.cue:1:7 |
| // ./in.cue:4:2 |
| // ./in.cue:11:6 |
| // ./in.cue:12:7 |
| field: (int){ int } |
| c: (_|_){ |
| // [eval] bar: field c not allowed: |
| // ./in.cue:1:7 |
| // ./in.cue:4:2 |
| // ./in.cue:5:2 |
| // ./in.cue:11:6 |
| // ./in.cue:12:7 |
| } |
| b: (int){ 2 } |
| } |
| baz: (#struct){ |
| field: (int){ int } |
| b: (int){ 2 } |
| } |
| } |