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

checker: fix match expr with empty array init expression (fix #22828) #22832

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Nov 11, 2024

This PR fix match expr with empty array init expression (fix #22828).

  • Fix match expr with empty array init expression.
  • Add test.
fn main() {
	arr1 := ['Peter', 'Bob']
	arr2 := ['Sam', 'Mike']
	typ := 1
	names := match typ {
		1 {
			arr1
		}
		2 {
			arr2
		}
		else {
			[]
		}
	}
	println(names)
	assert names == ['Peter', 'Bob']
}

PS D:\Test\v\tt1> v run .
['Peter', 'Bob']

Huly®: V_0.6-21277

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.

@medvednikov medvednikov merged commit 5092626 into vlang:master Nov 11, 2024
70 of 71 checks passed
@yuyi98 yuyi98 deleted the fix_match_expr branch November 12, 2024 04:03
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.

V doesn't figure out array type in match, but it should
3 participants