fix[lang]: fix encoding of string literals#3091
Merged
charles-cooper merged 14 commits intovyperlang:masterfrom Jan 12, 2025
Merged
fix[lang]: fix encoding of string literals#3091charles-cooper merged 14 commits intovyperlang:masterfrom
charles-cooper merged 14 commits intovyperlang:masterfrom
Conversation
since 4a5866c, string literals have been encoded incorrectly (now enshrined in the string_to_bytes function). this commit changes the interpretation of string literals to just use the utf-8 encoding, which matches other interpretations of string literals in constant folding.
reasoning: - hex literals can no longer be interpreted as Bytes - strings can have multi-character utf-8 encoding, which would result in a discrepancy between runtime and compile-time len() (since we do not do any utf-8 decoding at runtime).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3091 +/- ##
=======================================
Coverage 91.99% 92.00%
=======================================
Files 119 119
Lines 16673 16662 -11
Branches 2803 2801 -2
=======================================
- Hits 15339 15330 -9
+ Misses 916 915 -1
+ Partials 418 417 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
|
from what i understand the issue originated in how we encoded strings - different code sections used different encodings. can we add an utility for encoding that would called whenever we need to encode something? eg in which relies on the default encoding - would be better to be explicit and specify the encoding and use the same function everywhere |
cyberthirst
approved these changes
Jan 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
fix #3088, fix #2799
How I did it
How to verify it
Commit message
Description for the changelog
Cute Animal Picture