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

cgen: fix option unwrapping on heap var #23489

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

felipensp
Copy link
Member

Fix

@[heap]
struct Foo {
	a int
}

struct EdgeService {
	foo Foo
}

fn t[S](s S) {
}

fn test_main() {
	mut svc := ?EdgeService(EdgeService{})
	if svc != none {
		t(svc)
		assert true
	} else {
		assert false
	}
}

Copy link

Connected to Huly®: V_0.6-21918

@felipensp felipensp marked this pull request as ready for review January 16, 2025 17:19
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 d23e70f into vlang:master Jan 16, 2025
72 checks passed
@felipensp felipensp deleted the fix_option_heap_var branch January 16, 2025 21:10
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.

2 participants