Skip to content

checker: fix stack var outside usage when var is a mutable param #24249

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

Merged
merged 3 commits into from
Apr 20, 2025

Conversation

felipensp
Copy link
Member

Fix #24179

Copy link

Connected to Huly®: V_0.6-22630

is_mut_param := c.table.cur_fn != unsafe { nil }
&& c.table.cur_fn.params.filter(it.name == ident.name && it.is_mut).len > 0
if is_mut_param {
return
Copy link
Member

@medvednikov medvednikov Apr 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment // fix stack var outside usage when var is a mutable param for such blocks to make it clear what they are for in the future. I'll do it.

@medvednikov medvednikov merged commit 324edc6 into vlang:master Apr 20, 2025
74 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.

assigning to heap optional give v error: o cannot be assigned outside unsafe blocks as it might refer to an object stored on stack
2 participants