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

type_resolver: fix generic selector field type resolving #23473

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

felipensp
Copy link
Member

struct Foo[T] {
	len T
}

fn t[T](val T) string {
	a := val.len + val.len
	println(a)
	return a.str()
}

fn test_main() {
	assert t(Foo[string]{ len: 'hello' }) == 'hellohello'
	assert t(Foo[int]{ len: 123 }) == '246'
	assert t([1, 2, 3]) == '6'
	assert t([1.2, 2.2, 3.3]) == '6'
	assert t(['', '', '']) == '6'
}

Copy link

Connected to Huly®: V_0.6-21903

@spytheman spytheman marked this pull request as ready for review January 15, 2025 07:01
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 f83ea1b into vlang:master Jan 15, 2025
72 checks passed
@felipensp felipensp deleted the fix_generic_selector_len branch January 15, 2025 10:44
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