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 immutable to mutable reference #22663

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Oct 26, 2024

Fix #22653

Fixes cases like this:

fn main() {
	a := ['foo', 'bar']
	mut b := []string{}
	b = if true { a } else { a } 	
	b[0] = 'bar'
	dump(a) // ['bar', 'bar']
}

Huly®: V_0.6-21112

@felipensp felipensp marked this pull request as ready for review October 28, 2024 19:41
@felipensp
Copy link
Member Author

What do you think @medvednikov @spytheman ?

@felipensp
Copy link
Member Author

The failing CI here is really about breakage related to more restricter compiler checks.

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.

checker: mutability of if-expression branch returns is not enforced
1 participant