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: don't cast match branch structs to IError when in sumtype #22444

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

edam
Copy link
Member

@edam edam commented Oct 7, 2024

Fixes #22435.

When checking match branch expression branch expression type, there was a check to cast yielded value to an IError when match return type is a Result and branch expression type is struct.

I added an additional test so that the cast (and check to ensure the struct conforms to the IError interface) does not occur when the return type is a sumtype and the struct is one of the sumtype types.

Tests updated to cover this

Huly®: V_0.6-20905

@medvednikov medvednikov closed this Oct 7, 2024
@medvednikov medvednikov reopened this Oct 7, 2024
@spytheman spytheman merged commit 9d164d0 into vlang:master Oct 8, 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.

match expressions expecting Result(SumType) error on yielding SumType's struct values
3 participants