blob: 1072d238d8aacba5731e86618ac013f397b7c6b9 [file] [log] [blame]
-- in.cue --
#T: {
if true {
// We'd like to restrict the possible members of x in this case,
// but this doesn't work.
x: close({
f1: int
})
}
x: _
}
z: #T & {
x: {
f1: 99
f2: "i want to disallow this"
}
}
t: #C
#C: {
if true {
p: _
}
}
t: p: "foo"
-- out/eval --
Errors:
z.x: field f2 not allowed:
./in.cue:2:2
./in.cue:5:12
./in.cue:11:4
./in.cue:14:3
Result:
(_|_){
// [eval]
#T: (#struct){
x: (#struct){
f1: (int){ int }
}
}
z: (_|_){
// [eval]
x: (_|_){
// [eval]
f1: (int){ 99 }
f2: (_|_){
// [eval] z.x: field f2 not allowed:
// ./in.cue:2:2
// ./in.cue:5:12
// ./in.cue:11:4
// ./in.cue:14:3
}
}
}
t: (#struct){
p: (string){ "foo" }
}
#C: (#struct){
p: (_){ _ }
}
}
-- out/compile --
--- in.cue
{
#T: {
if true {
x: close({
f1: int
})
}
x: _
}
z: (〈0;#T & {
x: {
f1: 99
f2: "i want to disallow this"
}
})
t: 0;#C
#C: {
if true {
p: _
}
}
t: {
p: "foo"
}
}