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 codegen for method call on rangeexpr #22291

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Sep 23, 2024

Fix #12610

type Buffer = []byte

pub fn (mut sb Buffer) vbytes() string {
	return sb[0..sb.len].a().str()
}

pub fn (mut sb Buffer) a() Buffer {
	return sb
}

fn test_main() {
	mut b := Buffer([]byte{cap: 10})
	b << 1
	b << 2
	assert b.vbytes() == 'Buffer([1, 2])'
}

@felipensp felipensp marked this pull request as ready for review September 24, 2024 20:55
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 41e045c into vlang:master Sep 24, 2024
78 checks passed
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.

compiler bug: compiler confused by function called vbytes() calling array.vbytes()
2 participants