From 0aacdfd6e348491ccee1b311c3a8b8859daae66a Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Wed, 19 Feb 2020 14:09:43 +1100 Subject: [PATCH] Allow r.skip32_fast!(actual: x, worst_case: x) --- lang/check/bounds.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lang/check/bounds.go b/lang/check/bounds.go index 44b71e98..2bdfa85d 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -1060,7 +1060,9 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (bounds, e } actual := args[0].AsArg().Value() worstCase := args[1].AsArg().Value() - if err := q.proveBinaryOp(t.IDXBinaryLessEq, actual, worstCase); err == errFailed { + if actual.Eq(worstCase) { + // No-op. Proving "x <= x" is trivial. + } else if err := q.proveBinaryOp(t.IDXBinaryLessEq, actual, worstCase); err == errFailed { return bounds{}, fmt.Errorf("check: could not prove skip_fast pre-condition: %s <= %s", actual.Str(q.tm), worstCase.Str(q.tm)) } else if err != nil {