https://tip.golang.org/ref/spec#Method_sets says the following:
The method set of an interface type is the intersection of the method sets of each type in the interface's type set (the resulting method set is usually just the set of declared methods in the interface).
AFAIU, per
- The type set of a non-empty interface is the intersection of the type sets of its interface elements.
- The type set of a non-interface type term is the set consisting of just that type.
the type set of interface { S } for concrete type S is {S}. The intersection of the method sets is thus the method set of S. But that doesn't seem quite right. func foo[T S](x T) { x.Foo() } certainly doesn't compile. Was the intention to have an implicit, empty method set for the absent list of methods in the interface?
/cc @griesemer @findleyr
https://tip.golang.org/ref/spec#Method_sets says the following:
AFAIU, per
the type set of
interface { S }for concrete type S is {S}. The intersection of the method sets is thus the method set of S. But that doesn't seem quite right.func foo[T S](x T) { x.Foo() }certainly doesn't compile. Was the intention to have an implicit, empty method set for the absent list of methods in the interface?/cc @griesemer @findleyr