savi-lang / savi

A fast language for programmers who are passionate about their craft.
BSD 3-Clause "New" or "Revised" License
157 stars 12 forks source link

Fix sizing of byte string literals in the compiler. #303

Closed jemc closed 2 years ago

jemc commented 2 years ago

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.