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

parser: fix invalid warning 'unused' for mut var in if/match cond(fix#19539) #19843

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Nov 11, 2023

Fixed #19539

struct Foo {
	value int = 0xf00
}

struct Bar {}

type FooBar = Bar | Foo

fn main() {
	mut foobar := FooBar(Bar{})
	match mut foobar {
		Foo {
			println('foo')
		}
		else {
			println('bar')
		}
	}
}
struct Foo {
	value int = 0xf00
}

struct Bar {}

type FooBar = Bar | Foo

fn main() {
	mut foobar := FooBar(Bar{})
	if mut foobar is Foo {
		println('foo')
	} else {
		println('bar')
	}
}

Invalid warnings have been removed.

@medvednikov medvednikov merged commit 239430a into vlang:master Nov 11, 2023
54 checks passed
@shove70 shove70 deleted the unused branch November 12, 2023 00:25
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.

Invalid warning from compiler with smart casting
2 participants