-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAge
Description
I can't find any wording in the spec that would explain the legality or otherwise of this program. The question is whether isomorphic recursive interfaces are identical and thus mutually assignable. My intuition about interfaces would suggest that these types ought to be identical. http://play.golang.org/p/r92J5TY-WI package main type I interface { f() I } type J interface { f() J } func main() { var i I var j J i = j j = i } gc and go/types both give an error. gc: prog.go:13: cannot use j (type J) as type I in assignment: J does not implement I (wrong type for f method) have f() J want f() I prog.go:14: cannot use i (type I) as type J in assignment: I does not implement J (wrong type for f method) have f() I want f() J go/types: a.go:13:6: cannot assign j (variable of type J) to i (variable of type I)
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAge