fix(kernel/expr): make sure we cannot create a free variable with index uint_max, reason: get_free_var_range would return an incorrect value

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-04-17 13:25:21 -07:00
parent 3712da0b54
commit cb479a75ae

View file

@ -79,7 +79,10 @@ void expr_cell::set_is_arrow(bool flag) {
// Expr variables
expr_var::expr_var(unsigned idx):
expr_cell(expr_kind::Var, idx, false, false, false),
m_vidx(idx) {}
m_vidx(idx) {
if (idx == std::numeric_limits<unsigned>::max())
throw exception("invalid free variable index, de Bruijn index is too big");
}
// Expr constants
expr_const::expr_const(name const & n, levels const & ls):