cuelang.org/go@v0.13.0/cue/testdata/definitions/hidden.txtar (about) 1 exec cue eval ./pkg:foo 2 3 -- cue.mod/module.cue -- 4 module: "mod.test" 5 language: version: "v0.9.0" 6 -- in.cue -- 7 package foo 8 9 import "mod.test/pkg" 10 11 #def: { 12 _name: d: int 13 } 14 15 d: pkg.#D & {_name: d: int, _val: f: 4} 16 17 // TODO: this should fail, as the _name restricting it is in this 18 // package. 19 e: pkg.#D & #def & { 20 // This should fail as c is disallowed by the _name defined 21 // in this package 22 _name: c: int 23 24 // This should not fail, as this is a different _val 25 _val: g: int 26 } 27 28 f: pkg.#D & {_val: f: 4} 29 g: f._val 30 -- pkg/bar.cue -- 31 package pkg 32 33 #D: {_val: f: 3} 34 -- out/eval/stats -- 35 Leaks: 1 36 Freed: 29 37 Reused: 24 38 Allocs: 6 39 Retain: 2 40 41 Unifications: 30 42 Conjuncts: 40 43 Disjuncts: 31 44 -- out/evalalpha -- 45 Errors: 46 e._name.c: field not allowed: 47 ./in.cue:16:9 48 49 Result: 50 (_|_){ 51 // [eval] 52 #def: (#struct){ 53 _name(:foo): (#struct){ 54 d: (int){ int } 55 } 56 } 57 d: (#struct){ 58 _name(:foo): (struct){ 59 d: (int){ int } 60 } 61 _val(:foo): (struct){ 62 f: (int){ 4 } 63 } 64 _val(mod.test/pkg): (#struct){ 65 f: (int){ 3 } 66 } 67 } 68 e: (_|_){ 69 // [eval] 70 _name(:foo): (_|_){ 71 // [eval] 72 c: (_|_){ 73 // [eval] e._name.c: field not allowed: 74 // ./in.cue:16:9 75 } 76 d: (int){ int } 77 } 78 _val(:foo): (struct){ 79 g: (int){ int } 80 } 81 _val(mod.test/pkg): (#struct){ 82 f: (int){ 3 } 83 } 84 } 85 f: (#struct){ 86 _val(:foo): (struct){ 87 f: (int){ 4 } 88 } 89 _val(mod.test/pkg): (#struct){ 90 f: (int){ 3 } 91 } 92 } 93 g: ~(f._val(:foo)) 94 } 95 -- diff/-out/evalalpha<==>+out/eval -- 96 diff old new 97 --- old 98 +++ new 99 @@ -1,7 +1,5 @@ 100 Errors: 101 e._name.c: field not allowed: 102 - ./in.cue:6:9 103 - ./in.cue:13:13 104 ./in.cue:16:9 105 106 Result: 107 @@ -13,9 +11,6 @@ 108 } 109 } 110 d: (#struct){ 111 - _val(mod.test/pkg): (#struct){ 112 - f: (int){ 3 } 113 - } 114 _name(:foo): (struct){ 115 d: (int){ int } 116 } 117 @@ -22,35 +17,34 @@ 118 _val(:foo): (struct){ 119 f: (int){ 4 } 120 } 121 + _val(mod.test/pkg): (#struct){ 122 + f: (int){ 3 } 123 + } 124 } 125 e: (_|_){ 126 // [eval] 127 - _val(mod.test/pkg): (#struct){ 128 - f: (int){ 3 } 129 - } 130 _name(:foo): (_|_){ 131 // [eval] 132 - d: (int){ int } 133 c: (_|_){ 134 // [eval] e._name.c: field not allowed: 135 - // ./in.cue:6:9 136 - // ./in.cue:13:13 137 // ./in.cue:16:9 138 } 139 + d: (int){ int } 140 } 141 _val(:foo): (struct){ 142 g: (int){ int } 143 } 144 + _val(mod.test/pkg): (#struct){ 145 + f: (int){ 3 } 146 + } 147 } 148 f: (#struct){ 149 - _val(mod.test/pkg): (#struct){ 150 - f: (int){ 3 } 151 - } 152 - _val(:foo): (struct){ 153 - f: (int){ 4 } 154 - } 155 - } 156 - g: (struct){ 157 - f: (int){ 4 } 158 - } 159 + _val(:foo): (struct){ 160 + f: (int){ 4 } 161 + } 162 + _val(mod.test/pkg): (#struct){ 163 + f: (int){ 3 } 164 + } 165 + } 166 + g: ~(f._val(:foo)) 167 } 168 -- diff/todo/p2 -- 169 Reordering / missing positions. 170 -- out/eval -- 171 Errors: 172 e._name.c: field not allowed: 173 ./in.cue:6:9 174 ./in.cue:13:13 175 ./in.cue:16:9 176 177 Result: 178 (_|_){ 179 // [eval] 180 #def: (#struct){ 181 _name(:foo): (#struct){ 182 d: (int){ int } 183 } 184 } 185 d: (#struct){ 186 _val(mod.test/pkg): (#struct){ 187 f: (int){ 3 } 188 } 189 _name(:foo): (struct){ 190 d: (int){ int } 191 } 192 _val(:foo): (struct){ 193 f: (int){ 4 } 194 } 195 } 196 e: (_|_){ 197 // [eval] 198 _val(mod.test/pkg): (#struct){ 199 f: (int){ 3 } 200 } 201 _name(:foo): (_|_){ 202 // [eval] 203 d: (int){ int } 204 c: (_|_){ 205 // [eval] e._name.c: field not allowed: 206 // ./in.cue:6:9 207 // ./in.cue:13:13 208 // ./in.cue:16:9 209 } 210 } 211 _val(:foo): (struct){ 212 g: (int){ int } 213 } 214 } 215 f: (#struct){ 216 _val(mod.test/pkg): (#struct){ 217 f: (int){ 3 } 218 } 219 _val(:foo): (struct){ 220 f: (int){ 4 } 221 } 222 } 223 g: (struct){ 224 f: (int){ 4 } 225 } 226 } 227 -- out/compile -- 228 --- in.cue 229 { 230 #def: { 231 _name: { 232 d: int 233 } 234 } 235 d: (〈import;"mod.test/pkg"〉.#D & { 236 _name: { 237 d: int 238 } 239 _val: { 240 f: 4 241 } 242 }) 243 e: ((〈import;"mod.test/pkg"〉.#D & 〈0;#def〉) & { 244 _name: { 245 c: int 246 } 247 _val: { 248 g: int 249 } 250 }) 251 f: (〈import;"mod.test/pkg"〉.#D & { 252 _val: { 253 f: 4 254 } 255 }) 256 g: 〈0;f〉._val 257 }