Allow built-in args' types to be refined

This commit is contained in:
Nigel Tao committed 2018-05-11 14:49:15 +10:00
1 parent a69948b23d
commit 7a9554194c
5 files changed
+29 -47

No files matched your search

+6
View File
@@ -486,6 +486,12 @@ func (c *Checker) checkFuncSignature(node *a.Node) error {
// implicit "return out"?
qqid := n.QQID()
if qqid[0] == t.IDBase {
// No need to populate c.funcs and c.localVars for built-in funcs. In
// any case, the remaining type checking code in this function doesn't
// handle the base.◊ diamond type.
return nil
}
if other, ok := c.funcs[qqid]; ok {
return &Error{
Err: fmt.Errorf("check: duplicate function %s", qqid.Str(c.tm)),