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

could not infer generic type in embed generics structs #20021

Closed
shove70 opened this issue Nov 28, 2023 · 0 comments · Fixed by #20022
Closed

could not infer generic type in embed generics structs #20021

shove70 opened this issue Nov 28, 2023 · 0 comments · Fixed by #20022
Labels
Bug This tag is applied to issues which reports bugs. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.

Comments

@shove70
Copy link
Contributor

shove70 commented Nov 28, 2023

Describe the bug

struct Foo[T] {
	field T
}

struct MainStruct[T] {
	Foo[T]
}

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

Reproduction Steps

a.v:10:7: error: could not infer generic type `T` in generic struct `Foo[T]`
    8 | 
    9 | fn main() {
   10 |     m := MainStruct[int]{}
      |          ~~~~~~~~~~~~~~~~~
   11 |     println(m.field)
   12 | }

Expected Behavior

pass

Current Behavior

error

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.3 50f3ac4

Environment details (OS name and version, etc.)

all

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@shove70 shove70 added the Bug This tag is applied to issues which reports bugs. label Nov 28, 2023
@felipensp felipensp added the Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. label Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants