Prior to this fix, if a byte string literal happened to contain
a sequence of bytes that could be interpreted as a UTF-8 codepoint,
then the size of the String in Crystal would be less than
expected (because there are fewer codepoints than bytes),
which was resulting in the byte literal being generated in LLVM IR
as having its last few bytes trimmed off the end.
Using bytesize instead of size in Crystal fixes this issue.
Prior to this fix, if a byte string literal happened to contain a sequence of bytes that could be interpreted as a UTF-8 codepoint, then the
size
of theString
in Crystal would be less than expected (because there are fewer codepoints than bytes), which was resulting in the byte literal being generated in LLVM IR as having its last few bytes trimmed off the end.Using
bytesize
instead ofsize
in Crystal fixes this issue.