Type inference with generic structs and generic interfaces #19618
Labels
Bug
This tag is applied to issues which reports bugs.
Generics[T]
Bugs/feature requests, that are related to the V generics.
Unit: Checker
Bugs/feature requests, that are related to the type checker.
Describe the bug
Type inference does not bind generic structs as expected.
(Unless my expectation is wrong)
Reproduction Steps
Expected Behavior
In call to
fn check
,T
should be bound asOpt[int]
andMyStruct[int]
should be accepted as implementation ofMyInterface[Opt[int]]
.Current Behavior
Looks like the compiler can only infer
struct X[T]
as implementation ofinterface Y[S]
ifS
can be bound toT
(as a type variable)Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.2 20a1af3
Environment details (OS name and version, etc.)
Android, Termux
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.
The text was updated successfully, but these errors were encountered: