fix: compile-time eval bug

This commit is contained in:
Shunsuke Shibayama 2024-02-23 23:03:34 +09:00
parent ca88e82c9f
commit c9438f215a
5 changed files with 140 additions and 2 deletions

View file

@ -603,7 +603,7 @@ impl Context {
match acc {
Accessor::Ident(ident) => {
let obj = self.rec_get_const_obj(ident.inspect()).ok_or_else(|| {
EvalError::no_var_error(
EvalError::not_comptime_fn_error(
self.cfg.input.clone(),
line!() as usize,
ident.loc(),
@ -1170,6 +1170,20 @@ impl Context {
line!(),
))
}),
Pow => lhs.try_pow(rhs).ok_or_else(|| {
EvalErrors::from(EvalError::unreachable(
self.cfg.input.clone(),
fn_name!(),
line!(),
))
}),
Mod => lhs.try_mod(rhs).ok_or_else(|| {
EvalErrors::from(EvalError::unreachable(
self.cfg.input.clone(),
fn_name!(),
line!(),
))
}),
Gt => lhs.try_gt(rhs).ok_or_else(|| {
EvalErrors::from(EvalError::unreachable(
self.cfg.input.clone(),