Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgen: fix string interp with zero characters(fix #20199) #20200

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Dec 17, 2023

  1. Fixed Zero-byte gets skipped in interpolated strings under some specific conditions #20199
  2. Add tests.
module main

fn main() {
	test := 'test'
	println("$test\x00$test")
	println("$test\x00$test".len)
	println("$test\x00$test".bytes())
}

outputs:

testtest
9
[116, 101, 115, 116, 0, 116, 101, 115, 116]

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit 5abeb41 into vlang:master Dec 17, 2023
54 checks passed
@shove70 shove70 deleted the patch-1 branch December 17, 2023 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zero-byte gets skipped in interpolated strings under some specific conditions
3 participants