Broken structure now gets through syntax evaluator.

This commit is contained in:
2024-03-08 18:39:13 -07:00
parent 77c4277625
commit b0cc2fc26b
12 changed files with 389 additions and 50 deletions

View File

@@ -86,6 +86,14 @@ pub enum EvalError<IR> {
usize,
usize,
),
#[error("Value has no fields {1} (attempt to get field {2} at {0:?})")]
NoFieldForValue(crate::syntax::Location, Value<IR>, ArcIntern<String>),
#[error("Bad field {2} for structure {1:?} at {0:?}")]
BadFieldForStructure(
crate::syntax::Location,
Option<ArcIntern<String>>,
ArcIntern<String>,
),
}
impl<IR1: Clone, IR2: Clone> PartialEq<EvalError<IR1>> for EvalError<IR2> {
@@ -149,6 +157,16 @@ impl<IR1: Clone, IR2: Clone> PartialEq<EvalError<IR1>> for EvalError<IR2> {
EvalError::WrongArgCount(w, x, y, z) => a == w && b == x && c == y && d == z,
_ => false,
},
EvalError::NoFieldForValue(a, b, c) => match other {
EvalError::NoFieldForValue(x, y, z) => a == x && b == y && c == z,
_ => false,
},
EvalError::BadFieldForStructure(a, b, c) => match other {
EvalError::BadFieldForStructure(x, y, z) => a == x && b == y && c == z,
_ => false,
},
}
}
}