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

ast: duplicated code gen for embedded generic fields #20054

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Dec 1, 2023

This PR fixed: duplicated code gen for embedded generic fields

struct Foo[T] {
	field T
}

struct MainStruct[T] {
	Foo[T]
}

fn main() {
	m := MainStruct[int]{}
	println(m.field)
}

code gen:

image

now:

VV_LOCAL_SYMBOL void main__main(void) {
	main__MainStruct_T_int m = ((main__MainStruct_T_int){.Foo = ((main__Foo_T_int){.field = 0,}),});
	println(int_str(m.Foo.field));
}

@shove70 shove70 marked this pull request as draft December 1, 2023 10:47
@shove70 shove70 closed this Dec 1, 2023
@shove70 shove70 changed the title ast, parser: fixed residual old syntax <, > in generic type names ast: duplicated code gen for embedded generic fields Dec 1, 2023
@shove70 shove70 reopened this Dec 1, 2023
@shove70 shove70 marked this pull request as ready for review December 1, 2023 16:13
@spytheman spytheman merged commit a017b53 into vlang:master Dec 1, 2023
54 checks passed
@shove70 shove70 deleted the generics-2 branch December 1, 2023 21:02
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