go/types: unable to implement method of an interface with a generic return value #50828
Labels
FrozenDueToAge
generics
Issue is related to generics
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?devel go1.18-6eb58cdffa Tue Jan 25 22:56:45 2022 +0000
Does this issue reproduce with the latest release?
Yes latest 1.18 beta release
What operating system and processor architecture are you using (
go env
)?I am using go.dev/play
What did you do?
Go Playground
TL;DR I am trying to implement a method from an interface that has a generic to define it return type
I was trying to create a SumOf function that allowed for the selecting of a property for summing. I had a Product struct with a Cost property, I also have a SumCostProduct struct, that extends Product, that implements a Selectable interface that uses a Number constraint. This should allow for the implementation of the Selected function from the Selectable interface for SumCostProduct.
What did you expect to see?
I expected to compile and run the program with the return
13
What did you see instead?
The text was updated successfully, but these errors were encountered: