github.com/solo-io/cue@v0.4.7/cue/testdata/definitions/hidden.txtar (about) 1 cue eval ./pkg:foo 2 3 -- cue.mod/module.cue -- 4 module: "example.com" 5 6 -- in.cue -- 7 package foo 8 9 import "example.com/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 31 -- pkg/bar.cue -- 32 package pkg 33 34 #D: { _val: f: 3 } 35 36 -- out/eval -- 37 Errors: 38 e._name: field not allowed: c: 39 ./in.cue:6:10 40 ./in.cue:13:13 41 ./in.cue:16:10 42 43 Result: 44 (_|_){ 45 // [eval] 46 #def: (#struct){ 47 _name(:foo): (#struct){ 48 d: (int){ int } 49 } 50 } 51 d: (#struct){ 52 _val(example.com/pkg): (#struct){ 53 f: (int){ 3 } 54 } 55 _name(:foo): (struct){ 56 d: (int){ int } 57 } 58 _val(:foo): (struct){ 59 f: (int){ 4 } 60 } 61 } 62 e: (_|_){ 63 // [eval] 64 _val(example.com/pkg): (#struct){ 65 f: (int){ 3 } 66 } 67 _name(:foo): (_|_){ 68 // [eval] 69 d: (int){ int } 70 c: (_|_){ 71 // [eval] e._name: field not allowed: c: 72 // ./in.cue:6:10 73 // ./in.cue:13:13 74 // ./in.cue:16:10 75 } 76 } 77 _val(:foo): (struct){ 78 g: (int){ int } 79 } 80 } 81 f: (#struct){ 82 _val(example.com/pkg): (#struct){ 83 f: (int){ 3 } 84 } 85 _val(:foo): (struct){ 86 f: (int){ 4 } 87 } 88 } 89 g: (struct){ 90 f: (int){ 4 } 91 } 92 } 93 -- out/compile -- 94 --- in.cue 95 { 96 #def: { 97 _name: { 98 d: int 99 } 100 } 101 d: (〈import;"example.com/pkg"〉.#D & { 102 _name: { 103 d: int 104 } 105 _val: { 106 f: 4 107 } 108 }) 109 e: ((〈import;"example.com/pkg"〉.#D & 〈0;#def〉) & { 110 _name: { 111 c: int 112 } 113 _val: { 114 g: int 115 } 116 }) 117 f: (〈import;"example.com/pkg"〉.#D & { 118 _val: { 119 f: 4 120 } 121 }) 122 g: 〈0;f〉._val 123 }