You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See also issue #8561.
http://play.golang.org/p/VYrNcjJ_Qo
compiles w/o a problem but leads to a guaranteed run-time failure: The method m in T1
and T2 have conflicting signatures and thus x (static type T1) cannot possibly be of
type T2.
The spec does not require that the signatures be conflict-free (
http://tip.golang.org/ref/spec#Type_assertions ):
"If T is an interface type, x.(T) asserts that the dynamic type of x implements the
interface T."
Interestingly, when it comes to interface assignments ("implements" relation),
conflicting method signatures are not permitted:
http://play.golang.org/p/QAZWsPqejr
prog.go:13: cannot use x2 (type T2) as type T1 in assignment:
T2 does not implement T1 (wrong type for m method)
have m(string)
want m(int)
prog.go:14: cannot use x1 (type T1) as type T2 in assignment:
T1 does not implement T2 (wrong type for m method)
have m(int)
want m(string)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: