I know for a fact that the isSlice property of the String returned from Int.toString() is false, but the compiler insists that it's true even when I explicity set it to false right before calling padStart.
pub fn padStart(self: *String, width: u32, str: anytype) void {
if (self.isSlice) {
@compileError("cannot pad a slice");
}
const padAmount = width - self.len();
if (padAmount > 0) {
var temp = String.new(width);
temp.concat(str);
temp.repeat(padAmount / temp.len());
temp.concat(self.*);
self.free();
self.bytes = temp.bytes;
}
}
//...
var offsetStr = Int.toString(offset, 10);
defer offsetStr.free();
offsetStr.isSlice = false;
offsetStr.padStart(4, "0");
src/lib/vexlib.zig:1266:13: error: cannot pad a slice
@compileError("cannot pad a slice");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~