// expected: needs a type assertion // // An interface value is a dynamic container: getting the concrete value out // of it needs a type assertion, so it is never assignable to a concrete type. // ConcreteAssignTypes skipped an interface on EITHER side because a // DESTINATION interface's method set may not be resolved yet, and that skip // also covered the interface SOURCE, where Assignable's false is final. // stage4 compiled `takeBox(i)` and handed the interface payload to a Box // parameter - printing garbage (1132487840) instead of failing. // Legacy reports "cannot use i (variable of interface type I2) as Box value // in argument to takeBox: need type assertion". package main type I2 interface { Equal(x I2) (ok bool) } type Box struct { b []byte } func (k *Box) Equal(x I2) (ok bool) { return true } func takeBox(k Box) (n int32) { return len(k.b) } func main() { o := Box{b: []byte{1, 2, 3}} var i I2 = &o _ = takeBox(i) }