R=r
https://golang.org/cl/156104
// Same memory layouts, different method sets.
func toType(i interface{}) Type {
switch v := i.(type) {
+ case nil:
+ return nil
case *runtime.BoolType:
return (*BoolType)(unsafe.Pointer(v))
case *runtime.DotDotDotType:
// Set assigns x to v.
func (v *InterfaceValue) Set(x Value) {
- i := x.Interface();
+ var i interface{}
+ if x != nil {
+ i = x.Interface()
+ }
if !v.canSet {
panic(cannotSet)
}
*(Eface*)ret = *(Eface*)x;
return;
}
+ if(((Eface*)x)->type == nil) {
+ // can assign nil to any interface
+ ((Iface*)ret)->tab = nil;
+ ((Iface*)ret)->data = nil;
+ return;
+ }
ifaceE2I((InterfaceType*)gettype(typ), *(Eface*)x, (Iface*)ret);
}