commit | df9ec5bfb6fa89ff12c93be7d1c56395402a2a80 | [log] [tgz] |
---|---|---|
author | Nigel Tao <nigeltao@golang.org> | Thu Feb 18 13:38:27 2021 +1100 |
committer | Nigel Tao <nigeltao@golang.org> | Thu Feb 18 13:38:27 2021 +1100 |
tree | a777dd30098c8cf0245406a71ba0f286f0091afe | |
parent | 26c7fb941f85910c8cbdab780f16331e8ccb5b86 [diff] |
Check foo is choosy in "choose foo = etc"
diff --git a/lang/check/type.go b/lang/check/type.go index ff596f6..5643326 100644 --- a/lang/check/type.go +++ b/lang/check/type.go
@@ -1145,6 +1145,8 @@ 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()