From 688e947016bfac10e05a892ad0b8857409dec33b Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 5 Dec 2019 21:06:52 +1100 Subject: [PATCH] =?UTF-8?q?Check=20that=20=3D=3F=20types=20are=20base.stat?= =?UTF-8?q?us?= --- lang/check/type.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lang/check/type.go b/lang/check/type.go index 9697563c..d2ac5cfd 100644 --- a/lang/check/type.go +++ b/lang/check/type.go @@ -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) }