// 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 } } dynamic: { #D: { key: "foo" (key): int } d: #D & {foo: 3} } -- out/eval/stats -- Leaks: 0 Freed: 26 Reused: 22 Allocs: 4 Retain: 0 Unifications: 26 Conjuncts: 39 Disjuncts: 26 -- out/evalalpha -- Errors: a.q.e: field not allowed: ./in.cue:7:3 ./in.cue:15:3 issue852.a.Foo: field not allowed: ./in.cue:23:16 ./in.cue:28:5 Result: (_|_){ // [eval] #E: (#struct){ c: (int){ int } } #A: (#struct){ b: (int){ int } q: (#struct){ d: (int){ int } c: (int){ int } } } a: (_|_){ // [eval] b: (int){ 3 } q: (_|_){ // [eval] c: (int){ 2 } e: (_|_){ // [eval] a.q.e: field not allowed: // ./in.cue:7:3 // ./in.cue:15:3 } d: (int){ int } } } issue852: (_|_){ // [eval] issue852.a.Foo: field not allowed: // ./in.cue:23:16 // ./in.cue:28:5 #A: (#struct){ } a: (_|_){ // [eval] Foo: (_|_){ // [eval] issue852.a.Foo: field not allowed: // ./in.cue:23:16 // ./in.cue:28:5 } } } dynamic: (struct){ #D: (#struct){ key: (string){ "foo" } foo: (int){ int } } d: (#struct){ foo: (int){ 3 } key: (string){ "foo" } } } } -- diff/-out/evalalpha<==>+out/eval -- diff old new --- old +++ new @@ -1,13 +1,9 @@ Errors: a.q.e: field not allowed: - ./in.cue:1:5 - ./in.cue:6:5 ./in.cue:7:3 - ./in.cue:11:4 ./in.cue:15:3 issue852.a.Foo: field not allowed: - ./in.cue:22:6 - ./in.cue:26:5 + ./in.cue:23:16 ./in.cue:28:5 Result: @@ -19,8 +15,8 @@ #A: (#struct){ b: (int){ int } q: (#struct){ + d: (int){ int } c: (int){ int } - d: (int){ int } } } a: (_|_){ @@ -29,21 +25,17 @@ q: (_|_){ // [eval] c: (int){ 2 } - d: (int){ int } e: (_|_){ // [eval] a.q.e: field not allowed: - // ./in.cue:1:5 - // ./in.cue:6:5 // ./in.cue:7:3 - // ./in.cue:11:4 // ./in.cue:15:3 } + d: (int){ int } } } issue852: (_|_){ // [eval] issue852.a.Foo: field not allowed: - // ./in.cue:22:6 - // ./in.cue:26:5 + // ./in.cue:23:16 // ./in.cue:28:5 #A: (#struct){ } @@ -51,8 +43,7 @@ // [eval] Foo: (_|_){ // [eval] issue852.a.Foo: field not allowed: - // ./in.cue:22:6 - // ./in.cue:26:5 + // ./in.cue:23:16 // ./in.cue:28:5 } } @@ -63,8 +54,8 @@ foo: (int){ int } } d: (#struct){ - key: (string){ "foo" } foo: (int){ 3 } + key: (string){ "foo" } } } } -- diff/todo/p2 -- Positions / reordering -- out/eval -- Errors: a.q.e: field not allowed: ./in.cue:1:5 ./in.cue:6:5 ./in.cue:7:3 ./in.cue:11:4 ./in.cue:15:3 issue852.a.Foo: field not allowed: ./in.cue:22:6 ./in.cue:26:5 ./in.cue:28:5 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.e: field not allowed: // ./in.cue:1:5 // ./in.cue:6:5 // ./in.cue:7:3 // ./in.cue:11:4 // ./in.cue:15:3 } } } issue852: (_|_){ // [eval] issue852.a.Foo: field not allowed: // ./in.cue:22:6 // ./in.cue:26:5 // ./in.cue:28:5 #A: (#struct){ } a: (_|_){ // [eval] Foo: (_|_){ // [eval] issue852.a.Foo: field not allowed: // ./in.cue:22:6 // ./in.cue:26:5 // ./in.cue:28:5 } } } dynamic: (struct){ #D: (#struct){ key: (string){ "foo" } foo: (int){ int } } d: (#struct){ key: (string){ "foo" } foo: (int){ 3 } } } } -- 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〉 } } } dynamic: { #D: { key: "foo" 〈0;key〉: int } d: (〈0;#D〉 & { foo: 3 }) } }