From 971e17372100283c4c75acaf46cf5f1aa8b74d70 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sat, 7 Jul 2018 16:42:30 +1000 Subject: [PATCH] Remove redundant const-value bounds check --- lang/check/bounds.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lang/check/bounds.go b/lang/check/bounds.go index 4364bb9e..f77f2d75 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -469,12 +469,6 @@ func (q *checker) bcheckAssignment2(lhs *a.Expr, lTyp *a.TypeExpr, op t.ID, rhs rb := a.Bounds{} if op == t.IDEq { - if cv := rhs.ConstValue(); cv != nil { - if (lb[0] != nil && cv.Cmp(lb[0]) < 0) || (lb[1] != nil && cv.Cmp(lb[1]) > 0) { - return fmt.Errorf("check: constant %v is not within bounds %v", cv, lb) - } - return nil - } rb, err = q.bcheckExpr(rhs, 0) } else { rb, err = q.bcheckExprBinaryOp(op.BinaryForm(), lhs, rhs, 0)