# 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: | |
field `c` not allowed | |
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] field `c` not allowed | |
field: (int){ int } | |
c: (int){ 2 } | |
b: (int){ 2 } | |
} | |
baz: (#struct){ | |
field: (int){ int } | |
b: (int){ 2 } | |
} | |
} |