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: detect redundant ref when assigning call expr with ref return #21141

Merged
merged 2 commits into from
Mar 30, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Mar 29, 2024

Fixes:

@[heap]
struct Foo {}

fn foo() &Foo {
	return &Foo{}
}

_ := &foo()

throwing:

error: lvalue expected
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

Copy link
Member

@spytheman spytheman left a comment

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 66e6140 into vlang:master Mar 30, 2024
54 checks passed
@ttytm ttytm deleted the checker/assign-call-expr-ptr-to-ptr branch March 30, 2024 14:28
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.

None yet

2 participants