Propagate tighter bounds checks after assignments

This commit is contained in:
Nigel Tao committed 2018-12-26 16:52:55 +11:00
1 parent 231389ee26
commit 7405307173
4 files changed
+72 -36

No files matched your search

+1 -4
View File
@@ -103,13 +103,10 @@ func (q *checker) optimizeIOMethodAdvance(receiver *a.Expr, advance *big.Int, up
// Create a new a.Expr to hold the adjusted RHS constant value, newRCV.
newRCV := big.NewInt(0).Sub(rcv, advance)
id, err := q.tm.Insert(newRCV.String())
o, err := makeConstValueExpr(q.tm, newRCV)
if err != nil {
return nil, err
}
o := a.NewExpr(0, 0, 0, id, nil, nil, nil, nil)
o.SetConstValue(newRCV)
o.SetMType(typeExprIdeal)
return a.NewExpr(x.AsNode().AsRaw().Flags(),
t.IDXBinaryGreaterEq, 0, 0, x.LHS(), nil, o.AsNode(), nil), nil