cuelang.org/go@v0.10.1/cue/testdata/resolve/012_bound_conversions.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: bound conversions 4 #evalPartial 5 -- in.cue -- 6 r0: int & >0.1 & <=1.9 7 r1: int & >0.1 & <1.9 8 r2: int & >=0.1 & <1.9 9 r3: int & >=-1.9 & <=-0.1 10 r4: int & >-1.9 & <=-0.1 11 12 r5: >=1.1 & <=1.1 13 r6: r5 & 1.1 14 15 c1: (1.2 & >1.3) & <2 16 c2: 1.2 & (>1.3 & <2) 17 18 c3: 1.2 & (>=1 & <2) 19 c4: 1.2 & (>=1 & <2 & int) 20 -- out/def -- 21 r0: 1 22 r1: 1 23 r2: 1 24 r3: -1 25 r4: -1 26 r5: 1.1 27 r6: 1.1 28 c1: _|_ // invalid value 1.2 (out of bound >1.3) 29 c2: _|_ // invalid value 1.2 (out of bound >1.3) 30 c3: 1.2 31 c4: _|_ // conflicting values 1.2 and ((>=1 & <2) & int) (mismatched types float and int) 32 -- out/legacy-debug -- 33 <0>{r0: 1, r1: 1, r2: 1, r3: -1, r4: -1, r5: 1.1, r6: 1.1, c1: _|_((>1.3 & 1.2):invalid value 1.2 (out of bound >1.3)), c2: _|_((>1.3 & 1.2):invalid value 1.2 (out of bound >1.3)), c3: 1.2, c4: _|_((1.2 & ((>=1 & <2) & int)):conflicting values 1.2 and ((>=1 & <2) & int) (mismatched types float and int))} 34 -- out/compile -- 35 --- in.cue 36 { 37 r0: ((int & >0.1) & <=1.9) 38 r1: ((int & >0.1) & <1.9) 39 r2: ((int & >=0.1) & <1.9) 40 r3: ((int & >=-1.9) & <=-0.1) 41 r4: ((int & >-1.9) & <=-0.1) 42 r5: (>=1.1 & <=1.1) 43 r6: (〈0;r5〉 & 1.1) 44 c1: ((1.2 & >1.3) & <2) 45 c2: (1.2 & (>1.3 & <2)) 46 c3: (1.2 & (>=1 & <2)) 47 c4: (1.2 & ((>=1 & <2) & int)) 48 } 49 -- out/eval/stats -- 50 Leaks: 0 51 Freed: 12 52 Reused: 10 53 Allocs: 2 54 Retain: 0 55 56 Unifications: 12 57 Conjuncts: 35 58 Disjuncts: 12 59 -- out/evalalpha -- 60 Errors: 61 c4: conflicting values 1.2 and int (mismatched types float and int): 62 ./in.cue:14:5 63 ./in.cue:14:23 64 c1: invalid value 1.2 (out of bound >1.3): 65 ./in.cue:10:12 66 ./in.cue:10:6 67 c2: invalid value 1.2 (out of bound >1.3): 68 ./in.cue:11:12 69 ./in.cue:11:5 70 71 Result: 72 (_|_){ 73 // [eval] 74 r0: (int){ 1 } 75 r1: (int){ 1 } 76 r2: (int){ 1 } 77 r3: (int){ -1 } 78 r4: (int){ -1 } 79 r5: (number){ 1.1 } 80 r6: (float){ 1.1 } 81 c1: (_|_){ 82 // [eval] c1: invalid value 1.2 (out of bound >1.3): 83 // ./in.cue:10:12 84 // ./in.cue:10:6 85 } 86 c2: (_|_){ 87 // [eval] c2: invalid value 1.2 (out of bound >1.3): 88 // ./in.cue:11:12 89 // ./in.cue:11:5 90 } 91 c3: (float){ 1.2 } 92 c4: (_|_){ 93 // [eval] c4: conflicting values 1.2 and int (mismatched types float and int): 94 // ./in.cue:14:5 95 // ./in.cue:14:23 96 } 97 } 98 -- diff/-out/evalalpha<==>+out/eval -- 99 diff old new 100 --- old 101 +++ new 102 @@ -18,7 +18,7 @@ 103 r3: (int){ -1 } 104 r4: (int){ -1 } 105 r5: (number){ 1.1 } 106 - r6: (number){ 1.1 } 107 + r6: (float){ 1.1 } 108 c1: (_|_){ 109 // [eval] c1: invalid value 1.2 (out of bound >1.3): 110 // ./in.cue:10:12 111 -- diff/todo/p3 -- 112 Seems like a correct fix, but investigate. 113 This is independent from the fact that we probably 114 want to relax the type of float literals to number. 115 -- out/eval -- 116 Errors: 117 c4: conflicting values 1.2 and int (mismatched types float and int): 118 ./in.cue:14:5 119 ./in.cue:14:23 120 c1: invalid value 1.2 (out of bound >1.3): 121 ./in.cue:10:12 122 ./in.cue:10:6 123 c2: invalid value 1.2 (out of bound >1.3): 124 ./in.cue:11:12 125 ./in.cue:11:5 126 127 Result: 128 (_|_){ 129 // [eval] 130 r0: (int){ 1 } 131 r1: (int){ 1 } 132 r2: (int){ 1 } 133 r3: (int){ -1 } 134 r4: (int){ -1 } 135 r5: (number){ 1.1 } 136 r6: (number){ 1.1 } 137 c1: (_|_){ 138 // [eval] c1: invalid value 1.2 (out of bound >1.3): 139 // ./in.cue:10:12 140 // ./in.cue:10:6 141 } 142 c2: (_|_){ 143 // [eval] c2: invalid value 1.2 (out of bound >1.3): 144 // ./in.cue:11:12 145 // ./in.cue:11:5 146 } 147 c3: (float){ 1.2 } 148 c4: (_|_){ 149 // [eval] c4: conflicting values 1.2 and int (mismatched types float and int): 150 // ./in.cue:14:5 151 // ./in.cue:14:23 152 } 153 }