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
// 2. src and dst have identical underlying types
// and either src or dst is not a named type or
// both are empty interface types.
// For assignable but different non-empty interface types,
// we want to recompute the itab.
if eqtype(src.Orig, dst.Orig) && (src.Sym == nil || dst.Sym == nil || src.IsEmptyInterface()) {
return OCONVNOP
}
In the case where src and dst are interfaces of the same definition, but one is named and one is not, this code falls into OCONVNOP when it should (as the comment suggests) not do that and recompute the itab instead.
It makes this program print false instead of true:
package main
type I interface {
M()
}
type T struct{}
func (*T) M() {}
func main() {
t := new(T)
var i1, i2 I
var j interface {
M()
}
i1 = t
j = t
i2 = j
println(i1 == i2)
}
I think the if condition needs a && (!dst.IsInterface() || dst.IsEmptyInterface()) but I'd have to think harder about whether that's the only problem.
Leaving for Keith.
The text was updated successfully, but these errors were encountered:
Keith noticed that this is wrong in the compiler:
In the case where src and dst are interfaces of the same definition, but one is named and one is not, this code falls into OCONVNOP when it should (as the comment suggests) not do that and recompute the itab instead.
It makes this program print false instead of true:
I think the if condition needs a
&& (!dst.IsInterface() || dst.IsEmptyInterface())
but I'd have to think harder about whether that's the only problem.Leaving for Keith.
The text was updated successfully, but these errors were encountered: