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 MatchExpr type inferring when none is used #23833

Merged
merged 4 commits into from
Mar 1, 2025

Conversation

felipensp
Copy link
Member

Fix #23831

Copy link

Connected to Huly®: V_0.6-22238

@felipensp felipensp changed the title cgen: fix MatchExpr type inferring when none is used checker: fix MatchExpr type inferring when none is used Feb 28, 2025
@felipensp
Copy link
Member Author

Make sure it fails with a similar message to the recent if change, if someone does this:

b := match 2 {
	0 { none }
	2 { none }
	else { none }
}

In other words, just like if, match has to have at least one value that is something other than none.

Oh yes, I've updated the PR to includes match as well.

@JalonSolov
Copy link
Contributor

Yep, I saw the other PR after adding that comment - that's why I deleted it. :-)

@felipensp felipensp marked this pull request as ready for review March 1, 2025 14:02
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 95f0093 into vlang:master Mar 1, 2025
72 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.

Optional inference in match expression
3 participants