Check foo is choosy in "choose foo = etc"

This commit is contained in:
Nigel Tao committed 2021-02-18 13:38:27 +11:00
1 parent 26c7fb941f
commit df9ec5bfb6
1 file changed
+2
+2
View File
@@ -1145,6 +1145,8 @@ func (q *checker) tcheckChoose(n *a.Choose) error {
f := q.c.funcs[fQQID]
if f == nil {
return fmt.Errorf("check: no function named %q", fQQID.Str(q.tm))
} else if !f.Choosy() {
return fmt.Errorf("check: choose assignee %q is not choosy", fQQID[2].Str(q.tm))
}
for _, o := range n.Args() {
o := o.AsExpr()