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 call_expr in branches and left_expr of call_expr with or_block(fix #20044) #20094

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Dec 5, 2023

  1. Fixed Builder error when calling method on or block result in if expression #20044
  2. Add tests.
fn baz(str string) !string {
	return str
}

foo := '/bar'
bar := if foo.contains('foo') {
	foo.all_after('foo')
} else {
	baz(foo) or { panic('panic') }.trim_left('/')
}

assert bar == 'bar'
println(bar)

outputs:

bar

@spytheman spytheman merged commit 700fbd7 into vlang:master Dec 5, 2023
53 of 54 checks passed
@shove70 shove70 deleted the patch-1 branch December 5, 2023 05:53
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.

Builder error when calling method on or block result in if expression
2 participants