blob: 3c7ba0f459c9936fccd3b22c968ba2a5243ca7d4 [file] [log] [blame]
// Issue #852
-- in.cue --
#E: {
c: int
}
#A: {
b: int
q: {
#E
d: int
}
}
a: #A & {
b: 3
q: {
c: 2
e: 43
}
}
// `a` is evaluated through the comprehension first. Ensure that
// this does not bypass closedness checks.
issue852: {
#A: {
[=~"^a-z$"]: string
}
a: #A
a: Foo: "foo"
for k, v in a {
b: "\(k)": v
}
}
-- out/eval --
Errors:
a.q: field not allowed: e:
./in.cue:1:5
./in.cue:6:8
./in.cue:7:9
./in.cue:11:4
./in.cue:15:9
issue852.a: field not allowed: Foo:
./in.cue:22:7
./in.cue:26:6
./in.cue:28:6
Result:
(_|_){
// [eval]
#E: (#struct){
c: (int){ int }
}
#A: (#struct){
b: (int){ int }
q: (#struct){
c: (int){ int }
d: (int){ int }
}
}
a: (_|_){
// [eval]
b: (int){ 3 }
q: (_|_){
// [eval]
c: (int){ 2 }
d: (int){ int }
e: (_|_){
// [eval] a.q: field not allowed: e:
// ./in.cue:1:5
// ./in.cue:6:8
// ./in.cue:7:9
// ./in.cue:11:4
// ./in.cue:15:9
}
}
}
issue852: (_|_){
// [eval]
#A: (#struct){
}
a: (_|_){
// [eval]
Foo: (_|_){
// [eval] issue852.a: field not allowed: Foo:
// ./in.cue:22:7
// ./in.cue:26:6
// ./in.cue:28:6
}
}
b: (struct){
Foo: (string){ "foo" }
}
}
}
-- out/compile --
--- in.cue
{
#E: {
c: int
}
#A: {
b: int
q: {
2;#E
d: int
}
}
a: (〈0;#A & {
b: 3
q: {
c: 2
e: 43
}
})
issue852: {
#A: {
[=~"^a-z$"]: string
}
a: 0;#A
a: {
Foo: "foo"
}
for k, v in 0;a {
b: {
"\(〈2;k〉)": 2;v
}
}
}
}