Check that =? types are base.status

This commit is contained in:
Nigel Tao committed 2019-12-05 21:06:52 +11:00
1 parent 8926a85e15
commit 688e947016
1 file changed
+3
+3
View File
@@ -268,6 +268,9 @@ func (q *checker) tcheckAssign(n *a.Assign) error {
rTyp := rhs.MType()
if op := n.Operator(); op == t.IDEq || op == t.IDEqQuestion {
if (op == t.IDEqQuestion) && !rTyp.Eq(typeExprStatus) {
return fmt.Errorf("check: =? only works with the base.status type")
}
return q.tcheckEq(0, lhs, lTyp, rhs, rTyp)
}