diff --git a/lang/check/bounds.go b/lang/check/bounds.go index e28f87cb..6369c12d 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -56,7 +56,11 @@ func (q *checker) bcheckStatement(n *a.Node) error { n := n.Assert() condition := n.Condition() err := errFailed - if reasonID := n.Reason(); reasonID != 0 { + if cv := condition.ConstValue(); cv != nil { + if cv.Cmp(one) == 0 { + err = nil + } + } else if reasonID := n.Reason(); reasonID != 0 { if reasonFunc := q.reasonMap[reasonID.Key()]; reasonFunc != nil { err = reasonFunc(q, n) } else { diff --git a/lang/check/check_test.go b/lang/check/check_test.go index 26999b1a..1ac26500 100644 --- a/lang/check/check_test.go +++ b/lang/check/check_test.go @@ -68,6 +68,8 @@ func TestCheck(t *testing.T) { var p i32 var q i32[0:8] + assert true + while p == q, post p != q, {