blob: badd5f16bab1ad98ffdd1179a3fba9ab92555e2b [file] [log] [blame]
-- in.cue --
a: close({
a: b: int
})
b: a & { x: int } // err
c: a & { a: c: int } // okay (non-recursive close)
inDisjunctions: {
x: [string]: #Def
#Def: [string]: {
a: b: true
let X = a
close({uint: a: b: X.b}) | close({string: a: b: true})
}
x: socket: string: {}
x: syslog: x.socket
x: syslog: xxx: {}
}
-- out/eval --
Errors:
b: field `x` not allowed:
./in.cue:1:10
./in.cue:5:4
./in.cue:5:10
Result:
(_|_){
// [eval]
a: (#struct){
a: (#struct){
b: (int){ int }
}
}
b: (_|_){
// [eval]
a: (#struct){
b: (int){ int }
}
x: (_|_){
// [eval] b: field `x` not allowed:
// ./in.cue:1:10
// ./in.cue:5:4
// ./in.cue:5:10
}
}
c: (#struct){
a: (#struct){
b: (int){ int }
c: (int){ int }
}
}
inDisjunctions: (struct){
x: (struct){
socket: (#struct){
string: (struct){ |((#struct){
a: (#struct){
b: (bool){ true }
}
uint: (#struct){
a: (#struct){
b: (bool){ true }
}
}
}, (#struct){
a: (#struct){
b: (bool){ true }
}
string: (#struct){
a: (#struct){
b: (bool){ true }
}
}
}) }
}
syslog: (#struct){
string: (struct){ |((#struct){
a: (#struct){
b: (bool){ true }
}
uint: (#struct){
a: (#struct){
b: (bool){ true }
}
}
}, (#struct){
a: (#struct){
b: (bool){ true }
}
string: (#struct){
a: (#struct){
b: (bool){ true }
}
}
}) }
xxx: (struct){ |((#struct){
a: (#struct){
b: (bool){ true }
}
uint: (#struct){
a: (#struct){
b: (bool){ true }
}
}
}, (#struct){
a: (#struct){
b: (bool){ true }
}
string: (#struct){
a: (#struct){
b: (bool){ true }
}
}
}) }
}
}
#Def: (#struct){
}
}
}
-- out/compile --
--- in.cue
{
a: close({
a: {
b: int
}
})
b: (〈0;a & {
x: int
})
c: (〈0;a & {
a: {
c: int
}
})
inDisjunctions: {
x: {
[string]: 1;#Def
}
#Def: {
[string]: {
a: {
b: true
}
(close({
uint: {
a: {
b: 3;let X〉.b
}
}
})|close({
string: {
a: {
b: true
}
}
}))
}
}
x: {
socket: {
string: {}
}
}
x: {
syslog: 1;x〉.socket
}
x: {
syslog: {
xxx: {}
}
}
}
}