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