Skip to content

cgen: fix match with mut cond variable (fix #22201) - #22207

Merged
spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_match_mut_var
Sep 13, 2024
Merged

spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_match_mut_var

Conversation

@yuyi98

@yuyi98 yuyi98 commented Sep 13, 2024

Copy link
Copy Markdown
Member

This PR fix match with mut cond variable (fix #22201).

  • Fix match with mut cond variable.
  • Add test.
fn main() {
	mut aaa := ['/', 'a', 'b']
	for mut ccc in aaa {
		match ccc {
			'/' { println(ccc) }
			else { println(ccc) }
		}
	}
}

PS D:\Test\v\tt1> v run .    
/
a
b

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

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 4572c64 into vlang:master Sep 13, 2024
@yuyi98
yuyi98 deleted the fix_match_mut_var branch September 13, 2024 06:49
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.

cgen error for for mut ccc in aaa { match ccc { where aaa is []string{}

2 participants