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: fix generics with embed generics structs(fix #20021) #20022

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Nov 28, 2023

  1. Fixed could not infer generic type in embed generics structs #20021
  2. Add tests.
struct Foo[T] {
	field T
}

struct MainStruct[T] {
	Foo[T]
}

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

outputs:

0

@StunxFS
Copy link
Contributor

StunxFS commented Nov 28, 2023

The CI failure is unrelated, good work!

@spytheman spytheman merged commit 52f40aa into vlang:master Nov 28, 2023
54 checks passed
@shove70 shove70 deleted the generic_embed_field branch November 28, 2023 13:29
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.

could not infer generic type in embed generics structs
3 participants