blob: 3cea8a683c6c9019d8430d305c33f67d9c2242ca [file] [log] [blame]
# 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 `b` not allowed
d1.env: field `c` not allowed
Result:
(_|_){
// [eval]
#D1: (#struct){
env: (#struct){
a: (string){ "A" }
b: (string){ "B" }
}
#def: (#struct){
a: (string){ "A" }
b: (string){ "B" }
}
}
d1: (_|_){
// [eval]
env: (_|_){
// [eval] d1.env: field `c` not allowed
a: (string){ "A" }
b: (string){ "B" }
c: (string){ "C" }
}
#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] #D4.env: field `b` not allowed
a: (int){ int }
b: (int){ int }
}
}
#DC: (#struct){
a: (int){ int }
}
}