提交 ac3d716b 编写于 作者: 3 3dgen

强制检查:值类型不能赋值给非空接口

上级 7a4d1e6b
......@@ -266,6 +266,12 @@ func (check *Checker) missingMethod(V Type, T *Interface, static bool) (method *
return
}
if len(T.allMethods) != 0 {
if _, ok := V.(*Pointer); !ok {
return T.allMethods[0], false
}
}
// TODO(gri) Consider using method sets here. Might be more efficient.
if ityp, _ := V.Underlying().(*Interface); ityp != nil {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册