blob: 501576eabaf080116ca60c458cf821e68da51fd6 [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: {}
}
issue642: {
test: close({
a: _
b: x: _
} & {
[string]: y: _
})
test: a: x: _
test: b: x: _
}
// Issue 642
withSubfields: {
test: close({
a: _
b: x: _
[string]: y: _
})
test: a: x: _
test: b: x: _
}
-- 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){
}
}
issue642: (struct){
test: (#struct){
a: (struct){
y: (_){ _ }
x: (_){ _ }
}
b: (struct){
x: (_){ _ }
y: (_){ _ }
}
}
}
withSubfields: (struct){
test: (#struct){
a: (struct){
y: (_){ _ }
x: (_){ _ }
}
b: (struct){
x: (_){ _ }
y: (_){ _ }
}
}
}
}
-- 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: {}
}
}
}
issue642: {
test: close(({
a: _
b: {
x: _
}
} & {
[string]: {
y: _
}
}))
test: {
a: {
x: _
}
}
test: {
b: {
x: _
}
}
}
withSubfields: {
test: close({
a: _
b: {
x: _
}
[string]: {
y: _
}
})
test: {
a: {
x: _
}
}
test: {
b: {
x: _
}
}
}
}