Hacker News new | ask | show | jobs
by the_gipsy 980 days ago
It's not wrong, https://go.dev/ref/spec#Assignability:

    > A value x of type V is assignable to a variable of type T ("x is assignable to T") if
    > ...
    > T is an interface type, but not a type parameter, and x implements[1] T
[1]: https://go.dev/ref/spec#Implementing_an_interface:

    > A type T implements an interface I if:
    > ...
    > T is an interface and the type set of T is a subset of the type set of I
1 comments

It’s backwards. For A to be assignable to B, A must implement B, so A’s methods must be a superset of B’s.
Ah, now I get it - sorry for adding to the confusion!