| ... | ... | @@ -19732,7 +19732,10 @@ fn analyzeSlice( |
| 19732 | 19732 | block, |
| 19733 | 19733 | end_src, |
| 19734 | 19734 | "end index {} out of bounds for array of length {}", |
| 19735 | | .{ end_val.fmtValue(Type.usize), len_val.fmtValue(Type.usize) }, |
| 19735 | .{ |
| 19736 | end_val.fmtValue(Type.usize, target), |
| 19737 | len_val.fmtValue(Type.usize, target), |
| 19738 | }, |
| 19736 | 19739 | ); |
| 19737 | 19740 | } |
| 19738 | 19741 | if (end_val.eql(len_val, Type.usize, target)) { |
| ... | ... | @@ -19758,7 +19761,10 @@ fn analyzeSlice( |
| 19758 | 19761 | block, |
| 19759 | 19762 | end_src, |
| 19760 | 19763 | "end index {} out of bounds for slice of length {}", |
| 19761 | | .{ end_val.fmtValue(Type.usize), slice_len_val.fmtValue(Type.usize) }, |
| 19764 | .{ |
| 19765 | end_val.fmtValue(Type.usize, target), |
| 19766 | slice_len_val.fmtValue(Type.usize, target), |
| 19767 | }, |
| 19762 | 19768 | ); |
| 19763 | 19769 | } |
| 19764 | 19770 | if (end_val.eql(slice_len_val, Type.usize, target)) { |
| ... | ... | @@ -19794,12 +19800,15 @@ fn analyzeSlice( |
| 19794 | 19800 | // requirement: start <= end |
| 19795 | 19801 | if (try sema.resolveDefinedValue(block, src, end)) |end_val| { |
| 19796 | 19802 | if (try sema.resolveDefinedValue(block, src, start)) |start_val| { |
| 19797 | | if (start_val.compare(.gt, end_val, Type.usize)) { |
| 19803 | if (start_val.compare(.gt, end_val, Type.usize, target)) { |
| 19798 | 19804 | return sema.fail( |
| 19799 | 19805 | block, |
| 19800 | 19806 | start_src, |
| 19801 | 19807 | "start index {} is larger than end index {}", |
| 19802 | | .{ start_val.fmtValue(Type.usize), end_val.fmtValue(Type.usize) }, |
| 19808 | .{ |
| 19809 | start_val.fmtValue(Type.usize, target), |
| 19810 | end_val.fmtValue(Type.usize, target), |
| 19811 | }, |
| 19803 | 19812 | ); |
| 19804 | 19813 | } |
| 19805 | 19814 | } |