cuelang.org/go@v0.13.0/cue/testdata/definitions/037_conjunction_of_optional_sets.txtar (about) 1 #name: conjunction of optional sets 2 #evalFull 3 -- in.cue -- 4 #A: { 5 [=~"^[a-s]*$"]: int 6 } 7 #B: { 8 [=~"^[m-z]*$"]: int 9 } 10 11 #C: #A & #B 12 c: #C & {aaa: 3} 13 14 #D: {#A & #B} 15 d: #D & {aaa: 3} 16 -- out/def -- 17 #A: { 18 [=~"^[a-s]*$"]: int 19 } 20 #B: { 21 [=~"^[m-z]*$"]: int 22 } 23 #C: #A & #B 24 c: _|_ // field "aaa" not allowed in closed struct 25 #D: { 26 #A & #B 27 } 28 d: _|_ // field "aaa" not allowed in closed struct 29 -- out/legacy-debug -- 30 <0>{#A: <1>C{[=~"^[a-s]*$"]: <2>(_: string)->int, }, #B: <3>C{[=~"^[m-z]*$"]: <4>(_: string)->int, }, #C: <5>C{(C{[=~"^[a-s]*$"]: <6>(_: string)->int} & C{[=~"^[m-z]*$"]: <7>(_: string)->int}), }, c: _|_(3:field "aaa" not allowed in closed struct), #D: <8>C{(C{[=~"^[a-s]*$"]: <9>(_: string)->int} & C{[=~"^[m-z]*$"]: <10>(_: string)->int}), }, d: _|_(3:field "aaa" not allowed in closed struct)} 31 -- out/compile -- 32 --- in.cue 33 { 34 #A: { 35 [=~"^[a-s]*$"]: int 36 } 37 #B: { 38 [=~"^[m-z]*$"]: int 39 } 40 #C: (〈0;#A〉 & 〈0;#B〉) 41 c: (〈0;#C〉 & { 42 aaa: 3 43 }) 44 #D: { 45 (〈1;#A〉 & 〈1;#B〉) 46 } 47 d: (〈0;#D〉 & { 48 aaa: 3 49 }) 50 } 51 -- out/eval/stats -- 52 Leaks: 0 53 Freed: 9 54 Reused: 6 55 Allocs: 3 56 Retain: 0 57 58 Unifications: 9 59 Conjuncts: 29 60 Disjuncts: 9 61 -- out/evalalpha -- 62 Errors: 63 c.aaa: field not allowed: 64 ./in.cue:2:2 65 ./in.cue:9:11 66 d.aaa: field not allowed: 67 ./in.cue:2:2 68 ./in.cue:12:10 69 70 Result: 71 (_|_){ 72 // [eval] 73 #A: (#struct){ 74 } 75 #B: (#struct){ 76 } 77 #C: (#struct){ 78 } 79 c: (_|_){ 80 // [eval] 81 aaa: (_|_){ 82 // [eval] c.aaa: field not allowed: 83 // ./in.cue:2:2 84 // ./in.cue:9:11 85 } 86 } 87 #D: (#struct){ 88 } 89 d: (_|_){ 90 // [eval] 91 aaa: (_|_){ 92 // [eval] d.aaa: field not allowed: 93 // ./in.cue:2:2 94 // ./in.cue:12:10 95 } 96 } 97 } 98 -- diff/-out/evalalpha<==>+out/eval -- 99 diff old new 100 --- old 101 +++ new 102 @@ -1,18 +1,9 @@ 103 Errors: 104 c.aaa: field not allowed: 105 ./in.cue:2:2 106 - ./in.cue:4:5 107 - ./in.cue:8:5 108 - ./in.cue:8:10 109 - ./in.cue:9:5 110 ./in.cue:9:11 111 d.aaa: field not allowed: 112 ./in.cue:2:2 113 - ./in.cue:4:5 114 - ./in.cue:11:5 115 - ./in.cue:11:6 116 - ./in.cue:11:11 117 - ./in.cue:12:4 118 ./in.cue:12:10 119 120 Result: 121 @@ -29,10 +20,6 @@ 122 aaa: (_|_){ 123 // [eval] c.aaa: field not allowed: 124 // ./in.cue:2:2 125 - // ./in.cue:4:5 126 - // ./in.cue:8:5 127 - // ./in.cue:8:10 128 - // ./in.cue:9:5 129 // ./in.cue:9:11 130 } 131 } 132 @@ -43,11 +30,6 @@ 133 aaa: (_|_){ 134 // [eval] d.aaa: field not allowed: 135 // ./in.cue:2:2 136 - // ./in.cue:4:5 137 - // ./in.cue:11:5 138 - // ./in.cue:11:6 139 - // ./in.cue:11:11 140 - // ./in.cue:12:4 141 // ./in.cue:12:10 142 } 143 } 144 -- diff/todo/p2 -- 145 Missing positions. 146 -- out/eval -- 147 Errors: 148 c.aaa: field not allowed: 149 ./in.cue:2:2 150 ./in.cue:4:5 151 ./in.cue:8:5 152 ./in.cue:8:10 153 ./in.cue:9:5 154 ./in.cue:9:11 155 d.aaa: field not allowed: 156 ./in.cue:2:2 157 ./in.cue:4:5 158 ./in.cue:11:5 159 ./in.cue:11:6 160 ./in.cue:11:11 161 ./in.cue:12:4 162 ./in.cue:12:10 163 164 Result: 165 (_|_){ 166 // [eval] 167 #A: (#struct){ 168 } 169 #B: (#struct){ 170 } 171 #C: (#struct){ 172 } 173 c: (_|_){ 174 // [eval] 175 aaa: (_|_){ 176 // [eval] c.aaa: field not allowed: 177 // ./in.cue:2:2 178 // ./in.cue:4:5 179 // ./in.cue:8:5 180 // ./in.cue:8:10 181 // ./in.cue:9:5 182 // ./in.cue:9:11 183 } 184 } 185 #D: (#struct){ 186 } 187 d: (_|_){ 188 // [eval] 189 aaa: (_|_){ 190 // [eval] d.aaa: field not allowed: 191 // ./in.cue:2:2 192 // ./in.cue:4:5 193 // ./in.cue:11:5 194 // ./in.cue:11:6 195 // ./in.cue:11:11 196 // ./in.cue:12:4 197 // ./in.cue:12:10 198 } 199 } 200 }