hook up TypeError

This commit is contained in:
Folkert 2020-04-01 16:28:10 +02:00
parent 6531845966
commit 14ad793bd7
18 changed files with 216 additions and 63 deletions

View file

@ -37,6 +37,13 @@ impl<T> PExpected<T> {
PExpected::ForReason(_, val, _) => val,
}
}
pub fn replace<U>(self, new: U) -> PExpected<U> {
match self {
PExpected::NoExpectation(_val) => PExpected::NoExpectation(new),
PExpected::ForReason(reason, _val, region) => PExpected::ForReason(reason, new, region),
}
}
}
impl<T> Expected<T> {
@ -63,4 +70,14 @@ impl<T> Expected<T> {
Expected::FromAnnotation(_, _, _, val) => val,
}
}
pub fn replace<U>(self, new: U) -> Expected<U> {
match self {
Expected::NoExpectation(_val) => Expected::NoExpectation(new),
Expected::ForReason(reason, _val, region) => Expected::ForReason(reason, new, region),
Expected::FromAnnotation(pattern, size, source, _val) => {
Expected::FromAnnotation(pattern, size, source, new)
}
}
}
}