github.com/solo-io/cue@v0.4.7/cue/testdata/definitions/032_definitions_with_embedding.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: definitions with embedding 4 #evalPartial 5 -- in.cue -- 6 #E: { 7 a: {b: int} 8 } 9 10 #S: { 11 #E 12 a: {c: int} 13 b: 3 14 } 15 16 // adding a field to a nested struct that is closed. 17 #e1: #S & {a: d: 4} 18 19 // literal struct not closed until after unification. 20 #v1: #S & {a: c: 4} 21 -- out/def -- 22 #E: { 23 a: { 24 b: int 25 } 26 } 27 #S: { 28 a: { 29 c: int 30 } 31 b: 3 32 #E 33 } 34 35 // adding a field to a nested struct that is closed. 36 #e1: #S & { 37 a: { 38 d: 4 39 } 40 } 41 42 // literal struct not closed until after unification. 43 #v1: #S & { 44 a: { 45 c: 4 46 } 47 } 48 -- out/export -- 49 50 -- out/yaml -- 51 {} 52 -- out/json -- 53 {} 54 -- out/legacy-debug -- 55 <0>{#E: <1>C{a: <2>C{b: int}}, #S: <3>C{a: <4>C{b: int, c: int}, b: 3}, #e1: <5>C{a: _|_(4:field "d" not allowed in closed struct), b: 3}, #v1: <6>C{a: <7>C{b: int, c: 4}, b: 3}} 56 -- out/compile -- 57 --- in.cue 58 { 59 #E: { 60 a: { 61 b: int 62 } 63 } 64 #S: { 65 〈1;#E〉 66 a: { 67 c: int 68 } 69 b: 3 70 } 71 #e1: (〈0;#S〉 & { 72 a: { 73 d: 4 74 } 75 }) 76 #v1: (〈0;#S〉 & { 77 a: { 78 c: 4 79 } 80 }) 81 } 82 -- out/eval -- 83 Errors: 84 #e1.a: field not allowed: d: 85 ./in.cue:2:5 86 ./in.cue:6:2 87 ./in.cue:7:5 88 ./in.cue:12:6 89 ./in.cue:12:15 90 91 Result: 92 (_|_){ 93 // [eval] 94 #E: (#struct){ 95 a: (#struct){ 96 b: (int){ int } 97 } 98 } 99 #S: (#struct){ 100 a: (#struct){ 101 b: (int){ int } 102 c: (int){ int } 103 } 104 b: (int){ 3 } 105 } 106 #e1: (_|_){ 107 // [eval] 108 a: (_|_){ 109 // [eval] 110 b: (int){ int } 111 c: (int){ int } 112 d: (_|_){ 113 // [eval] #e1.a: field not allowed: d: 114 // ./in.cue:2:5 115 // ./in.cue:6:2 116 // ./in.cue:7:5 117 // ./in.cue:12:6 118 // ./in.cue:12:15 119 } 120 } 121 b: (int){ 3 } 122 } 123 #v1: (#struct){ 124 a: (#struct){ 125 b: (int){ int } 126 c: (int){ 4 } 127 } 128 b: (int){ 3 } 129 } 130 }