Skip to content

cgen: fix option unwrapping on heap var#23489

Merged
spytheman merged 3 commits intovlang:masterfrom
felipensp:fix_option_heap_var
Jan 16, 2025
Merged

cgen: fix option unwrapping on heap var#23489
spytheman merged 3 commits intovlang:masterfrom
felipensp:fix_option_heap_var

Conversation

@felipensp
Copy link
Copy Markdown
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
	}
}

@huly-for-github
Copy link
Copy Markdown

Connected to Huly®: V_0.6-21918

@felipensp felipensp marked this pull request as ready for review January 16, 2025 17:19
Copy link
Copy Markdown
Contributor

@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
@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