-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
This program prints "A B"
, which I think is wrong: https://go2goplay.golang.org/p/QJiCMNb0YS3
The type parameters draft mentions that type parameters can be embedded and their methods will be promoted, but it doesn't explain how depth of methods on the original types influences this promotion, if at all, and the test case above demonstrates it's inconsistently handled by cmd/go2go.
I think two reasonable options here are either (1) to specify that for the purposes of method promotion, methods on type parameters are always considered to have depth 0, regardless of their depth on the actual type arguments; or (2) side-step the issue by disallowing embedding type parameters if method promotion could vary depending on the type parameter's methods' depths.