this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cue/testdata: convert resolve/ tests to inline @test format

Convert all 28 #todo:inline: medium tests in
cue/testdata/resolve/ to use inline @test(...)
annotations. Remove out/eval and out/evalalpha
sections; retain out/eval/stats and out/compile.
Add out/errors.txt and out/todo.txt where needed.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I8e7b9e950ab0d5d4ad274f0455017a6d26e374c7
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1235391
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+534 -2540
+1 -9
cue/testdata/resolve/000_convert___to_top.txtar
··· 1 - #name: convert _ to top 2 - #evalPartial 3 1 # Tests that a pattern constraint [_]: _ over an open struct results in 4 2 # an open struct without any concrete fields. 5 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 6 3 -- in.cue -- 7 - a: {[_]: _} 4 + a: {[_]: _} @test(eq, {}) 8 5 -- out/compile -- 9 6 --- in.cue 10 7 { ··· 22 19 Unifications: 2 23 20 Conjuncts: 2 24 21 Disjuncts: 0 25 - -- out/evalalpha -- 26 - (struct){ 27 - a: (struct){ 28 - } 29 - }
+4 -33
cue/testdata/resolve/004.txtar
··· 1 - #evalPartial 2 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 3 1 -- in.cue -- 4 2 a: _ 5 - b: a 6 - a: {d: 1, d: _} 3 + b: a @test(eq, {d: 1}) @test(shareID=ba) 4 + a: {d: 1, d: _} @test(eq, {d: 1}) @test(shareID=ba) 7 5 b: _ 8 6 -- out/compile -- 9 7 --- in.cue ··· 26 24 Unifications: 4 27 25 Conjuncts: 7 28 26 Disjuncts: 0 29 - -- out/evalalpha -- 30 - (struct){ 31 - a: (struct){ 32 - d: (int){ 1 } 33 - } 34 - b: ~(a) 35 - } 36 - -- diff/-out/evalalpha<==>+out/eval -- 37 - diff old new 38 - --- old 39 - +++ new 40 - @@ -2,7 +2,5 @@ 41 - a: (struct){ 42 - d: (int){ 1 } 43 - } 44 - - b: (struct){ 45 - - d: (int){ 1 } 46 - - } 47 - + b: ~(a) 48 - } 49 - -- out/eval -- 50 - (struct){ 51 - a: (struct){ 52 - d: (int){ 1 } 53 - } 54 - b: (struct){ 55 - d: (int){ 1 } 56 - } 57 - } 27 + -- out/todo.txt -- 28 + b: v2 evaluator expands b to a full struct; v3 shares the vertex with a.
+10 -29
cue/testdata/resolve/006_arithmetic.txtar
··· 1 - #name: arithmetic 2 - #evalPartial 3 1 # Tests arithmetic operations including division producing floats and 4 2 # conflicting types (int & float). 5 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 6 3 -- in.cue -- 7 - v1: 1.0T / 2.0 8 - v2: 2.0 == 2 9 - n1: 1 10 - v5: 2.0 / n1 11 - v6: 1.0 / 1.0 12 - e2: int & 4.0/2.0 4 + v1: 1.0T / 2.0 @test(eq, 5.0e+11) 5 + v2: 2.0 == 2 @test(eq, true) 6 + n1: 1 @test(eq, 1) @test(kind=int) 7 + v5: 2.0 / n1 @test(eq, 2.0) 8 + v6: 1.0 / 1.0 @test(eq, 1.0) @test(kind:todo=int, hint="may consider this") 9 + e2: int & 4.0/2.0 @test(err, code=eval, contains="conflicting values int and 2.0", pos=[0:5, 0:11]) 10 + -- out/errors.txt -- 11 + [eval] e2: conflicting values int and 2.0 (mismatched types int and float): 12 + ./in.cue:6:5 13 + ./in.cue:6:11 13 14 -- out/compile -- 14 15 --- in.cue 15 16 { ··· 30 31 Unifications: 7 31 32 Conjuncts: 8 32 33 Disjuncts: 0 33 - -- out/evalalpha -- 34 - Errors: 35 - e2: conflicting values int and 2.0 (mismatched types int and float): 36 - ./in.cue:6:5 37 - ./in.cue:6:11 38 - 39 - Result: 40 - (_|_){ 41 - // [eval] 42 - v1: (float){ 5.0E+11 } 43 - v2: (bool){ true } 44 - n1: (int){ 1 } 45 - v5: (float){ 2.0 } 46 - v6: (float){ 1.0 } 47 - e2: (_|_){ 48 - // [eval] e2: conflicting values int and 2.0 (mismatched types int and float): 49 - // ./in.cue:6:5 50 - // ./in.cue:6:11 51 - } 52 - }
+7 -19
cue/testdata/resolve/010_optional_field_resolves_to_incomplete.txtar
··· 1 - #name: optional field resolves to incomplete 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 2 r: { 6 3 a?: 3 7 - b: a 8 - c: r["a"] 4 + b: a @test(err, code=incomplete, contains="cannot reference optional field: a", pos=[0:6]) 5 + c: r["a"] @test(err, code=incomplete, contains="cannot reference optional field: a", pos=[0:8]) 9 6 } 7 + -- out/errors.txt -- 8 + [incomplete] r.b: cannot reference optional field: a: 9 + ./in.cue:3:6 10 + [incomplete] r.c: cannot reference optional field: a: 11 + ./in.cue:4:8 10 12 -- out/compile -- 11 13 --- in.cue 12 14 { ··· 26 28 Unifications: 5 27 29 Conjuncts: 5 28 30 Disjuncts: 0 29 - -- out/evalalpha -- 30 - (struct){ 31 - r: (struct){ 32 - a?: (int){ 3 } 33 - b: (_|_){ 34 - // [incomplete] r.b: cannot reference optional field: a: 35 - // ./in.cue:3:6 36 - } 37 - c: (_|_){ 38 - // [incomplete] r.c: cannot reference optional field: a: 39 - // ./in.cue:4:8 40 - } 41 - } 42 - }
+82 -187
cue/testdata/resolve/011_bounds.txtar
··· 1 - #name: bounds 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - i1: >1 & 5 6 - i2: (>=0 & <=10) & 5 7 - i3: !=null & [] 8 - i4: !=2 & !=4 2 + i1: >1 & 5 @test(eq, 5) 3 + i2: (>=0 & <=10) & 5 @test(eq, 5) 4 + i3: !=null & [] @test(eq, []) 5 + i4: !=2 & !=4 @test(eq, !=2 & !=4) 9 6 10 - s1: >=0 & <=10 & !=1 // no simplification 11 - s2: >=0 & <=10 & !=11 // >=0 & <=10 12 - s3: >5 & !=5 // >5 13 - s4: <10 & !=10 // <10 14 - s5: !=2 & !=2 7 + s1: >=0 & <=10 & !=1 @test(eq, >=0 & <=10 & !=1) // no simplification 8 + s2: >=0 & <=10 & !=11 @test(eq, >=0 & <=10) 9 + s3: >5 & !=5 @test(eq, >5) 10 + s4: <10 & !=10 @test(eq, <10) 11 + s5: !=2 & !=2 @test(eq, !=2) 15 12 16 13 // TODO: could change inequality 17 - s6: !=2 & >=2 18 - s7: >=2 & !=2 14 + s6: !=2 & >=2 @test(eq, >=2 & !=2) // >2 15 + s7: >=2 & !=2 @test(eq, >=2 & !=2) // >2 19 16 20 - s8: !=5 & >5 17 + s8: !=5 & >5 @test(eq, >5) 21 18 22 - s10: >=0 & <=10 & <12 & >1 // >1 & <=10 23 - s11: >0 & >=0 & <=12 & <12 // >0 & <12 19 + s10: >=0 & <=10 & <12 & >1 @test(eq, >1 & <=10) // >1 & <=10 20 + s11: >0 & >=0 & <=12 & <12 @test(eq, >0 & <12) // >0 & <12 24 21 25 - s20: >=10 & <=10 // 10 22 + s20: >=10 & <=10 @test(eq, >=10 & <=10) // 10 26 23 27 - s22: >5 & <=6 // no simplification 28 - s22a: >5 & (<=6 & int) // 6 29 - s22b: (int & >5) & <=6 // 6 30 - s22c: >=5 & (<6 & int) // 5 31 - s22d: (int & >=5) & <6 // 5 32 - s22e: (>=5 & <6) & int // 5 33 - s22f: int & (>=5 & <6) // 5 24 + s22: >5 & <=6 @test(eq, >5 & <=6) // no simplification 25 + s22a: >5 & (<=6 & int) @test(eq, >5 & <=6 & int) // 6 26 + s22b: (int & >5) & <=6 @test(eq, >5 & <=6 & int) // 6 27 + s22c: >=5 & (<6 & int) @test(eq, >=5 & <6 & int) // 5 28 + s22d: (int & >=5) & <6 @test(eq, >=5 & <6 & int) // 5 29 + s22e: (>=5 & <6) & int @test(eq, >=5 & <6 & int) // 5 30 + s22f: int & (>=5 & <6) @test(eq, >=5 & <6 & int) // 5 34 31 35 - s23: >0 & <2 // no simplification 36 - s23a: (>0 & <2) & int // int & 1 37 - s23b: int & (>0 & <2) // int & 1 38 - s23c: (int & >0) & <2 // int & 1 39 - s23d: >0 & (int & <2) // int & 1 40 - s23e: >0.0 & <2.0 // no simplification 32 + s23: >0 & <2 @test(eq, >0 & <2) // no simplification 33 + s23a: (>0 & <2) & int @test(eq, >0 & <2 & int) // int & 1 34 + s23b: int & (>0 & <2) @test(eq, >0 & <2 & int) // int & 1 35 + s23c: (int & >0) & <2 @test(eq, >0 & <2 & int) // int & 1 36 + s23d: >0 & (int & <2) @test(eq, >0 & <2 & int) // int & 1 37 + s23e: >0.0 & <2.0 @test(eq, >0.0 & <2.0) // no simplification 41 38 42 - s30: >0 & int 39 + s30: >0 & int @test(eq, >0 & int) 43 40 44 41 floats: { 45 42 [string]: float 46 - f1: <10.0 & <=5.0 47 - f2: <=10.0 & <5.0 48 - f3: <1.1 & <=1.1 49 - f4: <=1.1 & <=1.1 50 - f5: >1.1 & >=1.1 51 - f6: >=1.1 & >1.1 52 - f7: >=1.1 & <=1.1 43 + f1: <10.0 & <=5.0 @test(eq, <=5.0 & float) 44 + f2: <=10.0 & <5.0 @test(eq, <5.0 & float) 45 + f3: <1.1 & <=1.1 @test(eq, <1.1 & float) 46 + f4: <=1.1 & <=1.1 @test(eq, <=1.1 & float) 47 + f5: >1.1 & >=1.1 @test(eq, >1.1 & float) 48 + f6: >=1.1 & >1.1 @test(eq, >1.1 & float) 49 + f7: >=1.1 & <=1.1 @test(eq, >=1.1 & <=1.1 & float) 53 50 54 - issue1310: >=2.1 & <=1.0 55 - fe2: >2.1 & <=2.1 51 + issue1310: >=2.1 & <=1.0 @test(err, code=eval, contains="incompatible number bounds", pos=[0:21, 0:13]) 52 + fe2: >2.1 & <=2.1 @test(err, code=eval, contains="incompatible number bounds", pos=[0:20, 0:13]) 56 53 57 - fe3: float & >2 & <=3 54 + fe3: float & >2 & <=3 @test(eq, >2 & <=3 & float) 58 55 } 59 56 60 - e1: null & !=null 61 - e2: !=null & null 62 - e3: >1 & 1 63 - e4: <0 & 0 64 - e5: >1 & <0 65 - e6: >11 & <11 66 - e7: >=11 & <11 67 - e8: >11 & <=11 68 - e9: >"a" & <1 57 + e1: null & !=null @test(err, code=eval, contains="conflicting values null and !=null", pos=[0:5, 0:12]) 58 + e2: !=null & null @test(err, code=eval, contains="conflicting values null and !=null", pos=[0:5, 0:14]) 59 + e3: >1 & 1 @test(err, code=eval, contains="invalid value 1", pos=[0:5, 0:10]) 60 + e4: <0 & 0 @test(err, code=eval, contains="invalid value 0", pos=[0:5, 0:10]) 61 + e5: >1 & <0 @test(err, code=eval, contains="incompatible number bounds", pos=[0:10, 0:5]) 62 + e6: >11 & <11 @test(err, code=eval, contains="incompatible number bounds", pos=[0:11, 0:5]) 63 + e7: >=11 & <11 @test(err, code=eval, contains="incompatible number bounds", pos=[0:12, 0:5]) 64 + e8: >11 & <=11 @test(err, code=eval, contains="incompatible number bounds", pos=[0:11, 0:5]) 65 + e9: >"a" & <1 @test(err, code=eval, contains="conflicting values", pos=[0:5, 0:12]) 66 + -- out/errors.txt -- 67 + [eval] floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 68 + ./in.cue:50:21 69 + ./in.cue:50:13 70 + [eval] floats.fe2: incompatible number bounds <=2.1 and >2.1: 71 + ./in.cue:51:20 72 + ./in.cue:51:13 73 + [eval] e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 74 + ./in.cue:57:5 75 + ./in.cue:57:12 76 + [eval] e2: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 77 + ./in.cue:58:5 78 + ./in.cue:58:14 79 + [eval] e3: invalid value 1 (out of bound >1): 80 + ./in.cue:59:5 81 + ./in.cue:59:10 82 + [eval] e4: invalid value 0 (out of bound <0): 83 + ./in.cue:60:5 84 + ./in.cue:60:10 85 + [eval] e5: incompatible number bounds <0 and >1: 86 + ./in.cue:61:10 87 + ./in.cue:61:5 88 + [eval] e6: incompatible number bounds <11 and >11: 89 + ./in.cue:62:11 90 + ./in.cue:62:5 91 + [eval] e7: incompatible number bounds <11 and >=11: 92 + ./in.cue:63:12 93 + ./in.cue:63:5 94 + [eval] e8: incompatible number bounds <=11 and >11: 95 + ./in.cue:64:11 96 + ./in.cue:64:5 97 + [eval] e9: conflicting values >"a" and <1 (mismatched types string and number): 98 + ./in.cue:65:5 99 + ./in.cue:65:12 69 100 -- out/compile -- 70 101 --- in.cue 71 102 { ··· 131 162 Unifications: 50 132 163 Conjuncts: 126 133 164 Disjuncts: 0 134 - -- out/evalalpha -- 135 - Errors: 136 - e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 137 - ./in.cue:56:5 138 - ./in.cue:56:12 139 - e2: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 140 - ./in.cue:57:5 141 - ./in.cue:57:14 142 - e9: conflicting values >"a" and <1 (mismatched types string and number): 143 - ./in.cue:64:5 144 - ./in.cue:64:12 145 - floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 146 - ./in.cue:50:21 147 - ./in.cue:50:13 148 - floats.fe2: incompatible number bounds <=2.1 and >2.1: 149 - ./in.cue:51:20 150 - ./in.cue:51:13 151 - e3: invalid value 1 (out of bound >1): 152 - ./in.cue:58:5 153 - ./in.cue:58:10 154 - e4: invalid value 0 (out of bound <0): 155 - ./in.cue:59:5 156 - ./in.cue:59:10 157 - e5: incompatible number bounds <0 and >1: 158 - ./in.cue:60:10 159 - ./in.cue:60:5 160 - e6: incompatible number bounds <11 and >11: 161 - ./in.cue:61:11 162 - ./in.cue:61:5 163 - e7: incompatible number bounds <11 and >=11: 164 - ./in.cue:62:12 165 - ./in.cue:62:5 166 - e8: incompatible number bounds <=11 and >11: 167 - ./in.cue:63:11 168 - ./in.cue:63:5 169 - 170 - Result: 171 - (_|_){ 172 - // [eval] 173 - i1: (int){ 5 } 174 - i2: (int){ 5 } 175 - i3: (#list){ 176 - } 177 - i4: (number){ &(!=2, !=4) } 178 - s1: (number){ &(>=0, <=10, !=1) } 179 - s2: (number){ &(>=0, <=10) } 180 - s3: (number){ >5 } 181 - s4: (number){ <10 } 182 - s5: (number){ !=2 } 183 - s6: (number){ &(>=2, !=2) } 184 - s7: (number){ &(>=2, !=2) } 185 - s8: (number){ >5 } 186 - s10: (number){ &(>1, <=10) } 187 - s11: (number){ &(>0, <12) } 188 - s20: (number){ &(>=10, <=10) } 189 - s22: (number){ &(>5, <=6) } 190 - s22a: (int){ &(>5, <=6, int) } 191 - s22b: (int){ &(>5, <=6, int) } 192 - s22c: (int){ &(>=5, <6, int) } 193 - s22d: (int){ &(>=5, <6, int) } 194 - s22e: (int){ &(>=5, <6, int) } 195 - s22f: (int){ &(>=5, <6, int) } 196 - s23: (number){ &(>0, <2) } 197 - s23a: (int){ &(>0, <2, int) } 198 - s23b: (int){ &(>0, <2, int) } 199 - s23c: (int){ &(>0, <2, int) } 200 - s23d: (int){ &(>0, <2, int) } 201 - s23e: (number){ &(>0.0, <2.0) } 202 - s30: (int){ &(>0, int) } 203 - floats: (_|_){ 204 - // [eval] 205 - f1: (float){ &(<=5.0, float) } 206 - f2: (float){ &(<5.0, float) } 207 - f3: (float){ &(<1.1, float) } 208 - f4: (float){ &(<=1.1, float) } 209 - f5: (float){ &(>1.1, float) } 210 - f6: (float){ &(>1.1, float) } 211 - f7: (float){ &(>=1.1, <=1.1, float) } 212 - issue1310: (_|_){ 213 - // [eval] floats.issue1310: incompatible number bounds <=1.0 and >=2.1: 214 - // ./in.cue:50:21 215 - // ./in.cue:50:13 216 - } 217 - fe2: (_|_){ 218 - // [eval] floats.fe2: incompatible number bounds <=2.1 and >2.1: 219 - // ./in.cue:51:20 220 - // ./in.cue:51:13 221 - } 222 - fe3: (float){ &(>2, <=3, float) } 223 - } 224 - e1: (_|_){ 225 - // [eval] e1: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 226 - // ./in.cue:56:5 227 - // ./in.cue:56:12 228 - } 229 - e2: (_|_){ 230 - // [eval] e2: conflicting values null and !=null (mismatched types null and (bool|string|bytes|func|list|struct|number)): 231 - // ./in.cue:57:5 232 - // ./in.cue:57:14 233 - } 234 - e3: (_|_){ 235 - // [eval] e3: invalid value 1 (out of bound >1): 236 - // ./in.cue:58:5 237 - // ./in.cue:58:10 238 - } 239 - e4: (_|_){ 240 - // [eval] e4: invalid value 0 (out of bound <0): 241 - // ./in.cue:59:5 242 - // ./in.cue:59:10 243 - } 244 - e5: (_|_){ 245 - // [eval] e5: incompatible number bounds <0 and >1: 246 - // ./in.cue:60:10 247 - // ./in.cue:60:5 248 - } 249 - e6: (_|_){ 250 - // [eval] e6: incompatible number bounds <11 and >11: 251 - // ./in.cue:61:11 252 - // ./in.cue:61:5 253 - } 254 - e7: (_|_){ 255 - // [eval] e7: incompatible number bounds <11 and >=11: 256 - // ./in.cue:62:12 257 - // ./in.cue:62:5 258 - } 259 - e8: (_|_){ 260 - // [eval] e8: incompatible number bounds <=11 and >11: 261 - // ./in.cue:63:11 262 - // ./in.cue:63:5 263 - } 264 - e9: (_|_){ 265 - // [eval] e9: conflicting values >"a" and <1 (mismatched types string and number): 266 - // ./in.cue:64:5 267 - // ./in.cue:64:12 268 - } 269 - }
+21 -53
cue/testdata/resolve/012_bound_conversions.txtar
··· 1 - #name: bound conversions 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - r0: int & >0.1 & <=1.9 6 - r1: int & >0.1 & <1.9 7 - r2: int & >=0.1 & <1.9 8 - r3: int & >=-1.9 & <=-0.1 9 - r4: int & >-1.9 & <=-0.1 2 + r0: int & >0.1 & <=1.9 @test(eq, >0.1 & <=1.9 & int) 3 + r1: int & >0.1 & <1.9 @test(eq, >0.1 & <1.9 & int) 4 + r2: int & >=0.1 & <1.9 @test(eq, >=0.1 & <1.9 & int) 5 + r3: int & >=-1.9 & <=-0.1 @test(eq, >=-1.9 & <=-0.1 & int) 6 + r4: int & >-1.9 & <=-0.1 @test(eq, >-1.9 & <=-0.1 & int) 10 7 11 - r5: >=1.1 & <=1.1 12 - r6: r5 & 1.1 8 + r5: >=1.1 & <=1.1 @test(eq, >=1.1 & <=1.1) 9 + r6: r5 & 1.1 @test(eq, 1.1) 13 10 14 - c1: (1.2 & >1.3) & <2 15 - c2: 1.2 & (>1.3 & <2) 11 + c1: (1.2 & >1.3) & <2 @test(err, code=eval, contains="invalid value 1.2", pos=[0:12, 0:6]) 12 + c2: 1.2 & (>1.3 & <2) @test(err, code=eval, contains="invalid value 1.2", pos=[0:12, 0:5]) 16 13 17 - c3: 1.2 & (>=1 & <2) 18 - c4: 1.2 & (>=1 & <2 & int) 14 + c3: 1.2 & (>=1 & <2) @test(eq, 1.2) 15 + c4: 1.2 & (>=1 & <2 & int) @test(err, code=eval, contains="conflicting values 1.2 and int", pos=[0:5, 0:23]) 16 + -- out/errors.txt -- 17 + [eval] c1: invalid value 1.2 (out of bound >1.3): 18 + ./in.cue:10:12 19 + ./in.cue:10:6 20 + [eval] c2: invalid value 1.2 (out of bound >1.3): 21 + ./in.cue:11:12 22 + ./in.cue:11:5 23 + [eval] c4: conflicting values 1.2 and int (mismatched types float and int): 24 + ./in.cue:14:5 25 + ./in.cue:14:23 19 26 -- out/compile -- 20 27 --- in.cue 21 28 { ··· 43 50 Disjuncts: 0 44 51 45 52 NumCloseIDs: 1 46 - -- out/evalalpha -- 47 - Errors: 48 - c4: conflicting values 1.2 and int (mismatched types float and int): 49 - ./in.cue:14:5 50 - ./in.cue:14:23 51 - c1: invalid value 1.2 (out of bound >1.3): 52 - ./in.cue:10:12 53 - ./in.cue:10:6 54 - c2: invalid value 1.2 (out of bound >1.3): 55 - ./in.cue:11:12 56 - ./in.cue:11:5 57 - 58 - Result: 59 - (_|_){ 60 - // [eval] 61 - r0: (int){ &(>0.1, <=1.9, int) } 62 - r1: (int){ &(>0.1, <1.9, int) } 63 - r2: (int){ &(>=0.1, <1.9, int) } 64 - r3: (int){ &(>=-1.9, <=-0.1, int) } 65 - r4: (int){ &(>-1.9, <=-0.1, int) } 66 - r5: (number){ &(>=1.1, <=1.1) } 67 - r6: (float){ 1.1 } 68 - c1: (_|_){ 69 - // [eval] c1: invalid value 1.2 (out of bound >1.3): 70 - // ./in.cue:10:12 71 - // ./in.cue:10:6 72 - } 73 - c2: (_|_){ 74 - // [eval] c2: invalid value 1.2 (out of bound >1.3): 75 - // ./in.cue:11:12 76 - // ./in.cue:11:5 77 - } 78 - c3: (float){ 1.2 } 79 - c4: (_|_){ 80 - // [eval] c4: conflicting values 1.2 and int (mismatched types float and int): 81 - // ./in.cue:14:5 82 - // ./in.cue:14:23 83 - } 84 - }
+15 -32
cue/testdata/resolve/013_custom_validators.txtar
··· 1 - #name: custom validators 2 - #evalPartial 3 - #todo:inline: medium — imported builtin validators; needs cmpBuiltinExpr path 4 1 -- in.cue -- 5 2 import "strings" 6 3 7 4 a: strings.ContainsAny("ab") 8 - a: "after" 5 + a: "after" @test(eq, "after") 9 6 10 7 b: strings.ContainsAny("c") 11 - b: "dog" 8 + b: "dog" @test(err, code=eval, contains="invalid value \"dog\"", pos=[-1:4, -1:24, 0:4]) 12 9 13 10 c: strings.ContainsAny("d") & strings.ContainsAny("g") 14 - c: "dog" 15 - -- out/eval/stats -- 16 - Leaks: 0 17 - Freed: 4 18 - Reused: 0 19 - Allocs: 4 20 - Retain: 0 21 - 22 - Unifications: 4 23 - Conjuncts: 8 24 - Disjuncts: 0 25 - -- out/evalalpha -- 26 - Errors: 27 - b: invalid value "dog" (does not satisfy strings.ContainsAny("c")): 11 + c: "dog" @test(eq, "dog") 12 + -- out/errors.txt -- 13 + [eval] b: invalid value "dog" (does not satisfy strings.ContainsAny("c")): 28 14 ./in.cue:6:4 29 15 ./in.cue:6:24 30 16 ./in.cue:7:4 31 - 32 - Result: 33 - (_|_){ 34 - // [eval] 35 - a: (string){ "after" } 36 - b: (_|_){ 37 - // [eval] b: invalid value "dog" (does not satisfy strings.ContainsAny("c")): 38 - // ./in.cue:6:4 39 - // ./in.cue:6:24 40 - // ./in.cue:7:4 41 - } 42 - c: (string){ "dog" } 43 - } 44 17 -- out/compile -- 45 18 --- in.cue 46 19 { ··· 51 24 c: (〈import;strings〉.ContainsAny("d") & 〈import;strings〉.ContainsAny("g")) 52 25 c: "dog" 53 26 } 27 + -- out/eval/stats -- 28 + Leaks: 0 29 + Freed: 4 30 + Reused: 0 31 + Allocs: 4 32 + Retain: 0 33 + 34 + Unifications: 4 35 + Conjuncts: 8 36 + Disjuncts: 0
+42 -263
cue/testdata/resolve/016_index.txtar
··· 1 - #name: index 2 - #evalPartial 3 - #todo:inline: medium — disjunctions; use @test(final) for default selection 4 1 -- in.cue -- 5 - a: [2][0] 6 - b: {foo: "bar"}["foo"] 7 - c: (*l | {"3": 3})["3"] 8 - d: (*[] | [1])[0] 9 - l: [] 10 - e1: [2][""] 11 - e2: 2[2] 12 - e3: [][true] 13 - e4: [1, 2, 3][3] 14 - e5: [1, 2, 3][-1] 15 - e6: (*[] | {})[1] 16 - e7: [1, 2, 3][3] 17 - e8: [1, 2, 3][-1] 18 - e9: (*[] | {})[1] 2 + a: [2][0] @test(eq, 2) 3 + b: {foo: "bar"}["foo"] @test(eq, "bar") 4 + c: (*l | {"3": 3})["3"] @test(err, code=eval, contains="undefined field", pos=[0:20]) 5 + d: (*[] | [1])[0] @test(err, code=eval, contains="index out of range [0]", pos=[0:16]) 6 + l: [] @test(eq, []) 7 + e1: [2][""] @test(err, code=eval, contains="undefined field", pos=[0:9]) 8 + e2: 2[2] @test(err, code=eval, contains="invalid operand 2", pos=[0:5]) 9 + e3: [][true] @test(err, code=eval, contains="invalid index true", pos=[0:5, 0:8]) 10 + e4: [1, 2, 3][3] @test(err, code=eval, contains="index out of range [3]", pos=[0:15]) 11 + e5: [1, 2, 3][-1] @test(err, code=eval, contains="invalid index -1", pos=[0:5, 0:15]) 12 + e6: (*[] | {})[1] @test(err, code=eval, contains="index out of range [1]", pos=[0:16]) 13 + e7: [1, 2, 3][3] @test(err, code=eval, contains="index out of range [3]", pos=[0:15]) 14 + e8: [1, 2, 3][-1] @test(err, code=eval, contains="invalid index -1", pos=[0:5, 0:15]) 15 + e9: (*[] | {})[1] @test(err, code=eval, contains="index out of range [1]", pos=[0:16]) 19 16 20 17 def: { 21 18 a: 1 22 19 #b: 3 23 - } 20 + } @test(eq, {a: 1, #b: 3}) 24 21 e7: def["b"] 22 + -- out/errors.txt -- 23 + [eval] c: undefined field: "3": 24 + ./in.cue:3:20 25 + [eval] d: index out of range [0] with length 0: 26 + ./in.cue:4:16 27 + [eval] e1: undefined field: "": 28 + ./in.cue:6:9 29 + [eval] e2: invalid operand 2 (found int, want list or struct): 30 + ./in.cue:7:5 31 + [eval] e3: invalid index true (invalid type bool): 32 + ./in.cue:8:5 33 + ./in.cue:8:8 34 + [eval] e4: index out of range [3] with length 3: 35 + ./in.cue:9:15 36 + [eval] e5: invalid index -1 (index must be non-negative): 37 + ./in.cue:10:5 38 + ./in.cue:10:15 39 + [eval] e6: index out of range [1] with length 0: 40 + ./in.cue:11:16 41 + [eval] e7: index out of range [3] with length 3: 42 + ./in.cue:12:15 43 + [eval] e8: invalid index -1 (index must be non-negative): 44 + ./in.cue:13:5 45 + ./in.cue:13:15 46 + [eval] e9: index out of range [1] with length 0: 47 + ./in.cue:14:16 25 48 -- out/compile -- 26 49 --- in.cue 27 50 { ··· 83 106 Disjuncts: 8 84 107 85 108 NumCloseIDs: 3 86 - -- out/evalalpha -- 87 - Errors: 88 - c: undefined field: "3": 89 - ./in.cue:3:20 90 - d: index out of range [0] with length 0: 91 - ./in.cue:4:16 92 - e1: undefined field: "": 93 - ./in.cue:6:9 94 - e2: invalid operand 2 (found int, want list or struct): 95 - ./in.cue:7:5 96 - e3: invalid index true (invalid type bool): 97 - ./in.cue:8:5 98 - ./in.cue:8:8 99 - e4: index out of range [3] with length 3: 100 - ./in.cue:9:15 101 - e5: invalid index -1 (index must be non-negative): 102 - ./in.cue:10:5 103 - ./in.cue:10:15 104 - e6: index out of range [1] with length 0: 105 - ./in.cue:11:16 106 - e7: index out of range [3] with length 3: 107 - ./in.cue:12:15 108 - e8: invalid index -1 (index must be non-negative): 109 - ./in.cue:13:5 110 - ./in.cue:13:15 111 - e9: index out of range [1] with length 0: 112 - ./in.cue:14:16 113 - 114 - Result: 115 - (_|_){ 116 - // [eval] 117 - a: (int){ 2 } 118 - b: (string){ "bar" } 119 - c: (_|_){ 120 - // [eval] c: undefined field: "3": 121 - // ./in.cue:3:20 122 - } 123 - d: (_|_){ 124 - // [eval] d: index out of range [0] with length 0: 125 - // ./in.cue:4:16 126 - } 127 - l: (#list){ 128 - } 129 - e1: (_|_){ 130 - // [eval] e1: undefined field: "": 131 - // ./in.cue:6:9 132 - } 133 - e2: (_|_){ 134 - // [eval] e2: invalid operand 2 (found int, want list or struct): 135 - // ./in.cue:7:5 136 - } 137 - e3: (_|_){ 138 - // [eval] e3: invalid index true (invalid type bool): 139 - // ./in.cue:8:5 140 - // ./in.cue:8:8 141 - } 142 - e4: (_|_){ 143 - // [eval] e4: index out of range [3] with length 3: 144 - // ./in.cue:9:15 145 - } 146 - e5: (_|_){ 147 - // [eval] e5: invalid index -1 (index must be non-negative): 148 - // ./in.cue:10:5 149 - // ./in.cue:10:15 150 - } 151 - e6: (_|_){ 152 - // [eval] e6: index out of range [1] with length 0: 153 - // ./in.cue:11:16 154 - } 155 - e7: (_|_){ 156 - // [eval] e7: index out of range [3] with length 3: 157 - // ./in.cue:12:15 158 - } 159 - e8: (_|_){ 160 - // [eval] e8: invalid index -1 (index must be non-negative): 161 - // ./in.cue:13:5 162 - // ./in.cue:13:15 163 - } 164 - e9: (_|_){ 165 - // [eval] e9: index out of range [1] with length 0: 166 - // ./in.cue:14:16 167 - } 168 - def: (struct){ 169 - a: (int){ 1 } 170 - #b: (int){ 3 } 171 - } 172 - } 173 - -- diff/-out/evalalpha<==>+out/eval -- 174 - diff old new 175 - --- old 176 - +++ new 177 - @@ -1,9 +1,9 @@ 178 - Errors: 179 - -c: invalid list index "3" (type string): 180 - +c: undefined field: "3": 181 - ./in.cue:3:20 182 - d: index out of range [0] with length 0: 183 - ./in.cue:4:16 184 - -e1: invalid list index "" (type string): 185 - +e1: undefined field: "": 186 - ./in.cue:6:9 187 - e2: invalid operand 2 (found int, want list or struct): 188 - ./in.cue:7:5 189 - @@ -15,7 +15,7 @@ 190 - e5: invalid index -1 (index must be non-negative): 191 - ./in.cue:10:5 192 - ./in.cue:10:15 193 - -e6: invalid list index 1 (out of bounds): 194 - +e6: index out of range [1] with length 0: 195 - ./in.cue:11:16 196 - e7: index out of range [3] with length 3: 197 - ./in.cue:12:15 198 - @@ -22,7 +22,7 @@ 199 - e8: invalid index -1 (index must be non-negative): 200 - ./in.cue:13:5 201 - ./in.cue:13:15 202 - -e9: invalid list index 1 (out of bounds): 203 - +e9: index out of range [1] with length 0: 204 - ./in.cue:14:16 205 - 206 - Result: 207 - @@ -31,7 +31,7 @@ 208 - a: (int){ 2 } 209 - b: (string){ "bar" } 210 - c: (_|_){ 211 - - // [eval] c: invalid list index "3" (type string): 212 - + // [eval] c: undefined field: "3": 213 - // ./in.cue:3:20 214 - } 215 - d: (_|_){ 216 - @@ -41,7 +41,7 @@ 217 - l: (#list){ 218 - } 219 - e1: (_|_){ 220 - - // [eval] e1: invalid list index "" (type string): 221 - + // [eval] e1: undefined field: "": 222 - // ./in.cue:6:9 223 - } 224 - e2: (_|_){ 225 - @@ -63,7 +63,7 @@ 226 - // ./in.cue:10:15 227 - } 228 - e6: (_|_){ 229 - - // [eval] e6: invalid list index 1 (out of bounds): 230 - + // [eval] e6: index out of range [1] with length 0: 231 - // ./in.cue:11:16 232 - } 233 - e7: (_|_){ 234 - @@ -76,7 +76,7 @@ 235 - // ./in.cue:13:15 236 - } 237 - e9: (_|_){ 238 - - // [eval] e9: invalid list index 1 (out of bounds): 239 - + // [eval] e9: index out of range [1] with length 0: 240 - // ./in.cue:14:16 241 - } 242 - def: (struct){ 243 - -- diff/todo/p3 -- 109 + -- out/todo.txt -- 244 110 Error messages slightly different. 245 - -- out/eval -- 246 - Errors: 247 - c: invalid list index "3" (type string): 248 - ./in.cue:3:20 249 - d: index out of range [0] with length 0: 250 - ./in.cue:4:16 251 - e1: invalid list index "" (type string): 252 - ./in.cue:6:9 253 - e2: invalid operand 2 (found int, want list or struct): 254 - ./in.cue:7:5 255 - e3: invalid index true (invalid type bool): 256 - ./in.cue:8:5 257 - ./in.cue:8:8 258 - e4: index out of range [3] with length 3: 259 - ./in.cue:9:15 260 - e5: invalid index -1 (index must be non-negative): 261 - ./in.cue:10:5 262 - ./in.cue:10:15 263 - e6: invalid list index 1 (out of bounds): 264 - ./in.cue:11:16 265 - e7: index out of range [3] with length 3: 266 - ./in.cue:12:15 267 - e8: invalid index -1 (index must be non-negative): 268 - ./in.cue:13:5 269 - ./in.cue:13:15 270 - e9: invalid list index 1 (out of bounds): 271 - ./in.cue:14:16 272 - 273 - Result: 274 - (_|_){ 275 - // [eval] 276 - a: (int){ 2 } 277 - b: (string){ "bar" } 278 - c: (_|_){ 279 - // [eval] c: invalid list index "3" (type string): 280 - // ./in.cue:3:20 281 - } 282 - d: (_|_){ 283 - // [eval] d: index out of range [0] with length 0: 284 - // ./in.cue:4:16 285 - } 286 - l: (#list){ 287 - } 288 - e1: (_|_){ 289 - // [eval] e1: invalid list index "" (type string): 290 - // ./in.cue:6:9 291 - } 292 - e2: (_|_){ 293 - // [eval] e2: invalid operand 2 (found int, want list or struct): 294 - // ./in.cue:7:5 295 - } 296 - e3: (_|_){ 297 - // [eval] e3: invalid index true (invalid type bool): 298 - // ./in.cue:8:5 299 - // ./in.cue:8:8 300 - } 301 - e4: (_|_){ 302 - // [eval] e4: index out of range [3] with length 3: 303 - // ./in.cue:9:15 304 - } 305 - e5: (_|_){ 306 - // [eval] e5: invalid index -1 (index must be non-negative): 307 - // ./in.cue:10:5 308 - // ./in.cue:10:15 309 - } 310 - e6: (_|_){ 311 - // [eval] e6: invalid list index 1 (out of bounds): 312 - // ./in.cue:11:16 313 - } 314 - e7: (_|_){ 315 - // [eval] e7: index out of range [3] with length 3: 316 - // ./in.cue:12:15 317 - } 318 - e8: (_|_){ 319 - // [eval] e8: invalid index -1 (index must be non-negative): 320 - // ./in.cue:13:5 321 - // ./in.cue:13:15 322 - } 323 - e9: (_|_){ 324 - // [eval] e9: invalid list index 1 (out of bounds): 325 - // ./in.cue:14:16 326 - } 327 - def: (struct){ 328 - a: (int){ 1 } 329 - #b: (int){ 3 } 330 - } 331 - }
+26 -69
cue/testdata/resolve/018_slice.txtar
··· 1 - #name: slice 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - a: [2][0:0] 6 - b: [0][1:1] 7 - e1: [][1:1] 8 - e2: [0][-1:0] 9 - e3: [0][1:0] 10 - e4: [0][1:2] 11 - e5: 4[1:2] 12 - e6: [2]["":] 13 - e7: [2][:"9"] 2 + a: [2][0:0] @test(eq, []) 3 + b: [0][1:1] @test(eq, []) 4 + e1: [][1:1] @test(err, code=eval, contains="index 1 out of range", pos=[0:5]) 5 + e2: [0][-1:0] @test(err, code=eval, contains="cannot convert negative number", pos=[0:5]) 6 + e3: [0][1:0] @test(err, code=eval, contains="invalid slice index", pos=[0:5]) 7 + e4: [0][1:2] @test(err, code=eval, contains="index 2 out of range", pos=[0:5]) 8 + e5: 4[1:2] @test(err, code=eval, contains="cannot slice 4", pos=[0:5]) 9 + e6: [2]["":] @test(err, code=eval, contains="cannot use \"\"", pos=[0:5, 0:9]) 10 + e7: [2][:"9"] @test(err, code=eval, contains="cannot use \"9\"", pos=[0:5, 0:10]) 11 + -- out/errors.txt -- 12 + [eval] e1: index 1 out of range: 13 + ./in.cue:3:5 14 + [eval] e2: cannot convert negative number to uint64: 15 + ./in.cue:4:5 16 + [eval] e3: invalid slice index: 1 > 0: 17 + ./in.cue:5:5 18 + [eval] e4: index 2 out of range: 19 + ./in.cue:6:5 20 + [eval] e5: cannot slice 4 (type int): 21 + ./in.cue:7:5 22 + [eval] e6: cannot use "" (type string) as type int in slice index: 23 + ./in.cue:8:5 24 + ./in.cue:8:9 25 + [eval] e7: cannot use "9" (type string) as type int in slice index: 26 + ./in.cue:9:5 27 + ./in.cue:9:10 14 28 -- out/compile -- 15 29 --- in.cue 16 30 { ··· 48 62 Unifications: 18 49 63 Conjuncts: 18 50 64 Disjuncts: 0 51 - -- out/evalalpha -- 52 - Errors: 53 - e1: index 1 out of range: 54 - ./in.cue:3:5 55 - e2: cannot convert negative number to uint64: 56 - ./in.cue:4:5 57 - e3: invalid slice index: 1 > 0: 58 - ./in.cue:5:5 59 - e4: index 2 out of range: 60 - ./in.cue:6:5 61 - e5: cannot slice 4 (type int): 62 - ./in.cue:7:5 63 - e6: cannot use "" (type string) as type int in slice index: 64 - ./in.cue:8:5 65 - ./in.cue:8:9 66 - e7: cannot use "9" (type string) as type int in slice index: 67 - ./in.cue:9:5 68 - ./in.cue:9:10 69 - 70 - Result: 71 - (_|_){ 72 - // [eval] 73 - a: (#list){ 74 - } 75 - b: (#list){ 76 - } 77 - e1: (_|_){ 78 - // [eval] e1: index 1 out of range: 79 - // ./in.cue:3:5 80 - } 81 - e2: (_|_){ 82 - // [eval] e2: cannot convert negative number to uint64: 83 - // ./in.cue:4:5 84 - } 85 - e3: (_|_){ 86 - // [eval] e3: invalid slice index: 1 > 0: 87 - // ./in.cue:5:5 88 - } 89 - e4: (_|_){ 90 - // [eval] e4: index 2 out of range: 91 - // ./in.cue:6:5 92 - } 93 - e5: (_|_){ 94 - // [eval] e5: cannot slice 4 (type int): 95 - // ./in.cue:7:5 96 - } 97 - e6: (_|_){ 98 - // [eval] e6: cannot use "" (type string) as type int in slice index: 99 - // ./in.cue:8:5 100 - // ./in.cue:8:9 101 - } 102 - e7: (_|_){ 103 - // [eval] e7: cannot use "9" (type string) as type int in slice index: 104 - // ./in.cue:9:5 105 - // ./in.cue:9:10 106 - } 107 - }
+2 -22
cue/testdata/resolve/022_list_unification.txtar
··· 1 - #name: list unification 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - a: {l: ["foo", v], v: l[1]} 6 - b: a & {l: [_, "bar"]} 2 + a: {l: ["foo", v], v: l[1]} @test(eq, {l: ["foo", _], v: _}) 3 + b: a & {l: [_, "bar"]} @test(eq, {l: ["foo", "bar"], v: "bar"}) 7 4 -- out/compile -- 8 5 --- in.cue 9 6 { ··· 33 30 Disjuncts: 0 34 31 35 32 NumCloseIDs: 2 36 - -- out/evalalpha -- 37 - (struct){ 38 - a: (struct){ 39 - l: (#list){ 40 - 0: (string){ "foo" } 41 - 1: (_){ _ } 42 - } 43 - v: (_){ _ } 44 - } 45 - b: (struct){ 46 - l: (#list){ 47 - 0: (string){ "foo" } 48 - 1: (string){ "bar" } 49 - } 50 - v: (string){ "bar" } 51 - } 52 - }
+5 -19
cue/testdata/resolve/023_correct_error_messages.txtar
··· 1 - #name: correct error messages 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - a: "a" & 1 2 + a: "a" & 1 @test(err, code=eval, contains="conflicting values \"a\" and 1", pos=[0:4, 0:10]) 3 + -- out/errors.txt -- 4 + [eval] a: conflicting values "a" and 1 (mismatched types string and int): 5 + ./in.cue:1:4 6 + ./in.cue:1:10 6 7 -- out/compile -- 7 8 --- in.cue 8 9 { ··· 18 19 Unifications: 2 19 20 Conjuncts: 3 20 21 Disjuncts: 0 21 - -- out/evalalpha -- 22 - Errors: 23 - a: conflicting values "a" and 1 (mismatched types string and int): 24 - ./in.cue:1:4 25 - ./in.cue:1:10 26 - 27 - Result: 28 - (_|_){ 29 - // [eval] 30 - a: (_|_){ 31 - // [eval] a: conflicting values "a" and 1 (mismatched types string and int): 32 - // ./in.cue:1:4 33 - // ./in.cue:1:10 34 - } 35 - }
+18 -35
cue/testdata/resolve/024_structs.txtar
··· 1 - #name: structs 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - a: t & {c: 5} // {c:5,d:15} 6 - b: ti & {c: 7} // {c:7,d:21} 7 - t: {c: number, d: c * 3} // {c:number,d:number*3} 8 - ti: t & {c: int} 2 + a: t & {c: 5} @test(eq, {c: 5, d: 15}) // {c:5,d:15} 3 + b: ti & {c: 7} @test(eq, {c: 7, d: 21}) // {c:7,d:21} 4 + t: { // {c:number,d:number*3} 5 + c: number 6 + d: c * 3 @test(err, code=incomplete, contains="non-concrete value number in operand to *", pos=[0:5, -1:5]) 7 + } 8 + ti: t & {c: int} @test(eq, { 9 + c: int 10 + d: _|_ @test(err, code=incomplete, contains="non-concrete value number in operand to *", pos=[5:5 4:5 7:13]) 11 + }) 12 + -- out/errors.txt -- 13 + [incomplete] t.d: non-concrete value number in operand to *: 14 + ./in.cue:5:5 15 + ./in.cue:4:5 16 + [incomplete] ti.d: non-concrete value int in operand to *: 17 + ./in.cue:5:5 18 + ./in.cue:4:5 19 + ./in.cue:7:13 9 20 -- out/compile -- 10 21 --- in.cue 11 22 { ··· 35 46 Disjuncts: 0 36 47 37 48 NumCloseIDs: 4 38 - -- out/evalalpha -- 39 - (struct){ 40 - a: (struct){ 41 - c: (int){ 5 } 42 - d: (int){ 15 } 43 - } 44 - b: (struct){ 45 - c: (int){ 7 } 46 - d: (int){ 21 } 47 - } 48 - t: (struct){ 49 - c: (number){ number } 50 - d: (_|_){ 51 - // [incomplete] t.d: non-concrete value number in operand to *: 52 - // ./in.cue:3:19 53 - // ./in.cue:3:8 54 - } 55 - } 56 - ti: (struct){ 57 - c: (int){ int } 58 - d: (_|_){ 59 - // [incomplete] ti.d: non-concrete value int in operand to *: 60 - // ./in.cue:3:19 61 - // ./in.cue:3:8 62 - // ./in.cue:4:13 63 - } 64 - } 65 - }
+15 -197
cue/testdata/resolve/025_definitions.txtar
··· 1 - #name: definitions 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 2 #Foo: { 6 3 field: int 7 4 recursive: { 8 5 field: string 9 6 } 10 - } 7 + } @test(eq, {field: int, recursive: {field: string}}) @test(closed) 11 8 12 9 // Allowed 13 10 #Foo1: {field: int} 14 - #Foo1: {field2: string} 11 + #Foo1: {field2: string} @test(eq, {field: int, field2: string}) @test(closed) 15 12 16 13 foo: #Foo 17 - foo: {feild: 2} 14 + foo: {feild: 2} @test(err, code=eval, contains="field not allowed", pos=[0:7]) 18 15 19 16 foo1: #Foo 20 17 foo1: { ··· 22 19 recursive: { 23 20 feild: 2 // Not caught as per spec. TODO: change? 24 21 } 25 - } 22 + } @test(err, code=eval, contains="field not allowed", pos=[3:3]) 26 23 27 24 #Bar: { 28 25 field: int 29 26 {[A=_]: int} 30 - } 27 + } @test(eq, {field: int}) @test(closed) 31 28 bar: #Bar 32 - bar: {feild: 2} 29 + bar: {feild: 2} @test(eq, {feild: 2, field: int}) 33 30 34 - #Mixed: string 35 - Mixed: string 31 + #Mixed: string @test(eq, string) 32 + Mixed: string @test(eq, string) 36 33 37 34 mixedRec: {#Mixed: string} 38 - mixedRec: {Mixed: string} 35 + mixedRec: {Mixed: string} @test(eq, {#Mixed: string, Mixed: string}) 36 + -- out/errors.txt -- 37 + [eval] foo.feild: field not allowed: 38 + ./in.cue:13:7 39 + [eval] foo1.recursive.feild: field not allowed: 40 + ./in.cue:19:3 39 41 -- out/compile -- 40 42 --- in.cue 41 43 { ··· 93 95 Disjuncts: 0 94 96 95 97 NumCloseIDs: 7 96 - -- out/evalalpha -- 97 - Errors: 98 - foo.feild: field not allowed: 99 - ./in.cue:13:7 100 - foo1.recursive.feild: field not allowed: 101 - ./in.cue:19:3 102 - 103 - Result: 104 - (_|_){ 105 - // [eval] 106 - #Foo: (#struct){ 107 - field: (int){ int } 108 - recursive: (#struct){ 109 - field: (string){ string } 110 - } 111 - } 112 - #Foo1: (#struct){ 113 - field: (int){ int } 114 - field2: (string){ string } 115 - } 116 - foo: (_|_){ 117 - // [eval] 118 - feild: (_|_){ 119 - // [eval] foo.feild: field not allowed: 120 - // ./in.cue:13:7 121 - } 122 - field: (int){ int } 123 - recursive: (#struct){ 124 - field: (string){ string } 125 - } 126 - } 127 - foo1: (_|_){ 128 - // [eval] 129 - field: (int){ 2 } 130 - recursive: (_|_){ 131 - // [eval] 132 - feild: (_|_){ 133 - // [eval] foo1.recursive.feild: field not allowed: 134 - // ./in.cue:19:3 135 - } 136 - field: (string){ string } 137 - } 138 - } 139 - #Bar: (#struct){ 140 - field: (int){ int } 141 - } 142 - bar: (#struct){ 143 - feild: (int){ 2 } 144 - field: (int){ int } 145 - } 146 - #Mixed: (string){ string } 147 - Mixed: (string){ string } 148 - mixedRec: (struct){ 149 - #Mixed: (string){ string } 150 - Mixed: (string){ string } 151 - } 152 - } 153 - -- diff/-out/evalalpha<==>+out/eval -- 154 - diff old new 155 - --- old 156 - +++ new 157 - @@ -1,11 +1,7 @@ 158 - Errors: 159 - foo.feild: field not allowed: 160 - - ./in.cue:1:7 161 - - ./in.cue:12:6 162 - ./in.cue:13:7 163 - foo1.recursive.feild: field not allowed: 164 - - ./in.cue:3:13 165 - - ./in.cue:15:7 166 - ./in.cue:19:3 167 - 168 - Result: 169 - @@ -23,16 +19,14 @@ 170 - } 171 - foo: (_|_){ 172 - // [eval] 173 - - field: (int){ int } 174 - - recursive: (#struct){ 175 - - field: (string){ string } 176 - - } 177 - feild: (_|_){ 178 - // [eval] foo.feild: field not allowed: 179 - - // ./in.cue:1:7 180 - - // ./in.cue:12:6 181 - // ./in.cue:13:7 182 - } 183 - + field: (int){ int } 184 - + recursive: (#struct){ 185 - + field: (string){ string } 186 - + } 187 - } 188 - foo1: (_|_){ 189 - // [eval] 190 - @@ -39,13 +33,11 @@ 191 - field: (int){ 2 } 192 - recursive: (_|_){ 193 - // [eval] 194 - - field: (string){ string } 195 - feild: (_|_){ 196 - // [eval] foo1.recursive.feild: field not allowed: 197 - - // ./in.cue:3:13 198 - - // ./in.cue:15:7 199 - // ./in.cue:19:3 200 - } 201 - + field: (string){ string } 202 - } 203 - } 204 - #Bar: (#struct){ 205 - @@ -52,8 +44,8 @@ 206 - field: (int){ int } 207 - } 208 - bar: (#struct){ 209 - - field: (int){ int } 210 - feild: (int){ 2 } 211 - + field: (int){ int } 212 - } 213 - #Mixed: (string){ string } 214 - Mixed: (string){ string } 215 - -- diff/todo/p2 -- 98 + -- out/todo.txt -- 216 99 Positions / reordering. 217 - -- out/eval -- 218 - Errors: 219 - foo.feild: field not allowed: 220 - ./in.cue:1:7 221 - ./in.cue:12:6 222 - ./in.cue:13:7 223 - foo1.recursive.feild: field not allowed: 224 - ./in.cue:3:13 225 - ./in.cue:15:7 226 - ./in.cue:19:3 227 - 228 - Result: 229 - (_|_){ 230 - // [eval] 231 - #Foo: (#struct){ 232 - field: (int){ int } 233 - recursive: (#struct){ 234 - field: (string){ string } 235 - } 236 - } 237 - #Foo1: (#struct){ 238 - field: (int){ int } 239 - field2: (string){ string } 240 - } 241 - foo: (_|_){ 242 - // [eval] 243 - field: (int){ int } 244 - recursive: (#struct){ 245 - field: (string){ string } 246 - } 247 - feild: (_|_){ 248 - // [eval] foo.feild: field not allowed: 249 - // ./in.cue:1:7 250 - // ./in.cue:12:6 251 - // ./in.cue:13:7 252 - } 253 - } 254 - foo1: (_|_){ 255 - // [eval] 256 - field: (int){ 2 } 257 - recursive: (_|_){ 258 - // [eval] 259 - field: (string){ string } 260 - feild: (_|_){ 261 - // [eval] foo1.recursive.feild: field not allowed: 262 - // ./in.cue:3:13 263 - // ./in.cue:15:7 264 - // ./in.cue:19:3 265 - } 266 - } 267 - } 268 - #Bar: (#struct){ 269 - field: (int){ int } 270 - } 271 - bar: (#struct){ 272 - field: (int){ int } 273 - feild: (int){ 2 } 274 - } 275 - #Mixed: (string){ string } 276 - Mixed: (string){ string } 277 - mixedRec: (struct){ 278 - #Mixed: (string){ string } 279 - Mixed: (string){ string } 280 - } 281 - }
+4 -53
cue/testdata/resolve/027_new-style_definitions.txtar
··· 1 - #name: new-style definitions 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 2 #Foo: { 6 3 a: 1 7 4 b: int 8 - } 9 - "#Foo": #Foo & {b: 1} 5 + } @test(eq, {a: 1, b: int}) @test(closed) 6 + "#Foo": #Foo & {b: 1} @test(eq, {b: 1, a: 1}) @test(closed) 10 7 11 8 bulk: {[string]: string} & { 12 9 #def: 4 // Different namespace, so bulk option does not apply. 13 10 _hid: 3 14 11 a: "foo" 15 - } 12 + } @test(eq, {#def: 4, _hid: 3, a: "foo"}) 16 13 -- out/compile -- 17 14 --- in.cue 18 15 { ··· 43 40 Disjuncts: 0 44 41 45 42 NumCloseIDs: 1 46 - -- out/evalalpha -- 47 - (struct){ 48 - #Foo: (#struct){ 49 - a: (int){ 1 } 50 - b: (int){ int } 51 - } 52 - "#Foo": (#struct){ 53 - b: (int){ 1 } 54 - a: (int){ 1 } 55 - } 56 - bulk: (struct){ 57 - #def: (int){ 4 } 58 - _hid: (int){ 3 } 59 - a: (string){ "foo" } 60 - } 61 - } 62 - -- diff/-out/evalalpha<==>+out/eval -- 63 - diff old new 64 - --- old 65 - +++ new 66 - @@ -4,8 +4,8 @@ 67 - b: (int){ int } 68 - } 69 - "#Foo": (#struct){ 70 - - a: (int){ 1 } 71 - b: (int){ 1 } 72 - + a: (int){ 1 } 73 - } 74 - bulk: (struct){ 75 - #def: (int){ 4 } 76 - -- diff/todo/p3 -- 43 + -- out/todo.txt -- 77 44 Reordering 78 - -- out/eval -- 79 - (struct){ 80 - #Foo: (#struct){ 81 - a: (int){ 1 } 82 - b: (int){ int } 83 - } 84 - "#Foo": (#struct){ 85 - a: (int){ 1 } 86 - b: (int){ 1 } 87 - } 88 - bulk: (struct){ 89 - #def: (int){ 4 } 90 - _hid: (int){ 3 } 91 - a: (string){ "foo" } 92 - } 93 - }
+14 -203
cue/testdata/resolve/029_non-closed_definition_carries_over_closedness_to_enclosed_template.txtar
··· 1 - #name: non-closed definition carries over closedness to enclosed template 2 - #evalPartial 3 - #todo:inline: medium — disjunctions; use @test(final) for default selection 4 1 -- in.cue -- 5 2 #S: { 6 3 [string]: {a: int} 7 - } 4 + } @test(eq, {}) @test(closed) 8 5 a: #S & { 9 6 v: {b: int} 10 - } 7 + } @test(err, code=eval, contains="field not allowed", pos=[1:6]) 11 8 #Q: { 12 9 [string]: {a: int} | {b: int} 13 - } 10 + } @test(eq, {}) @test(closed) 14 11 b: #Q & { 15 12 w: {c: int} 16 - } 13 + } @test(err, code=eval, contains="field not allowed", pos=[1:6]) 17 14 #R: { 18 15 [string]: [{a: int}, {b: int}] 19 - } 16 + } @test(eq, {}) @test(closed) 20 17 c: #R & { 21 18 w: [{d: int}, ...] 22 - } 19 + } @test(err, code=eval, contains="field not allowed", pos=[1:7]) 20 + -- out/errors.txt -- 21 + [eval] a.v.b: field not allowed: 22 + ./in.cue:5:6 23 + [eval] b.w.c: field not allowed: 24 + ./in.cue:11:6 25 + [eval] c.w.0.d: field not allowed: 26 + ./in.cue:17:7 23 27 -- out/compile -- 24 28 --- in.cue 25 29 { ··· 76 80 Disjuncts: 2 77 81 78 82 NumCloseIDs: 3 79 - -- out/evalalpha -- 80 - Errors: 81 - a.v.b: field not allowed: 82 - ./in.cue:5:6 83 - b.w.c: field not allowed: 84 - ./in.cue:11:6 85 - c.w.0.d: field not allowed: 86 - ./in.cue:17:7 87 - 88 - Result: 89 - (_|_){ 90 - // [eval] 91 - #S: (#struct){ 92 - } 93 - a: (_|_){ 94 - // [eval] 95 - v: (_|_){ 96 - // [eval] 97 - b: (_|_){ 98 - // [eval] a.v.b: field not allowed: 99 - // ./in.cue:5:6 100 - } 101 - a: (int){ int } 102 - } 103 - } 104 - #Q: (#struct){ 105 - } 106 - b: (_|_){ 107 - // [eval] 108 - w: (_|_){ 109 - // [eval] b.w.c: field not allowed: 110 - // ./in.cue:11:6 111 - c: (int){ int } 112 - } 113 - } 114 - #R: (#struct){ 115 - } 116 - c: (_|_){ 117 - // [eval] 118 - w: (_|_){ 119 - // [eval] 120 - 0: (_|_){ 121 - // [eval] 122 - d: (_|_){ 123 - // [eval] c.w.0.d: field not allowed: 124 - // ./in.cue:17:7 125 - } 126 - a: (int){ int } 127 - } 128 - 1: (#struct){ 129 - b: (int){ int } 130 - } 131 - } 132 - } 133 - } 134 - -- diff/-out/evalalpha<==>+out/eval -- 135 - diff old new 136 - --- old 137 - +++ new 138 - @@ -1,16 +1,9 @@ 139 - Errors: 140 - a.v.b: field not allowed: 141 - - ./in.cue:2:12 142 - - ./in.cue:4:4 143 - ./in.cue:5:6 144 - b.w.c: field not allowed: 145 - - ./in.cue:8:12 146 - - ./in.cue:10:4 147 - ./in.cue:11:6 148 - c.w.0.d: field not allowed: 149 - - ./in.cue:14:12 150 - - ./in.cue:14:13 151 - - ./in.cue:16:4 152 - ./in.cue:17:7 153 - 154 - Result: 155 - @@ -24,8 +17,6 @@ 156 - // [eval] 157 - b: (_|_){ 158 - // [eval] a.v.b: field not allowed: 159 - - // ./in.cue:2:12 160 - - // ./in.cue:4:4 161 - // ./in.cue:5:6 162 - } 163 - a: (int){ int } 164 - @@ -37,17 +28,8 @@ 165 - // [eval] 166 - w: (_|_){ 167 - // [eval] b.w.c: field not allowed: 168 - - // ./in.cue:8:12 169 - - // ./in.cue:10:4 170 - // ./in.cue:11:6 171 - - c: (_|_){ 172 - - // [eval] b.w.c: field not allowed: 173 - - // ./in.cue:8:12 174 - - // ./in.cue:8:23 175 - - // ./in.cue:10:4 176 - - // ./in.cue:11:6 177 - - } 178 - - b: (int){ int } 179 - + c: (int){ int } 180 - } 181 - } 182 - #R: (#struct){ 183 - @@ -60,11 +42,7 @@ 184 - // [eval] 185 - d: (_|_){ 186 - // [eval] c.w.0.d: field not allowed: 187 - - // ./in.cue:14:12 188 - - // ./in.cue:14:13 189 - - // ./in.cue:16:4 190 - // ./in.cue:17:7 191 - - // ./in.cue:19:7 192 - } 193 - a: (int){ int } 194 - } 195 - -- diff/todo/p3 -- 83 + -- out/todo.txt -- 196 84 Missing error positions. 197 - -- out/eval -- 198 - Errors: 199 - a.v.b: field not allowed: 200 - ./in.cue:2:12 201 - ./in.cue:4:4 202 - ./in.cue:5:6 203 - b.w.c: field not allowed: 204 - ./in.cue:8:12 205 - ./in.cue:10:4 206 - ./in.cue:11:6 207 - c.w.0.d: field not allowed: 208 - ./in.cue:14:12 209 - ./in.cue:14:13 210 - ./in.cue:16:4 211 - ./in.cue:17:7 212 - 213 - Result: 214 - (_|_){ 215 - // [eval] 216 - #S: (#struct){ 217 - } 218 - a: (_|_){ 219 - // [eval] 220 - v: (_|_){ 221 - // [eval] 222 - b: (_|_){ 223 - // [eval] a.v.b: field not allowed: 224 - // ./in.cue:2:12 225 - // ./in.cue:4:4 226 - // ./in.cue:5:6 227 - } 228 - a: (int){ int } 229 - } 230 - } 231 - #Q: (#struct){ 232 - } 233 - b: (_|_){ 234 - // [eval] 235 - w: (_|_){ 236 - // [eval] b.w.c: field not allowed: 237 - // ./in.cue:8:12 238 - // ./in.cue:10:4 239 - // ./in.cue:11:6 240 - c: (_|_){ 241 - // [eval] b.w.c: field not allowed: 242 - // ./in.cue:8:12 243 - // ./in.cue:8:23 244 - // ./in.cue:10:4 245 - // ./in.cue:11:6 246 - } 247 - b: (int){ int } 248 - } 249 - } 250 - #R: (#struct){ 251 - } 252 - c: (_|_){ 253 - // [eval] 254 - w: (_|_){ 255 - // [eval] 256 - 0: (_|_){ 257 - // [eval] 258 - d: (_|_){ 259 - // [eval] c.w.0.d: field not allowed: 260 - // ./in.cue:14:12 261 - // ./in.cue:14:13 262 - // ./in.cue:16:4 263 - // ./in.cue:17:7 264 - // ./in.cue:19:7 265 - } 266 - a: (int){ int } 267 - } 268 - 1: (#struct){ 269 - b: (int){ int } 270 - } 271 - } 272 - } 273 - }
+8 -132
cue/testdata/resolve/030_definitions_with_disjunctions.txtar
··· 1 - #name: definitions with disjunctions 2 - #evalPartial 3 - #todo:inline: medium — disjunctions; use @test(final) for default selection 4 1 -- in.cue -- 5 2 #Foo: { 6 3 field: int 7 4 8 5 {a: 1} | 9 6 {b: 2} 10 - } 7 + } @test(eq, {field: int, a: 1} | {field: int, b: 2}) 11 8 12 9 foo: #Foo 13 - foo: {a: 1} 10 + foo: {a: 1} @test(eq, {a: 1, field: int}) 14 11 15 12 bar: #Foo 16 - bar: {c: 2} 13 + bar: {c: 2} @test(err, code=eval, contains="field not allowed", pos=[0:7]) 17 14 18 15 baz: #Foo 19 - baz: {b: 2} 16 + baz: {b: 2} @test(eq, {b: 2, field: int}) 17 + -- out/errors.txt -- 18 + [eval] bar.c: field not allowed: 19 + ./in.cue:12:7 20 20 -- out/compile -- 21 21 --- in.cue 22 22 { ··· 53 53 Disjuncts: 8 54 54 55 55 NumCloseIDs: 11 56 - -- out/evalalpha -- 57 - Errors: 58 - bar.c: field not allowed: 59 - ./in.cue:12:7 60 - 61 - Result: 62 - (_|_){ 63 - // [eval] 64 - #Foo: (#struct){ |((#struct){ 65 - field: (int){ int } 66 - a: (int){ 1 } 67 - }, (#struct){ 68 - field: (int){ int } 69 - b: (int){ 2 } 70 - }) } 71 - foo: (#struct){ 72 - a: (int){ 1 } 73 - field: (int){ int } 74 - } 75 - bar: (_|_){ 76 - // [eval] bar.c: field not allowed: 77 - // ./in.cue:12:7 78 - c: (int){ 2 } 79 - field: (int){ int } 80 - } 81 - baz: (#struct){ 82 - b: (int){ 2 } 83 - field: (int){ int } 84 - } 85 - } 86 - -- diff/-out/evalalpha<==>+out/eval -- 87 - diff old new 88 - --- old 89 - +++ new 90 - @@ -1,8 +1,5 @@ 91 - Errors: 92 - bar.c: field not allowed: 93 - - ./in.cue:1:7 94 - - ./in.cue:4:2 95 - - ./in.cue:11:6 96 - ./in.cue:12:7 97 - 98 - Result: 99 - @@ -16,28 +13,17 @@ 100 - b: (int){ 2 } 101 - }) } 102 - foo: (#struct){ 103 - - field: (int){ int } 104 - a: (int){ 1 } 105 - + field: (int){ int } 106 - } 107 - bar: (_|_){ 108 - // [eval] bar.c: field not allowed: 109 - - // ./in.cue:1:7 110 - - // ./in.cue:4:2 111 - - // ./in.cue:11:6 112 - // ./in.cue:12:7 113 - - field: (int){ int } 114 - - c: (_|_){ 115 - - // [eval] bar.c: field not allowed: 116 - - // ./in.cue:1:7 117 - - // ./in.cue:4:2 118 - - // ./in.cue:5:2 119 - - // ./in.cue:11:6 120 - - // ./in.cue:12:7 121 - - } 122 - - b: (int){ 2 } 123 - + c: (int){ 2 } 124 - + field: (int){ int } 125 - } 126 - baz: (#struct){ 127 - - field: (int){ int } 128 - - b: (int){ 2 } 129 - + b: (int){ 2 } 130 - + field: (int){ int } 131 - } 132 - } 133 - -- diff/todo/p2 -- 56 + -- out/todo.txt -- 134 57 Missing error positions and reorderings. 135 - -- diff/explanation -- 136 - bar.b: removed in new evaluator. This is correct. In the old 137 - evaluator this addition was spurious. 138 - -- out/eval -- 139 - Errors: 140 - bar.c: field not allowed: 141 - ./in.cue:1:7 142 - ./in.cue:4:2 143 - ./in.cue:11:6 144 - ./in.cue:12:7 145 - 146 - Result: 147 - (_|_){ 148 - // [eval] 149 - #Foo: (#struct){ |((#struct){ 150 - field: (int){ int } 151 - a: (int){ 1 } 152 - }, (#struct){ 153 - field: (int){ int } 154 - b: (int){ 2 } 155 - }) } 156 - foo: (#struct){ 157 - field: (int){ int } 158 - a: (int){ 1 } 159 - } 160 - bar: (_|_){ 161 - // [eval] bar.c: field not allowed: 162 - // ./in.cue:1:7 163 - // ./in.cue:4:2 164 - // ./in.cue:11:6 165 - // ./in.cue:12:7 166 - field: (int){ int } 167 - c: (_|_){ 168 - // [eval] bar.c: field not allowed: 169 - // ./in.cue:1:7 170 - // ./in.cue:4:2 171 - // ./in.cue:5:2 172 - // ./in.cue:11:6 173 - // ./in.cue:12:7 174 - } 175 - b: (int){ 2 } 176 - } 177 - baz: (#struct){ 178 - field: (int){ int } 179 - b: (int){ 2 } 180 - } 181 - }
+3 -18
cue/testdata/resolve/031_definitions_with_disjunctions_recurisive.txtar
··· 1 - #name: definitions with disjunctions recurisive 2 - #evalPartial 3 - #todo:inline: medium — disjunctions; use @test(final) for default selection 4 1 -- in.cue -- 5 2 #Foo: { 6 3 x: { ··· 10 7 {b: 2} 11 8 } 12 9 x: c: 3 13 - } 10 + } @test(eq, { 11 + x: {field: int, c: 3, a: 1} | {field: int, c: 3, b: 2} 12 + }) 14 13 -- out/compile -- 15 14 --- in.cue 16 15 { ··· 40 39 Disjuncts: 2 41 40 42 41 NumCloseIDs: 2 43 - -- out/evalalpha -- 44 - (struct){ 45 - #Foo: (#struct){ 46 - x: (#struct){ |((#struct){ 47 - field: (int){ int } 48 - c: (int){ 3 } 49 - a: (int){ 1 } 50 - }, (#struct){ 51 - field: (int){ int } 52 - c: (int){ 3 } 53 - b: (int){ 2 } 54 - }) } 55 - } 56 - }
+1 -16
cue/testdata/resolve/033_top-level_definition_with_struct_and_disjunction.txtar
··· 1 - #name: top-level definition with struct and disjunction 2 - #evalPartial 3 - #todo:inline: medium — disjunctions; use @test(final) for default selection 4 1 -- in.cue -- 5 2 #def: { 6 3 Type: string ··· 14 11 } | { 15 12 Type: "A" 16 13 Size: 1 17 - } 14 + } @test(eq, {Type: "B", Text: string, Size: 0} | {Type: "A", Text: string, Size: 1}) 18 15 -- out/compile -- 19 16 --- in.cue 20 17 { ··· 41 38 Unifications: 5 42 39 Conjuncts: 12 43 40 Disjuncts: 2 44 - -- out/evalalpha -- 45 - (struct){ 46 - #def: (#struct){ |((#struct){ 47 - Type: (string){ "B" } 48 - Text: (string){ string } 49 - Size: (int){ 0 } 50 - }, (#struct){ 51 - Type: (string){ "A" } 52 - Text: (string){ string } 53 - Size: (int){ 1 } 54 - }) } 55 - }
+31 -151
cue/testdata/resolve/034_closing_structs.txtar
··· 1 - #name: closing structs 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - op: {x: int} // {x: int} 6 - ot: {x: int, ...} // {x: int, ...} 7 - cp: close({x: int}) // closed({x: int}) 8 - ct: close({x: int, ...}) // {x: int, ...} 9 - 10 - opot: op & ot // {x: int, ...} 11 - otop: ot & op // {x: int, ...} 12 - opcp: op & cp // closed({x: int}) 13 - cpop: cp & op // closed({x: int}) 14 - opct: op & ct // {x: int, ...} 15 - ctop: ct & op // {x: int, ...} 16 - otcp: ot & cp // closed({x: int}) 17 - cpot: cp & ot // closed({x: int}) 18 - otct: ot & ct // {x: int, ...} 19 - ctot: ct & ot // {x: int, ...} 20 - cpct: cp & ct // closed({x: int}) 21 - ctcp: ct & cp // closed({x: int}) 22 - ctct: ct & ct // {x: int, ...} 23 - -- out/eval/stats -- 24 - Leaks: 0 25 - Freed: 90 26 - Reused: 63 27 - Allocs: 27 28 - Retain: 0 29 - 30 - Unifications: 62 31 - Conjuncts: 125 32 - Disjuncts: 0 2 + op: {x: int} @test(eq, {x: int}) // {x: int} 3 + ot: {x: int, ...} @test(eq, {x: int}) // {x: int, ...} 4 + cp: close({x: int}) @test(eq, {x: int}) @test(closed) // closed({x: int}) 5 + ct: close({x: int, ...}) @test(eq, {x: int}) @test(closed) @test(shareID=ctct) // {x: int, ...} 33 6 34 - NumCloseIDs: 38 35 - -- out/evalalpha -- 36 - (struct){ 37 - op: (struct){ 38 - x: (int){ int } 39 - } 40 - ot: (struct){ 41 - x: (int){ int } 42 - } 43 - cp: (#struct){ 44 - x: (int){ int } 45 - } 46 - ct: (#struct){ 47 - x: (int){ int } 48 - } 49 - opot: (struct){ 50 - x: (int){ int } 51 - } 52 - otop: (struct){ 53 - x: (int){ int } 54 - } 55 - opcp: (#struct){ 56 - x: (int){ int } 57 - } 58 - cpop: (#struct){ 59 - x: (int){ int } 60 - } 61 - opct: (#struct){ 62 - x: (int){ int } 63 - } 64 - ctop: (#struct){ 65 - x: (int){ int } 66 - } 67 - otcp: (#struct){ 68 - x: (int){ int } 69 - } 70 - cpot: (#struct){ 71 - x: (int){ int } 72 - } 73 - otct: (#struct){ 74 - x: (int){ int } 75 - } 76 - ctot: (#struct){ 77 - x: (int){ int } 78 - } 79 - cpct: (#struct){ 80 - x: (int){ int } 81 - } 82 - ctcp: (#struct){ 83 - x: (int){ int } 84 - } 85 - ctct: ~(ct) 86 - } 87 - -- diff/-out/evalalpha<==>+out/eval -- 88 - diff old new 89 - --- old 90 - +++ new 91 - @@ -47,7 +47,5 @@ 92 - ctcp: (#struct){ 93 - x: (int){ int } 94 - } 95 - - ctct: (#struct){ 96 - - x: (int){ int } 97 - - } 98 - + ctct: ~(ct) 99 - } 100 - -- out/eval -- 101 - (struct){ 102 - op: (struct){ 103 - x: (int){ int } 104 - } 105 - ot: (struct){ 106 - x: (int){ int } 107 - } 108 - cp: (#struct){ 109 - x: (int){ int } 110 - } 111 - ct: (#struct){ 112 - x: (int){ int } 113 - } 114 - opot: (struct){ 115 - x: (int){ int } 116 - } 117 - otop: (struct){ 118 - x: (int){ int } 119 - } 120 - opcp: (#struct){ 121 - x: (int){ int } 122 - } 123 - cpop: (#struct){ 124 - x: (int){ int } 125 - } 126 - opct: (#struct){ 127 - x: (int){ int } 128 - } 129 - ctop: (#struct){ 130 - x: (int){ int } 131 - } 132 - otcp: (#struct){ 133 - x: (int){ int } 134 - } 135 - cpot: (#struct){ 136 - x: (int){ int } 137 - } 138 - otct: (#struct){ 139 - x: (int){ int } 140 - } 141 - ctot: (#struct){ 142 - x: (int){ int } 143 - } 144 - cpct: (#struct){ 145 - x: (int){ int } 146 - } 147 - ctcp: (#struct){ 148 - x: (int){ int } 149 - } 150 - ctct: (#struct){ 151 - x: (int){ int } 152 - } 153 - } 7 + opot: op & ot @test(eq, {x: int}) // {x: int, ...} 8 + otop: ot & op @test(eq, {x: int}) // {x: int, ...} 9 + opcp: op & cp @test(eq, {x: int}) @test(closed) // closed({x: int}) 10 + cpop: cp & op @test(eq, {x: int}) @test(closed) // closed({x: int}) 11 + opct: op & ct @test(eq, {x: int}) @test(closed) // {x: int, ...} 12 + ctop: ct & op @test(eq, {x: int}) @test(closed) // {x: int, ...} 13 + otcp: ot & cp @test(eq, {x: int}) @test(closed) // closed({x: int}) 14 + cpot: cp & ot @test(eq, {x: int}) @test(closed) // closed({x: int}) 15 + otct: ot & ct @test(eq, {x: int}) @test(closed) // {x: int, ...} 16 + ctot: ct & ot @test(eq, {x: int}) @test(closed) // {x: int, ...} 17 + cpct: cp & ct @test(eq, {x: int}) @test(closed) // closed({x: int}) 18 + ctcp: ct & cp @test(eq, {x: int}) @test(closed) // closed({x: int}) 19 + ctct: ct & ct @test(eq, {x: int}) @test(closed) @test(shareID=ctct) // {x: int, ...} 154 20 -- out/compile -- 155 21 --- in.cue 156 22 { ··· 182 48 ctcp: (〈0;ct〉 & 〈0;cp〉) 183 49 ctct: (〈0;ct〉 & 〈0;ct〉) 184 50 } 51 + -- out/eval/stats -- 52 + Leaks: 0 53 + Freed: 90 54 + Reused: 63 55 + Allocs: 27 56 + Retain: 0 57 + 58 + Unifications: 62 59 + Conjuncts: 125 60 + Disjuncts: 0 61 + 62 + NumCloseIDs: 38 63 + -- out/todo.txt -- 64 + ctct: v2 evaluator expands ctct to a full struct; v3 shares the vertex with ct.
+12 -178
cue/testdata/resolve/035_excluded_embedding_from_closing.txtar
··· 1 - #name: excluded embedding from closing 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 2 #S: { 6 3 a: {c: int} ··· 9 6 } 10 7 let B = {open: int} 11 8 b: B 12 - } 9 + } @test(eq, { 10 + a: {c: int} 11 + c: {d: int} 12 + b: {open: int} 13 + }) 13 14 V: #S & { 14 15 c: e: int 15 16 b: extra: int 16 - } 17 + } @test(err, code=eval, contains="field not allowed", pos=[2:5]) 18 + -- out/errors.txt -- 19 + [eval] V.c.e: field not allowed: 20 + ./in.cue:14:5 21 + [eval] V.b.extra: field not allowed: 22 + ./in.cue:15:5 17 23 -- out/compile -- 18 24 --- in.cue 19 25 { ··· 52 58 Disjuncts: 0 53 59 54 60 NumCloseIDs: 7 55 - -- out/evalalpha -- 56 - Errors: 57 - V.b.extra: field not allowed: 58 - ./in.cue:11:5 59 - V.c.e: field not allowed: 60 - ./in.cue:10:5 61 - 62 - Result: 63 - (_|_){ 64 - // [eval] 65 - #S: (#struct){ 66 - a: (#struct){ 67 - c: (int){ int } 68 - } 69 - c: (#struct){ 70 - d: (int){ int } 71 - } 72 - let B#1 = (#struct){ 73 - open: (int){ int } 74 - } 75 - b: (#struct){ 76 - open: (int){ int } 77 - } 78 - } 79 - V: (_|_){ 80 - // [eval] 81 - c: (_|_){ 82 - // [eval] 83 - e: (_|_){ 84 - // [eval] V.c.e: field not allowed: 85 - // ./in.cue:10:5 86 - } 87 - d: (int){ int } 88 - } 89 - b: (_|_){ 90 - // [eval] 91 - extra: (_|_){ 92 - // [eval] V.b.extra: field not allowed: 93 - // ./in.cue:11:5 94 - } 95 - open: (int){ int } 96 - } 97 - a: (#struct){ 98 - c: (int){ int } 99 - } 100 - let B#1 = (#struct){ 101 - open: (int){ int } 102 - } 103 - } 104 - } 105 - -- diff/-out/evalalpha<==>+out/eval -- 106 - diff old new 107 - --- old 108 - +++ new 109 - @@ -1,13 +1,7 @@ 110 - Errors: 111 - V.b.extra: field not allowed: 112 - - ./in.cue:6:10 113 - - ./in.cue:7:5 114 - - ./in.cue:9:4 115 - ./in.cue:11:5 116 - V.c.e: field not allowed: 117 - - ./in.cue:3:2 118 - - ./in.cue:4:6 119 - - ./in.cue:9:4 120 - ./in.cue:10:5 121 - 122 - Result: 123 - @@ -29,33 +23,27 @@ 124 - } 125 - V: (_|_){ 126 - // [eval] 127 - - a: (#struct){ 128 - - c: (int){ int } 129 - - } 130 - c: (_|_){ 131 - // [eval] 132 - - d: (int){ int } 133 - e: (_|_){ 134 - // [eval] V.c.e: field not allowed: 135 - - // ./in.cue:3:2 136 - - // ./in.cue:4:6 137 - - // ./in.cue:9:4 138 - // ./in.cue:10:5 139 - } 140 - - } 141 - - let B#1 = (#struct){ 142 - - open: (int){ int } 143 - + d: (int){ int } 144 - } 145 - b: (_|_){ 146 - // [eval] 147 - - open: (int){ int } 148 - extra: (_|_){ 149 - // [eval] V.b.extra: field not allowed: 150 - - // ./in.cue:6:10 151 - - // ./in.cue:7:5 152 - - // ./in.cue:9:4 153 - // ./in.cue:11:5 154 - } 155 - + open: (int){ int } 156 - + } 157 - + a: (#struct){ 158 - + c: (int){ int } 159 - + } 160 - + let B#1 = (#struct){ 161 - + open: (int){ int } 162 - } 163 - } 164 - } 165 - -- diff/todo/p2 -- 61 + -- out/todo.txt -- 166 62 Positions. 167 63 Reordering. 168 - -- out/eval -- 169 - Errors: 170 - V.b.extra: field not allowed: 171 - ./in.cue:6:10 172 - ./in.cue:7:5 173 - ./in.cue:9:4 174 - ./in.cue:11:5 175 - V.c.e: field not allowed: 176 - ./in.cue:3:2 177 - ./in.cue:4:6 178 - ./in.cue:9:4 179 - ./in.cue:10:5 180 - 181 - Result: 182 - (_|_){ 183 - // [eval] 184 - #S: (#struct){ 185 - a: (#struct){ 186 - c: (int){ int } 187 - } 188 - c: (#struct){ 189 - d: (int){ int } 190 - } 191 - let B#1 = (#struct){ 192 - open: (int){ int } 193 - } 194 - b: (#struct){ 195 - open: (int){ int } 196 - } 197 - } 198 - V: (_|_){ 199 - // [eval] 200 - a: (#struct){ 201 - c: (int){ int } 202 - } 203 - c: (_|_){ 204 - // [eval] 205 - d: (int){ int } 206 - e: (_|_){ 207 - // [eval] V.c.e: field not allowed: 208 - // ./in.cue:3:2 209 - // ./in.cue:4:6 210 - // ./in.cue:9:4 211 - // ./in.cue:10:5 212 - } 213 - } 214 - let B#1 = (#struct){ 215 - open: (int){ int } 216 - } 217 - b: (_|_){ 218 - // [eval] 219 - open: (int){ int } 220 - extra: (_|_){ 221 - // [eval] V.b.extra: field not allowed: 222 - // ./in.cue:6:10 223 - // ./in.cue:7:5 224 - // ./in.cue:9:4 225 - // ./in.cue:11:5 226 - } 227 - } 228 - } 229 - }
+10 -22
cue/testdata/resolve/038_incomplete_comprehensions.txtar
··· 1 - #name: incomplete comprehensions 2 - #evalPartial 3 - #todo:inline: medium — comprehension; may need @test(final) for incomplete fields 4 1 -- in.cue -- 5 2 A: { 6 3 for v in src { ··· 10 7 if true { 11 8 baz: "baz" 12 9 } 10 + @test(err, code=incomplete, contains="cannot range over src", pos=[1:11]) 13 11 } 14 12 B: A & { 15 13 src: ["foo", "bar"] 16 - } 14 + } @test(eq, { 15 + src: ["foo", "bar"] 16 + baz: "baz" 17 + foo: "foo" 18 + bar: "bar" 19 + }) 20 + -- out/errors.txt -- 21 + [incomplete] A: cannot range over src (incomplete type _): 22 + ./in.cue:2:11 17 23 -- out/compile -- 18 24 --- in.cue 19 25 { ··· 45 51 Disjuncts: 0 46 52 47 53 NumCloseIDs: 7 48 - -- out/evalalpha -- 49 - (struct){ 50 - A: (_|_){ 51 - // [incomplete] A: cannot range over src (incomplete type _): 52 - // ./in.cue:2:11 53 - src: (_){ _ } 54 - baz: (string){ "baz" } 55 - } 56 - B: (struct){ 57 - src: (#list){ 58 - 0: (string){ "foo" } 59 - 1: (string){ "bar" } 60 - } 61 - baz: (string){ "baz" } 62 - foo: (string){ "foo" } 63 - bar: (string){ "bar" } 64 - } 65 - }
+25 -63
cue/testdata/resolve/039_reference_to_root.txtar
··· 1 - #name: reference to root 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - a: {b: int} 2 + a: {b: int} @test(eq, {b: int}) 6 3 c: a & { 7 4 b: 100 8 5 d: a.b + 3 // do not resolve as c != a. 9 - } 6 + } @test(eq, {b: 100, d: _|_}) // d should be incomplete, not 103. 10 7 x: { 11 8 b: int 12 - c: b + 5 9 + c: b + 5 @test(err, code=incomplete, contains="non-concrete value int in operand to +", pos=[0:5, -1:5]) 10 + @test(eq, {b: int, c: _|_}) 13 11 } 14 - y: x & { 15 - b: 100 16 - // c should resolve to 105 17 - } 12 + y: x & {b: 100} @test(eq, {b: 100, c: 105}) // c should resolve to 105 18 13 v: { 19 14 b: int 20 - c: v.b + 5 // reference starting from copied node. 15 + c: v.b + 5 @test(err, code=incomplete, contains="non-concrete value int in operand to +", pos=[0:5, -1:5]) // reference starting from copied node. 16 + @test(eq, {b: int, c: _|_}) 21 17 } 22 - w: v & {b: 100} 23 - wp: v & {b: 100} 18 + w: v & {b: 100} @test(eq, {b: 100, c: _|_}) 19 + wp: v & {b: 100} @test(eq, {b: 100, c: _|_}) 20 + -- out/errors.txt -- 21 + [incomplete] c.d: non-concrete value int in operand to +: 22 + ./in.cue:4:5 23 + ./in.cue:1:8 24 + [incomplete] x.c: non-concrete value int in operand to +: 25 + ./in.cue:8:5 26 + ./in.cue:7:5 27 + [incomplete] v.c: non-concrete value int in operand to +: 28 + ./in.cue:14:5 29 + ./in.cue:13:5 30 + [incomplete] w.c: non-concrete value int in operand to +: 31 + ./in.cue:14:5 32 + ./in.cue:13:5 33 + [incomplete] wp.c: non-concrete value int in operand to +: 34 + ./in.cue:14:5 35 + ./in.cue:13:5 24 36 -- out/compile -- 25 37 --- in.cue 26 38 { ··· 61 73 Disjuncts: 0 62 74 63 75 NumCloseIDs: 4 64 - -- out/evalalpha -- 65 - (struct){ 66 - a: (struct){ 67 - b: (int){ int } 68 - } 69 - c: (struct){ 70 - b: (int){ 100 } 71 - d: (_|_){ 72 - // [incomplete] c.d: non-concrete value int in operand to +: 73 - // ./in.cue:4:5 74 - // ./in.cue:1:8 75 - } 76 - } 77 - x: (struct){ 78 - b: (int){ int } 79 - c: (_|_){ 80 - // [incomplete] x.c: non-concrete value int in operand to +: 81 - // ./in.cue:8:5 82 - // ./in.cue:7:5 83 - } 84 - } 85 - y: (struct){ 86 - b: (int){ 100 } 87 - c: (int){ 105 } 88 - } 89 - v: (struct){ 90 - b: (int){ int } 91 - c: (_|_){ 92 - // [incomplete] v.c: non-concrete value int in operand to +: 93 - // ./in.cue:16:5 94 - // ./in.cue:15:5 95 - } 96 - } 97 - w: (struct){ 98 - b: (int){ 100 } 99 - c: (_|_){ 100 - // [incomplete] w.c: non-concrete value int in operand to +: 101 - // ./in.cue:16:5 102 - // ./in.cue:15:5 103 - } 104 - } 105 - wp: (struct){ 106 - b: (int){ 100 } 107 - c: (_|_){ 108 - // [incomplete] wp.c: non-concrete value int in operand to +: 109 - // ./in.cue:16:5 110 - // ./in.cue:15:5 111 - } 112 - } 113 - }
+10 -63
cue/testdata/resolve/040_references_from_template_to_concrete.txtar
··· 1 - #name: references from template to concrete 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 - res: [t] 2 + res: [t] @test(eq, [{ 3 + x: { 4 + a: "XDDDD" 5 + b: str: "DDDD" 6 + c: "X" 7 + } 8 + }]) 6 9 t: [X=string]: { 7 10 a: c + b.str 8 11 b: str: string 9 12 c: "X" 10 13 } 11 - t: x: {b: str: "DDDD"} 14 + t: x: {b: str: "DDDD"} @test(eq, {b: {str: "DDDD"}, a: "XDDDD", c: "X"}) 12 15 -- out/compile -- 13 16 --- in.cue 14 17 { ··· 42 45 Unifications: 9 43 46 Conjuncts: 13 44 47 Disjuncts: 0 45 - -- out/evalalpha -- 46 - (struct){ 47 - res: (#list){ 48 - 0: ~(t) 49 - } 50 - t: (struct){ 51 - x: (struct){ 52 - b: (struct){ 53 - str: (string){ "DDDD" } 54 - } 55 - a: (string){ "XDDDD" } 56 - c: (string){ "X" } 57 - } 58 - } 59 - } 60 - -- diff/-out/evalalpha<==>+out/eval -- 61 - diff old new 62 - --- old 63 - +++ new 64 - @@ -1,14 +1,6 @@ 65 - (struct){ 66 - res: (#list){ 67 - - 0: (struct){ 68 - - x: (struct){ 69 - - b: (struct){ 70 - - str: (string){ "DDDD" } 71 - - } 72 - - a: (string){ "XDDDD" } 73 - - c: (string){ "X" } 74 - - } 75 - - } 76 - + 0: ~(t) 77 - } 78 - t: (struct){ 79 - x: (struct){ 80 - -- out/eval -- 81 - (struct){ 82 - res: (#list){ 83 - 0: (struct){ 84 - x: (struct){ 85 - b: (struct){ 86 - str: (string){ "DDDD" } 87 - } 88 - a: (string){ "XDDDD" } 89 - c: (string){ "X" } 90 - } 91 - } 92 - } 93 - t: (struct){ 94 - x: (struct){ 95 - b: (struct){ 96 - str: (string){ "DDDD" } 97 - } 98 - a: (string){ "XDDDD" } 99 - c: (string){ "X" } 100 - } 101 - } 102 - } 48 + -- out/todo.txt -- 49 + res[0]: v2 evaluator expands res[0] to a full struct; v3 shares the vertex with t.
+11 -61
cue/testdata/resolve/043_diamond-shaped_constraints.txtar
··· 1 - #name: diamond-shaped constraints 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 2 S: { 6 3 A: { ··· 9 6 B: A & { 10 7 b: 2 11 8 } 9 + @test(eq, {A: {a: 1}, B: {b: 2, a: 1}}) 12 10 } 13 11 T: S & {// S == { A: { a:1 }, B: { a:1, b:2 } } 14 12 A: { ··· 17 15 B: { 18 16 d: 4 // Combines constraints S.A, S.B, T.A, and T.B // S.B & A 19 17 } 20 - } 18 + } @test(eq, {A: {c: 3, a: 1}, B: {d: 4, b: 2, c: 3, a: 1}}) 19 + -- out/todo.txt -- 20 + Reordering 21 21 -- out/compile -- 22 22 --- in.cue 23 23 { ··· 50 50 Disjuncts: 0 51 51 52 52 NumCloseIDs: 3 53 - -- out/evalalpha -- 54 - (struct){ 55 - S: (struct){ 56 - A: (struct){ 57 - a: (int){ 1 } 58 - } 59 - B: (struct){ 60 - b: (int){ 2 } 61 - a: (int){ 1 } 62 - } 63 - } 64 - T: (struct){ 65 - A: (struct){ 66 - c: (int){ 3 } 67 - a: (int){ 1 } 68 - } 69 - B: (struct){ 70 - d: (int){ 4 } 71 - b: (int){ 2 } 72 - c: (int){ 3 } 73 - a: (int){ 1 } 74 - } 75 - } 76 - } 77 53 -- diff/-out/evalalpha<==>+out/eval -- 78 54 diff old new 79 55 --- old 80 56 +++ new 81 57 @@ -4,20 +4,20 @@ 82 - a: (int){ 1 } 83 - } 84 - B: (struct){ 58 + a: (int){ 1 } 59 + } 60 + B: (struct){ 85 61 - a: (int){ 1 } 86 62 - b: (int){ 2 } 87 63 + b: (int){ 2 } 88 64 + a: (int){ 1 } 89 - } 90 - } 91 - T: (struct){ 92 - A: (struct){ 65 + } 66 + } 67 + T: (struct){ 68 + A: (struct){ 93 69 - a: (int){ 1 } 94 70 - c: (int){ 3 } 95 71 - } ··· 105 81 + b: (int){ 2 } 106 82 + c: (int){ 3 } 107 83 + a: (int){ 1 } 108 - } 109 - } 110 - } 111 - -- diff/todo/p3 -- 112 - Reordering 113 - -- out/eval -- 114 - (struct){ 115 - S: (struct){ 116 - A: (struct){ 117 - a: (int){ 1 } 118 - } 119 - B: (struct){ 120 - a: (int){ 1 } 121 - b: (int){ 2 } 122 - } 123 - } 124 - T: (struct){ 125 - A: (struct){ 126 - a: (int){ 1 } 127 - c: (int){ 3 } 128 - } 129 - B: (struct){ 130 - a: (int){ 1 } 131 - c: (int){ 3 } 132 - b: (int){ 2 } 133 - d: (int){ 4 } 134 84 } 135 85 } 136 86 }
+9 -32
cue/testdata/resolve/044_field_templates.txtar
··· 1 - #name: field templates 2 - #evalPartial 3 - #todo:inline: medium — disjunctions; use @test(final) for default selection 4 1 -- in.cue -- 5 2 a: { 6 3 {[name=_]: int} 7 4 k: 1 8 - } 5 + } @test(eq, {k: 1}) 9 6 b: { 10 7 {[X=_]: {x: 0, y: *1 | int}} 11 8 v: {} 12 9 w: {x: 0} 13 10 } 14 - b: {[y=_]: {}} 11 + b: {[y=_]: {}} @test(eq, { 12 + v: {x: 0, y: *1 | int} 13 + w: {x: 0, y: *1 | int} 14 + }) 15 15 c: { 16 16 {[Name=_]: {name: Name, y: 1}} 17 17 foo: {} 18 18 bar: _ 19 - } 19 + } @test(eq, { 20 + foo: {name: "foo", y: 1} 21 + bar: {name: "bar", y: 1} 22 + }) 20 23 -- out/compile -- 21 24 --- in.cue 22 25 { ··· 64 67 Disjuncts: 4 65 68 66 69 NumCloseIDs: 6 67 - -- out/evalalpha -- 68 - (struct){ 69 - a: (struct){ 70 - k: (int){ 1 } 71 - } 72 - b: (struct){ 73 - v: (struct){ 74 - x: (int){ 0 } 75 - y: (int){ |(*(int){ 1 }, (int){ int }) } 76 - } 77 - w: (struct){ 78 - x: (int){ 0 } 79 - y: (int){ |(*(int){ 1 }, (int){ int }) } 80 - } 81 - } 82 - c: (struct){ 83 - foo: (struct){ 84 - name: (string){ "foo" } 85 - y: (int){ 1 } 86 - } 87 - bar: (struct){ 88 - name: (string){ "bar" } 89 - y: (int){ 1 } 90 - } 91 - } 92 - }
+64 -329
cue/testdata/resolve/045_range_unification.txtar
··· 1 - #name: range unification 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 2 // with concrete values 6 - a1: >=1 & <=5 & 3 7 - a2: >=1 & <=5 & 1 8 - a3: >=1 & <=5 & 5 9 - a4: >=1 & <=5 & 6 10 - a5: >=1 & <=5 & 0 3 + a1: >=1 & <=5 & 3 @test(eq, 3) 4 + a2: >=1 & <=5 & 1 @test(eq, 1) 5 + a3: >=1 & <=5 & 5 @test(eq, 5) 6 + a4: >=1 & <=5 & 6 @test(err, code=eval, contains="invalid value 6", pos=[0:11, 0:17]) 7 + a5: >=1 & <=5 & 0 @test(err, code=eval, contains="invalid value 0", pos=[0:5, 0:17]) 11 8 12 - a6: 3 & >=1 & <=5 13 - a7: 1 & >=1 & <=5 14 - a8: 5 & >=1 & <=5 15 - a9: 6 & >=1 & <=5 16 - a10: 0 & >=1 & <=5 9 + a6: 3 & >=1 & <=5 @test(eq, 3) 10 + a7: 1 & >=1 & <=5 @test(eq, 1) 11 + a8: 5 & >=1 & <=5 @test(eq, 5) 12 + a9: 6 & >=1 & <=5 @test(err, code=eval, contains="invalid value 6", pos=[0:16, 0:6]) 13 + a10: 0 & >=1 & <=5 @test(err, code=eval, contains="invalid value 0", pos=[0:10, 0:6]) 17 14 18 15 // with ranges 19 - b1: >=1 & <=5 & >=1 & <=5 20 - b2: >=1 & <=5 & >=1 & <=1 21 - b3: >=1 & <=5 & >=5 & <=5 22 - b4: >=1 & <=5 & >=2 & <=3 23 - b5: >=1 & <=5 & >=3 & <=9 24 - b6: >=1 & <=5 & >=5 & <=9 25 - b7: >=1 & <=5 & >=6 & <=9 16 + b1: >=1 & <=5 & >=1 & <=5 @test(eq, >=1 & <=5) 17 + b2: >=1 & <=5 & >=1 & <=1 @test(eq, >=1 & <=1) 18 + b3: >=1 & <=5 & >=5 & <=5 @test(eq, >=5 & <=5) 19 + b4: >=1 & <=5 & >=2 & <=3 @test(eq, >=2 & <=3) 20 + b5: >=1 & <=5 & >=3 & <=9 @test(eq, >=3 & <=5) 21 + b6: >=1 & <=5 & >=5 & <=9 @test(eq, >=5 & <=5) 22 + b7: >=1 & <=5 & >=6 & <=9 @test(err, code=eval, contains="incompatible number bounds", pos=[0:17, 0:11]) 26 23 27 - b8: >=1 & <=5 & >=1 & <=5 28 - b9: >=1 & <=1 & >=1 & <=5 29 - b10: >=5 & <=5 & >=1 & <=5 30 - b11: >=2 & <=3 & >=1 & <=5 31 - b12: >=3 & <=9 & >=1 & <=5 32 - b13: >=5 & <=9 & >=1 & <=5 33 - b14: >=6 & <=9 & >=1 & <=5 24 + b8: >=1 & <=5 & >=1 & <=5 @test(eq, >=1 & <=5) 25 + b9: >=1 & <=1 & >=1 & <=5 @test(eq, >=1 & <=1) 26 + b10: >=5 & <=5 & >=1 & <=5 @test(eq, >=5 & <=5) 27 + b11: >=2 & <=3 & >=1 & <=5 @test(eq, >=2 & <=3) 28 + b12: >=3 & <=9 & >=1 & <=5 @test(eq, >=3 & <=5) 29 + b13: >=5 & <=9 & >=1 & <=5 @test(eq, >=5 & <=5) 30 + b14: >=6 & <=9 & >=1 & <=5 @test(err, code=eval, contains="incompatible number bounds", pos=[0:24, 0:6]) 34 31 35 32 // ranges with more general types 36 - c1: int & >=1 & <=5 37 - c2: >=1 & <=5 & int 38 - c3: string & >=1 & <=5 39 - c4: >=1 & <=5 & string 33 + c1: int & >=1 & <=5 @test(eq, >=1 & <=5 & int) 34 + c2: >=1 & <=5 & int @test(eq, >=1 & <=5 & int) 35 + c3: string & >=1 & <=5 @test(err, code=eval, contains="conflicting values string and >=1", pos=[0:5, 0:14]) 36 + c4: >=1 & <=5 & string @test(err, code=eval, contains="conflicting values string and >=1", pos=[0:5, 0:17]) 40 37 41 38 // other types 42 - s1: >="d" & <="z" & "e" 43 - s2: >="d" & <="z" & "ee" 39 + s1: >="d" & <="z" & "e" @test(eq, "e") 40 + s2: >="d" & <="z" & "ee" @test(eq, "ee") 44 41 45 - n1: number & >=1 & <=2 46 - n2: int & >=1.1 & <=1.3 47 - n3: >=1.0 & <=3.0 & 2 48 - n4: >=0.0 & <=0.1 & 0.09999 49 - n5: >=1 & <=5 & 2.5 42 + n1: number & >=1 & <=2 @test(eq, >=1 & <=2) 43 + n2: int & >=1.1 & <=1.3 @test(err, code=eval, contains="incompatible integer bounds", pos=[0:19, 0:11]) 44 + n3: >=1.0 & <=3.0 & 2 @test(eq, 2) 45 + n4: >=0.0 & <=0.1 & 0.09999 @test(eq, 0.09999) 46 + n5: >=1 & <=5 & 2.5 @test(eq, 2.5) 47 + -- out/errors.txt -- 48 + [eval] a4: invalid value 6 (out of bound <=5): 49 + ./in.cue:5:11 50 + ./in.cue:5:17 51 + [eval] a5: invalid value 0 (out of bound >=1): 52 + ./in.cue:6:5 53 + ./in.cue:6:17 54 + [eval] a9: invalid value 6 (out of bound <=5): 55 + ./in.cue:11:16 56 + ./in.cue:11:6 57 + [eval] a10: invalid value 0 (out of bound >=1): 58 + ./in.cue:12:10 59 + ./in.cue:12:6 60 + [eval] b7: incompatible number bounds <=5 and >=6: 61 + ./in.cue:21:17 62 + ./in.cue:21:11 63 + [eval] b14: incompatible number bounds <=5 and >=6: 64 + ./in.cue:29:24 65 + ./in.cue:29:6 66 + [eval] c3: conflicting values string and >=1 (mismatched types string and number): 67 + ./in.cue:34:5 68 + ./in.cue:34:14 69 + [eval] c4: conflicting values string and >=1 (mismatched types string and number): 70 + ./in.cue:35:5 71 + ./in.cue:35:17 72 + [eval] n2: incompatible integer bounds <=1.3 and >=1.1: 73 + ./in.cue:42:19 74 + ./in.cue:42:11 50 75 -- out/compile -- 51 76 --- in.cue 52 77 { ··· 96 121 Unifications: 36 97 122 Conjuncts: 120 98 123 Disjuncts: 0 99 - -- out/evalalpha -- 100 - Errors: 101 - c3: conflicting values string and >=1 (mismatched types string and number): 102 - ./in.cue:34:5 103 - ./in.cue:34:14 104 - c4: conflicting values string and >=1 (mismatched types string and number): 105 - ./in.cue:35:5 106 - ./in.cue:35:17 107 - a4: invalid value 6 (out of bound <=5): 108 - ./in.cue:5:11 109 - ./in.cue:5:17 110 - a5: invalid value 0 (out of bound >=1): 111 - ./in.cue:6:5 112 - ./in.cue:6:17 113 - a9: invalid value 6 (out of bound <=5): 114 - ./in.cue:11:16 115 - ./in.cue:11:6 116 - a10: invalid value 0 (out of bound >=1): 117 - ./in.cue:12:10 118 - ./in.cue:12:6 119 - b7: incompatible number bounds <=5 and >=6: 120 - ./in.cue:21:17 121 - ./in.cue:21:11 122 - b14: incompatible number bounds <=5 and >=6: 123 - ./in.cue:29:24 124 - ./in.cue:29:6 125 - n2: incompatible integer bounds <=1.3 and >=1.1: 126 - ./in.cue:42:19 127 - ./in.cue:42:11 128 - 129 - Result: 130 - (_|_){ 131 - // [eval] 132 - a1: (int){ 3 } 133 - a2: (int){ 1 } 134 - a3: (int){ 5 } 135 - a4: (_|_){ 136 - // [eval] a4: invalid value 6 (out of bound <=5): 137 - // ./in.cue:5:11 138 - // ./in.cue:5:17 139 - } 140 - a5: (_|_){ 141 - // [eval] a5: invalid value 0 (out of bound >=1): 142 - // ./in.cue:6:5 143 - // ./in.cue:6:17 144 - } 145 - a6: (int){ 3 } 146 - a7: (int){ 1 } 147 - a8: (int){ 5 } 148 - a9: (_|_){ 149 - // [eval] a9: invalid value 6 (out of bound <=5): 150 - // ./in.cue:11:16 151 - // ./in.cue:11:6 152 - } 153 - a10: (_|_){ 154 - // [eval] a10: invalid value 0 (out of bound >=1): 155 - // ./in.cue:12:10 156 - // ./in.cue:12:6 157 - } 158 - b1: (number){ &(>=1, <=5) } 159 - b2: (number){ &(>=1, <=1) } 160 - b3: (number){ &(>=5, <=5) } 161 - b4: (number){ &(>=2, <=3) } 162 - b5: (number){ &(>=3, <=5) } 163 - b6: (number){ &(>=5, <=5) } 164 - b7: (_|_){ 165 - // [eval] b7: incompatible number bounds <=5 and >=6: 166 - // ./in.cue:21:17 167 - // ./in.cue:21:11 168 - } 169 - b8: (number){ &(>=1, <=5) } 170 - b9: (number){ &(>=1, <=1) } 171 - b10: (number){ &(>=5, <=5) } 172 - b11: (number){ &(>=2, <=3) } 173 - b12: (number){ &(>=3, <=5) } 174 - b13: (number){ &(>=5, <=5) } 175 - b14: (_|_){ 176 - // [eval] b14: incompatible number bounds <=5 and >=6: 177 - // ./in.cue:29:24 178 - // ./in.cue:29:6 179 - } 180 - c1: (int){ &(>=1, <=5, int) } 181 - c2: (int){ &(>=1, <=5, int) } 182 - c3: (_|_){ 183 - // [eval] c3: conflicting values string and >=1 (mismatched types string and number): 184 - // ./in.cue:34:5 185 - // ./in.cue:34:14 186 - } 187 - c4: (_|_){ 188 - // [eval] c4: conflicting values string and >=1 (mismatched types string and number): 189 - // ./in.cue:35:5 190 - // ./in.cue:35:17 191 - } 192 - s1: (string){ "e" } 193 - s2: (string){ "ee" } 194 - n1: (number){ &(>=1, <=2) } 195 - n2: (_|_){ 196 - // [eval] n2: incompatible integer bounds <=1.3 and >=1.1: 197 - // ./in.cue:42:19 198 - // ./in.cue:42:11 199 - } 200 - n3: (int){ 2 } 201 - n4: (float){ 0.09999 } 202 - n5: (float){ 2.5 } 203 - } 204 - -- diff/-out/evalalpha<==>+out/eval -- 205 - diff old new 206 - --- old 207 - +++ new 208 - @@ -1,19 +1,10 @@ 209 - Errors: 210 - -b14: incompatible number bounds <=5 and >=6: 211 - - ./in.cue:29:6 212 - - ./in.cue:29:24 213 - -b7: incompatible number bounds <=5 and >=6: 214 - - ./in.cue:21:11 215 - - ./in.cue:21:17 216 - c3: conflicting values string and >=1 (mismatched types string and number): 217 - ./in.cue:34:5 218 - ./in.cue:34:14 219 - -c4: conflicting values >=1 and string (mismatched types number and string): 220 - +c4: conflicting values string and >=1 (mismatched types string and number): 221 - ./in.cue:35:5 222 - ./in.cue:35:17 223 - -n2: incompatible integer bounds <=1.3 and >=1.1: 224 - - ./in.cue:42:11 225 - - ./in.cue:42:19 226 - a4: invalid value 6 (out of bound <=5): 227 - ./in.cue:5:11 228 - ./in.cue:5:17 229 - @@ -26,6 +17,15 @@ 230 - a10: invalid value 0 (out of bound >=1): 231 - ./in.cue:12:10 232 - ./in.cue:12:6 233 - +b7: incompatible number bounds <=5 and >=6: 234 - + ./in.cue:21:17 235 - + ./in.cue:21:11 236 - +b14: incompatible number bounds <=5 and >=6: 237 - + ./in.cue:29:24 238 - + ./in.cue:29:6 239 - +n2: incompatible integer bounds <=1.3 and >=1.1: 240 - + ./in.cue:42:19 241 - + ./in.cue:42:11 242 - 243 - Result: 244 - (_|_){ 245 - @@ -64,8 +64,8 @@ 246 - b6: (number){ &(>=5, <=5) } 247 - b7: (_|_){ 248 - // [eval] b7: incompatible number bounds <=5 and >=6: 249 - - // ./in.cue:21:11 250 - // ./in.cue:21:17 251 - + // ./in.cue:21:11 252 - } 253 - b8: (number){ &(>=1, <=5) } 254 - b9: (number){ &(>=1, <=1) } 255 - @@ -75,8 +75,8 @@ 256 - b13: (number){ &(>=5, <=5) } 257 - b14: (_|_){ 258 - // [eval] b14: incompatible number bounds <=5 and >=6: 259 - - // ./in.cue:29:6 260 - // ./in.cue:29:24 261 - + // ./in.cue:29:6 262 - } 263 - c1: (int){ &(>=1, <=5, int) } 264 - c2: (int){ &(>=1, <=5, int) } 265 - @@ -86,7 +86,7 @@ 266 - // ./in.cue:34:14 267 - } 268 - c4: (_|_){ 269 - - // [eval] c4: conflicting values >=1 and string (mismatched types number and string): 270 - + // [eval] c4: conflicting values string and >=1 (mismatched types string and number): 271 - // ./in.cue:35:5 272 - // ./in.cue:35:17 273 - } 274 - @@ -95,8 +95,8 @@ 275 - n1: (number){ &(>=1, <=2) } 276 - n2: (_|_){ 277 - // [eval] n2: incompatible integer bounds <=1.3 and >=1.1: 278 - - // ./in.cue:42:11 279 - // ./in.cue:42:19 280 - + // ./in.cue:42:11 281 - } 282 - n3: (int){ 2 } 283 - n4: (float){ 0.09999 } 284 - -- diff/todo/p3 -- 124 + -- out/todo.txt -- 285 125 Reordering of error messages. 286 - -- out/eval -- 287 - Errors: 288 - b14: incompatible number bounds <=5 and >=6: 289 - ./in.cue:29:6 290 - ./in.cue:29:24 291 - b7: incompatible number bounds <=5 and >=6: 292 - ./in.cue:21:11 293 - ./in.cue:21:17 294 - c3: conflicting values string and >=1 (mismatched types string and number): 295 - ./in.cue:34:5 296 - ./in.cue:34:14 297 - c4: conflicting values >=1 and string (mismatched types number and string): 298 - ./in.cue:35:5 299 - ./in.cue:35:17 300 - n2: incompatible integer bounds <=1.3 and >=1.1: 301 - ./in.cue:42:11 302 - ./in.cue:42:19 303 - a4: invalid value 6 (out of bound <=5): 304 - ./in.cue:5:11 305 - ./in.cue:5:17 306 - a5: invalid value 0 (out of bound >=1): 307 - ./in.cue:6:5 308 - ./in.cue:6:17 309 - a9: invalid value 6 (out of bound <=5): 310 - ./in.cue:11:16 311 - ./in.cue:11:6 312 - a10: invalid value 0 (out of bound >=1): 313 - ./in.cue:12:10 314 - ./in.cue:12:6 315 - 316 - Result: 317 - (_|_){ 318 - // [eval] 319 - a1: (int){ 3 } 320 - a2: (int){ 1 } 321 - a3: (int){ 5 } 322 - a4: (_|_){ 323 - // [eval] a4: invalid value 6 (out of bound <=5): 324 - // ./in.cue:5:11 325 - // ./in.cue:5:17 326 - } 327 - a5: (_|_){ 328 - // [eval] a5: invalid value 0 (out of bound >=1): 329 - // ./in.cue:6:5 330 - // ./in.cue:6:17 331 - } 332 - a6: (int){ 3 } 333 - a7: (int){ 1 } 334 - a8: (int){ 5 } 335 - a9: (_|_){ 336 - // [eval] a9: invalid value 6 (out of bound <=5): 337 - // ./in.cue:11:16 338 - // ./in.cue:11:6 339 - } 340 - a10: (_|_){ 341 - // [eval] a10: invalid value 0 (out of bound >=1): 342 - // ./in.cue:12:10 343 - // ./in.cue:12:6 344 - } 345 - b1: (number){ &(>=1, <=5) } 346 - b2: (number){ &(>=1, <=1) } 347 - b3: (number){ &(>=5, <=5) } 348 - b4: (number){ &(>=2, <=3) } 349 - b5: (number){ &(>=3, <=5) } 350 - b6: (number){ &(>=5, <=5) } 351 - b7: (_|_){ 352 - // [eval] b7: incompatible number bounds <=5 and >=6: 353 - // ./in.cue:21:11 354 - // ./in.cue:21:17 355 - } 356 - b8: (number){ &(>=1, <=5) } 357 - b9: (number){ &(>=1, <=1) } 358 - b10: (number){ &(>=5, <=5) } 359 - b11: (number){ &(>=2, <=3) } 360 - b12: (number){ &(>=3, <=5) } 361 - b13: (number){ &(>=5, <=5) } 362 - b14: (_|_){ 363 - // [eval] b14: incompatible number bounds <=5 and >=6: 364 - // ./in.cue:29:6 365 - // ./in.cue:29:24 366 - } 367 - c1: (int){ &(>=1, <=5, int) } 368 - c2: (int){ &(>=1, <=5, int) } 369 - c3: (_|_){ 370 - // [eval] c3: conflicting values string and >=1 (mismatched types string and number): 371 - // ./in.cue:34:5 372 - // ./in.cue:34:14 373 - } 374 - c4: (_|_){ 375 - // [eval] c4: conflicting values >=1 and string (mismatched types number and string): 376 - // ./in.cue:35:5 377 - // ./in.cue:35:17 378 - } 379 - s1: (string){ "e" } 380 - s2: (string){ "ee" } 381 - n1: (number){ &(>=1, <=2) } 382 - n2: (_|_){ 383 - // [eval] n2: incompatible integer bounds <=1.3 and >=1.1: 384 - // ./in.cue:42:11 385 - // ./in.cue:42:19 386 - } 387 - n3: (int){ 2 } 388 - n4: (float){ 0.09999 } 389 - n5: (float){ 2.5 } 390 - }
+6 -21
cue/testdata/resolve/046_predefined_ranges.txtar
··· 1 - #name: predefined ranges 2 - #evalPartial 3 - #todo:inline: medium — evalPartial; incomplete values may need @test(kind=...) or @test(final) 4 1 -- in.cue -- 5 2 k1: int8 6 - k1: 44 3 + k1: 44 @test(eq, 44) 7 4 8 5 k2: int64 9 - k2: -8_000_000_000 6 + k2: -8_000_000_000 @test(eq, -8000000000) 10 7 11 8 e1: int16 12 - e1: 100_000 9 + e1: 100_000 @test(err, code=eval, contains="invalid value 100000", pos=[0:5]) 10 + -- out/errors.txt -- 11 + [eval] e1: invalid value 100000 (out of bound <=32767): 12 + ./in.cue:8:5 13 13 -- out/compile -- 14 14 --- in.cue 15 15 { ··· 30 30 Unifications: 4 31 31 Conjuncts: 7 32 32 Disjuncts: 0 33 - -- out/evalalpha -- 34 - Errors: 35 - e1: invalid value 100000 (out of bound <=32767): 36 - ./in.cue:8:5 37 - 38 - Result: 39 - (_|_){ 40 - // [eval] 41 - k1: (int){ 44 } 42 - k2: (int){ -8000000000 } 43 - e1: (_|_){ 44 - // [eval] e1: invalid value 100000 (out of bound <=32767): 45 - // ./in.cue:8:5 46 - } 47 - }
+78 -231
cue/testdata/resolve/048_builtins.txtar
··· 1 - #name: builtins 2 - #evalPartial 3 - #todo:inline: medium — imported builtin validators; needs cmpBuiltinExpr path 4 1 -- in.cue -- 5 2 import ( 6 3 "list" ··· 11 8 a: and([b, c]) 12 9 b: =~"oo" 13 10 c: =~"fo" 14 - } 15 - a2: a1 & {a: "foo"} 16 - a3: a1 & {a: "bar"} 11 + } @test(eq, { 12 + a: =~"oo" & =~"fo" 13 + b: =~"oo" 14 + c: =~"fo" 15 + }) 16 + a2: a1 & {a: "foo"} @test(eq, {a: "foo", b: =~"oo", c: =~"fo"}) 17 + a3: a1 & {a: "bar"} @test(err, code=eval, 18 + suberr=(code=eval, contains="invalid value", args=["bar", =~"oo"], pos=[-8:5, -9:5, 0:14]), 19 + suberr=(code=eval, contains="invalid value", args=["bar", =~"fo"], pos=[-7:5, -9:5, 0:14])) 17 20 18 21 o1: { 19 22 a: or([b, c]) 20 23 b: string 21 24 c: "bar" 22 - } 23 - o2: o1 & {a: "foo"} 24 - o3: o1 & {a: "foo", b: "baz"} 25 + } @test(eq, {a: string | "bar", b: string, c: "bar"}) 26 + o2: o1 & {a: "foo"} @test(eq, {a: "foo", b: string, c: "bar"}) 27 + o3: o1 & {a: "foo", b: "baz"} @test(err, code=eval, 28 + suberr=(code=eval, contains="conflicting values", args=["bar", "foo"], pos=[-5:12, -3:5, 0:5, 0:14]), 29 + suberr=(code=eval, contains="conflicting values", args=["baz", "foo"], pos=[-5:9, 0:5, 0:14, 0:24])) 25 30 26 31 // Issue #585 27 32 stringListErrors: { 28 33 a: { 29 34 x: [string, ...string] 30 - result: strings.Join(x, " ") 35 + result: strings.Join(x, " ") @test(err, code=incomplete, 36 + contains="non-concrete value string for element", pos=[0:11, -1:7]) 31 37 } 32 38 33 39 b: { 34 40 x: [int, ...string] 35 - result: strings.Join(x, " ") 41 + result: strings.Join(x, " ") @test(err, code=eval, 42 + contains="cannot use value int (int) as string", pos=[0:11, -1:7]) 36 43 } 37 44 38 45 c: { 39 46 x: [] 40 - result: strings.Join(x, int) 47 + result: strings.Join(x, int) @test(err, code=eval, 48 + contains="cannot use int (type int) as string in argument 2 to strings.Join", 49 + pos=[0:27]) 41 50 } 42 51 } 43 52 44 53 decimalListErrors: { 45 54 a: { 46 55 x: [string] 47 - result: list.Avg(x) 56 + result: list.Avg(x) @test(err, code=eval, 57 + contains="invalid list element", pos=[0:11, -1:7]) 58 + // TODO: allow checking wrapped errors: args=[string, number], 48 59 } 49 60 50 61 b: { 51 62 x: [int, ...string] 52 - result: list.Avg(x) 63 + result: list.Avg(x) @test(err, code=incomplete, 64 + contains="non-concrete value int for element 0 of number list argument 0", pos=[0:11, -1:7]) 53 65 } 54 66 } 55 - // [eval] 56 - // [eval] 57 - // [eval] a3.a: invalid value \"bar\" (out of bound =~\"oo\"): 58 - // in.cue:8:5 59 - // in.cue:7:5 60 - // in.cue:12:14 61 - // a3.a: invalid value \"bar\" (out of bound =~\"fo\"): 62 - // in.cue:9:5 63 - // in.cue:7:5 64 - // in.cue:12:14 65 - // [eval] 66 - // [eval] o3.a: 2 errors in empty disjunction: 67 - // o3.a: conflicting values \"bar\" and \"foo\": 68 - // in.cue:15:12 69 - // in.cue:17:5 70 - // in.cue:20:5 71 - // in.cue:20:14 72 - // o3.a: conflicting values \"baz\" and \"foo\": 73 - // in.cue:15:9 74 - // in.cue:20:5 75 - // in.cue:20:14 76 - // in.cue:20:24 77 - // [eval] 78 - // [incomplete] stringListErrors.a.result: error in call to strings.Join: non-concrete value string for element 0 of string list argument 0: 79 - // in.cue:26:11 80 - // in.cue:25:7 81 - // [eval] 82 - // [eval] stringListErrors.b.result: error in call to strings.Join: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: 83 - // in.cue:31:11 84 - // in.cue:30:7 85 - // [eval] 86 - // [eval] stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join: 87 - // in.cue:36:27 88 - // [eval] 89 - // [eval] 90 - // [eval] decimalListErrors.a.result: error in call to list.Avg: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: 91 - // in.cue:43:11 92 - // in.cue:42:7 93 - // [incomplete] decimalListErrors.b.result: error in call to list.Avg: non-concrete value int for element 0 of number list argument 0: 94 - // in.cue:48:11 95 - // in.cue:47:7 96 67 -- issue3648.cue -- 97 68 // Fully finalize values before passing them to builtins. 98 69 ··· 107 78 b: [{}] 108 79 } 109 80 foo: {} 81 + 82 + @test(eq, {foo: {a: [{}], b: [{}]}}) 110 83 } 111 84 issue3648: full: { 112 85 #Redirect: path?: string ··· 117 90 redirects: [...#Redirect] 118 91 } 119 92 foo: {} 93 + 94 + @test(eq, { 95 + #Redirect: {path?: string} 96 + [string]: { 97 + allRedirects: list.Concat([[]]) 98 + redirects: [] 99 + } 100 + foo: {allRedirects: [], redirects: []} 101 + }) 120 102 } 121 - -- out/eval/stats -- 122 - Leaks: 1 123 - Freed: 86 124 - Reused: 68 125 - Allocs: 19 126 - Retain: 0 127 - 128 - Unifications: 69 129 - Conjuncts: 119 130 - Disjuncts: 6 131 - 132 - NumCloseIDs: 30 133 - -- out/evalalpha -- 134 - Errors: 135 - o3.a: 2 errors in empty disjunction: 136 - o3.a: conflicting values "bar" and "foo": 137 - ./in.cue:15:12 138 - ./in.cue:17:5 139 - ./in.cue:20:5 140 - ./in.cue:20:14 141 - o3.a: conflicting values "baz" and "foo": 142 - ./in.cue:15:9 143 - ./in.cue:20:5 144 - ./in.cue:20:14 145 - ./in.cue:20:24 146 - a3.a: invalid value "bar" (out of bound =~"oo"): 103 + -- out/errors.txt -- 104 + [eval] a3.a: invalid value "bar" (out of bound =~"oo"): 147 105 ./in.cue:8:5 148 106 ./in.cue:7:5 149 - ./in.cue:12:14 107 + ./in.cue:16:14 150 108 a3.a: invalid value "bar" (out of bound =~"fo"): 151 109 ./in.cue:9:5 152 110 ./in.cue:7:5 153 - ./in.cue:12:14 154 - stringListErrors.b.result: error in call to strings.Join: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: 155 - ./in.cue:31:11 156 - ./in.cue:30:7 157 - stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join: 158 - ./in.cue:36:27 159 - decimalListErrors.a.result: error in call to list.Avg: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: 160 - ./in.cue:43:11 161 - ./in.cue:42:7 162 - 163 - Result: 164 - (_|_){ 165 - // [eval] 166 - a1: (struct){ 167 - a: (string){ &(=~"oo", =~"fo") } 168 - b: (string){ =~"oo" } 169 - c: (string){ =~"fo" } 170 - } 171 - a2: (struct){ 172 - a: (string){ "foo" } 173 - b: (string){ =~"oo" } 174 - c: (string){ =~"fo" } 175 - } 176 - a3: (_|_){ 177 - // [eval] 178 - a: (_|_){ 179 - // [eval] a3.a: invalid value "bar" (out of bound =~"oo"): 180 - // ./in.cue:8:5 181 - // ./in.cue:7:5 182 - // ./in.cue:12:14 183 - // a3.a: invalid value "bar" (out of bound =~"fo"): 184 - // ./in.cue:9:5 185 - // ./in.cue:7:5 186 - // ./in.cue:12:14 187 - } 188 - b: (string){ =~"oo" } 189 - c: (string){ =~"fo" } 190 - } 191 - o1: (struct){ 192 - a: (string){ |((string){ string }, (string){ "bar" }) } 193 - b: (string){ string } 194 - c: (string){ "bar" } 195 - } 196 - o2: (struct){ 197 - a: (string){ "foo" } 198 - b: (string){ string } 199 - c: (string){ "bar" } 200 - } 201 - o3: (_|_){ 202 - // [eval] 203 - a: (_|_){ 204 - // [eval] o3.a: 2 errors in empty disjunction: 205 - // o3.a: conflicting values "bar" and "foo": 206 - // ./in.cue:15:12 207 - // ./in.cue:17:5 208 - // ./in.cue:20:5 209 - // ./in.cue:20:14 210 - // o3.a: conflicting values "baz" and "foo": 211 - // ./in.cue:15:9 212 - // ./in.cue:20:5 213 - // ./in.cue:20:14 214 - // ./in.cue:20:24 215 - } 216 - b: (string){ "baz" } 217 - c: (string){ "bar" } 218 - } 219 - stringListErrors: (_|_){ 220 - // [eval] 221 - a: (struct){ 222 - x: (list){ 223 - 0: (string){ string } 224 - } 225 - result: (_|_){ 226 - // [incomplete] stringListErrors.a.result: error in call to strings.Join: non-concrete value string for element 0 of string list argument 0: 227 - // ./in.cue:26:11 228 - // ./in.cue:25:7 229 - } 230 - } 231 - b: (_|_){ 232 - // [eval] 233 - x: (list){ 234 - 0: (int){ int } 235 - } 236 - result: (_|_){ 237 - // [eval] stringListErrors.b.result: error in call to strings.Join: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: 238 - // ./in.cue:31:11 239 - // ./in.cue:30:7 240 - } 241 - } 242 - c: (_|_){ 243 - // [eval] 244 - x: (#list){ 245 - } 246 - result: (_|_){ 247 - // [eval] stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join: 248 - // ./in.cue:36:27 249 - } 250 - } 251 - } 252 - decimalListErrors: (_|_){ 253 - // [eval] 254 - a: (_|_){ 255 - // [eval] 256 - x: (#list){ 257 - 0: (string){ string } 258 - } 259 - result: (_|_){ 260 - // [eval] decimalListErrors.a.result: error in call to list.Avg: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: 261 - // ./in.cue:43:11 262 - // ./in.cue:42:7 263 - } 264 - } 265 - b: (struct){ 266 - x: (list){ 267 - 0: (int){ int } 268 - } 269 - result: (_|_){ 270 - // [incomplete] decimalListErrors.b.result: error in call to list.Avg: non-concrete value int for element 0 of number list argument 0: 271 - // ./in.cue:48:11 272 - // ./in.cue:47:7 273 - } 274 - } 275 - } 276 - issue3648: (struct){ 277 - reduced: (struct){ 278 - foo: (struct){ 279 - a: (#list){ 280 - 0: (struct){ 281 - } 282 - } 283 - b: (#list){ 284 - 0: (struct){ 285 - } 286 - } 287 - } 288 - } 289 - full: (struct){ 290 - #Redirect: (#struct){ 291 - path?: (string){ string } 292 - } 293 - foo: (struct){ 294 - allRedirects: (#list){ 295 - } 296 - redirects: (list){ 297 - } 298 - } 299 - } 300 - } 301 - } 111 + ./in.cue:16:14 112 + [eval] o3.a: 2 errors in empty disjunction: 113 + o3.a: conflicting values "bar" and "foo": 114 + ./in.cue:21:12 115 + ./in.cue:23:5 116 + ./in.cue:26:5 117 + ./in.cue:26:14 118 + o3.a: conflicting values "baz" and "foo": 119 + ./in.cue:21:9 120 + ./in.cue:26:5 121 + ./in.cue:26:14 122 + ./in.cue:26:24 123 + [incomplete] stringListErrors.a.result: error in call to strings.Join: non-concrete value string for element 0 of string list argument 0: 124 + ./in.cue:34:11 125 + ./in.cue:33:7 126 + [eval] stringListErrors.b.result: error in call to strings.Join: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: 127 + ./in.cue:40:11 128 + ./in.cue:39:7 129 + [eval] stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join: 130 + ./in.cue:46:27 131 + [eval] decimalListErrors.a.result: error in call to list.Avg: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: 132 + ./in.cue:55:11 133 + ./in.cue:54:7 134 + [incomplete] decimalListErrors.b.result: error in call to list.Avg: non-concrete value int for element 0 of number list argument 0: 135 + ./in.cue:62:11 136 + ./in.cue:61:7 302 137 -- out/compile -- 303 138 --- in.cue 304 139 { ··· 399 234 } 400 235 } 401 236 } 237 + -- out/eval/stats -- 238 + Leaks: 1 239 + Freed: 86 240 + Reused: 68 241 + Allocs: 19 242 + Retain: 0 243 + 244 + Unifications: 69 245 + Conjuncts: 119 246 + Disjuncts: 6 247 + 248 + NumCloseIDs: 30