From 4b07d3cde6f8febea2790fa5fe3f6fae7b38244e Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 19 Oct 2017 16:51:00 +1100 Subject: [PATCH] Tweak some code for style consistency. --- lang/check/type.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/check/type.go b/lang/check/type.go index 50f46b8a..7463a804 100644 --- a/lang/check/type.go +++ b/lang/check/type.go @@ -257,11 +257,11 @@ func (q *checker) tcheckAssign(n *a.Assign) error { switch n.Operator().Key() { case t.KeyShiftLEq, t.KeyShiftREq: - if rTyp.IsNumTypeOrIdeal() { - return nil + if !rTyp.IsNumTypeOrIdeal() { + return fmt.Errorf("check: assignment %q: shift %q, of type %q, does not have numeric type", + n.Operator().String(q.tm), rhs.String(q.tm), rTyp.String(q.tm)) } - return fmt.Errorf("check: assignment %q: shift %q, of type %q, does not have numeric type", - n.Operator().String(q.tm), rhs.String(q.tm), rTyp.String(q.tm)) + return nil case t.KeyTildePlusEq: if !lTyp.IsUnsignedInteger() { return fmt.Errorf("check: assignment %q: %q, of type %q, does not have unsigned integer type",