github.com/solo-io/cue@v0.4.7/cue/testdata/cycle/052_resolved_self-reference_cycles_with_disjunction_with_defaults.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: resolved self-reference cycles with disjunction with defaults 4 #evalPartial 5 -- in.cue -- 6 // The disjunction in xa could be resolved, but as disjunctions 7 // are not resolved for expression, it remains unresolved. 8 xa1: (xa2 & 8) | *(xa4 & 9) 9 xa2: xa3 + 2 10 xa3: 6 & xa1-2 11 xa4: xa2 + 2 12 13 xb1: *(xb2 & 8) | (xb4 & 9) 14 xb2: xb3 + 2 15 xb3: *(6 & (xb1 - 2)) | (xb4 & 9) 16 xb4: xb2 + 2 17 18 // Another variant with more disjunctions. xc1 remains with two 19 // possibilities. Technically, only the first value is valid. 20 // However, to fully determine that, all options of the remaining 21 // disjunction will have to be evaluated algebraically, which is 22 // not done. 23 xc1: *(xc2 & 8) | (xc4 & 9) | (xc5 & 9) 24 xc2: xc3 + 2 25 xc3: 6 & xc1-2 26 xc4: xc2 + 1 27 xc5: xc2 + 2 28 29 // The above is resolved by setting xd1 explicitly. 30 xd1: *(xd2 & 8) | xd4 & 9 | xd5 & 9 31 xd2: xd3 + 2 32 xd3: 6 & xd1-2 33 xd4: xd2 + 1 34 xd5: xd2 + 2 35 36 // The above is resolved by setting xd1 explicitly to the wrong 37 // value, resulting in an error. 38 xe1: *(xe2 & 8) | xe4 & 9 | xe5 & 9 39 xe2: xe3 + 2 40 xe3: 6 & xe1-2 41 xe4: xe2 + 1 42 xe5: xe2 + 2 43 xe1: 9 44 45 z1: *(z2 + 1) | z3+5 46 z2: z3 + 2 47 z3: z1 - 3 48 z3: 8 49 -- out/def -- 50 // The disjunction in xa could be resolved, but as disjunctions 51 // are not resolved for expression, it remains unresolved. 52 xa1: 8 53 xa2: 8 54 xa4: 10 55 xa3: 6 56 57 // As xb3 is a disjunction, xb2 cannot be resolved and evaluating 58 // the cycle completely is broken. However, it is not an error 59 // as the user might still resolve the disjunction. 60 xb1: 8 61 xb2: 8 62 xb4: 10 63 xb3: 6 64 65 // Another variant with more disjunctions. xc1 remains with two 66 // possibilities. Technically, only the first value is valid. 67 // However, to fully determine that, all options of the remaining 68 // disjunction will have to be evaluated algebraically, which is 69 // not done. 70 xc1: *8 | 9 | _|_ // conflicting values 10 and 9 71 xc2: 8 72 xc4: 9 73 xc5: 10 74 xc3: 6 75 76 // The above is resolved by setting xd1 explicitly. 77 xd1: *8 | 9 | _|_ // conflicting values 10 and 9 78 xd2: 8 79 xd4: 9 80 xd5: 10 81 xd3: 6 82 83 // The above is resolved by setting xd1 explicitly to the wrong 84 // value, resulting in an error. 85 xe1: _|_ // conflicting values 6 and 7 86 xe2: _|_ // conflicting values 6 and 7 87 xe4: _|_ // conflicting values 6 and 7 88 xe5: _|_ // conflicting values 6 and 7 89 xe3: _|_ // conflicting values 6 and 7 90 z1: *11 | 13 91 z2: 10 92 z3: 8 93 -- out/legacy-debug -- 94 <0>{xa1: 8, xa2: 8, xa4: 10, xa3: 6, xb1: 8, xb2: 8, xb4: 10, xb3: 6, xc1: (*8 | 9), xc2: 8, xc4: 9, xc5: 10, xc3: 6, xd1: (*8 | 9), xd2: 8, xd4: 9, xd5: 10, xd3: 6, xe1: _|_((6 & 7):conflicting values 6 and 7), xe2: _|_((6 & 7):conflicting values 6 and 7), xe4: _|_((6 & 7):conflicting values 6 and 7), xe5: _|_((6 & 7):conflicting values 6 and 7), xe3: _|_((6 & 7):conflicting values 6 and 7), z1: (*11 | 13), z2: 10, z3: 8} 95 -- out/compile -- 96 --- in.cue 97 { 98 xa1: ((〈0;xa2〉 & 8)|*(〈0;xa4〉 & 9)) 99 xa2: (〈0;xa3〉 + 2) 100 xa3: (6 & (〈0;xa1〉 - 2)) 101 xa4: (〈0;xa2〉 + 2) 102 xb1: (*(〈0;xb2〉 & 8)|(〈0;xb4〉 & 9)) 103 xb2: (〈0;xb3〉 + 2) 104 xb3: (*(6 & (〈0;xb1〉 - 2))|(〈0;xb4〉 & 9)) 105 xb4: (〈0;xb2〉 + 2) 106 xc1: (*(〈0;xc2〉 & 8)|(〈0;xc4〉 & 9)|(〈0;xc5〉 & 9)) 107 xc2: (〈0;xc3〉 + 2) 108 xc3: (6 & (〈0;xc1〉 - 2)) 109 xc4: (〈0;xc2〉 + 1) 110 xc5: (〈0;xc2〉 + 2) 111 xd1: (*(〈0;xd2〉 & 8)|(〈0;xd4〉 & 9)|(〈0;xd5〉 & 9)) 112 xd2: (〈0;xd3〉 + 2) 113 xd3: (6 & (〈0;xd1〉 - 2)) 114 xd4: (〈0;xd2〉 + 1) 115 xd5: (〈0;xd2〉 + 2) 116 xe1: (*(〈0;xe2〉 & 8)|(〈0;xe4〉 & 9)|(〈0;xe5〉 & 9)) 117 xe2: (〈0;xe3〉 + 2) 118 xe3: (6 & (〈0;xe1〉 - 2)) 119 xe4: (〈0;xe2〉 + 1) 120 xe5: (〈0;xe2〉 + 2) 121 xe1: 9 122 z1: (*(〈0;z2〉 + 1)|(〈0;z3〉 + 5)) 123 z2: (〈0;z3〉 + 2) 124 z3: (〈0;z1〉 - 3) 125 z3: 8 126 } 127 -- out/eval -- 128 Errors: 129 xe1: 2 errors in empty disjunction: 130 xe1: conflicting values 8 and 9: 131 ./in.cue:33:14 132 ./in.cue:38:6 133 xe3: conflicting values 7 and 6: 134 ./in.cue:35:6 135 ./in.cue:35:10 136 137 Result: 138 (_|_){ 139 // [eval] 140 xa1: (int){ 8 } 141 xa2: (int){ 8 } 142 xa3: (int){ 6 } 143 xa4: (int){ 10 } 144 xb1: (int){ 8 } 145 xb2: (int){ 8 } 146 xb3: (int){ |(*(int){ 6 }, (int){ 9 }) } 147 xb4: (int){ 10 } 148 xc1: (int){ |(*(int){ 8 }, (int){ 9 }) } 149 xc2: (int){ 8 } 150 xc3: (int){ 6 } 151 xc4: (int){ 9 } 152 xc5: (int){ 10 } 153 xd1: (int){ |(*(int){ 8 }, (int){ 9 }) } 154 xd2: (int){ 8 } 155 xd3: (int){ 6 } 156 xd4: (int){ 9 } 157 xd5: (int){ 10 } 158 xe1: (_|_){ 159 // [eval] xe1: 2 errors in empty disjunction: 160 // xe1: conflicting values 8 and 9: 161 // ./in.cue:33:14 162 // ./in.cue:38:6 163 // xe3: conflicting values 7 and 6: 164 // ./in.cue:35:6 165 // ./in.cue:35:10 166 } 167 xe2: (_|_){ 168 // [eval] xe3: conflicting values 7 and 6: 169 // ./in.cue:35:6 170 // ./in.cue:35:10 171 } 172 xe3: (_|_){ 173 // [eval] xe3: conflicting values 7 and 6: 174 // ./in.cue:35:6 175 // ./in.cue:35:10 176 } 177 xe4: (_|_){ 178 // [eval] xe3: conflicting values 7 and 6: 179 // ./in.cue:35:6 180 // ./in.cue:35:10 181 } 182 xe5: (_|_){ 183 // [eval] xe3: conflicting values 7 and 6: 184 // ./in.cue:35:6 185 // ./in.cue:35:10 186 } 187 z1: (int){ |(*(int){ 11 }, (int){ 13 }) } 188 z2: (int){ 10 } 189 z3: (int){ 8 } 190 }