ran into another type inference problem
This commit is contained in:
20
src/eval.rs
20
src/eval.rs
@@ -39,6 +39,7 @@ mod primtype;
|
||||
mod value;
|
||||
|
||||
use cranelift_module::ModuleError;
|
||||
use internment::ArcIntern;
|
||||
pub use primop::PrimOpError;
|
||||
pub use primtype::PrimitiveType;
|
||||
pub use value::Value;
|
||||
@@ -76,6 +77,15 @@ pub enum EvalError<IR> {
|
||||
UnknownPrimType(#[from] UnknownPrimType),
|
||||
#[error("Variable lookup failed for {1} at {0:?}")]
|
||||
LookupFailed(crate::syntax::Location, String),
|
||||
#[error("Attempted to call something that wasn't a function at {0:?} (it was a {1})")]
|
||||
NotAFunction(crate::syntax::Location, Value<IR>),
|
||||
#[error("Wrong argument call for function ({1:?}) at {0:?}; expected {2}, saw {3}")]
|
||||
WrongArgCount(
|
||||
crate::syntax::Location,
|
||||
Option<ArcIntern<String>>,
|
||||
usize,
|
||||
usize,
|
||||
),
|
||||
}
|
||||
|
||||
impl<IR1: Clone, IR2: Clone> PartialEq<EvalError<IR1>> for EvalError<IR2> {
|
||||
@@ -129,6 +139,16 @@ impl<IR1: Clone, IR2: Clone> PartialEq<EvalError<IR1>> for EvalError<IR2> {
|
||||
EvalError::UnknownPrimType(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
EvalError::NotAFunction(a, b) => match other {
|
||||
EvalError::NotAFunction(x, y) => a == x && b == y,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
EvalError::WrongArgCount(a, b, c, d) => match other {
|
||||
EvalError::WrongArgCount(w, x, y, z) => a == w && b == x && c == y && d == z,
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user