initial solver for the editor's type constraints

This commit is contained in:
Folkert 2021-04-12 21:26:20 +02:00
parent f16d1619ea
commit bffb9ab6fe
7 changed files with 1625 additions and 4 deletions

View file

@ -89,4 +89,16 @@ impl<T> Expected<T> {
}
}
}
pub fn replace_ref<U>(&self, new: U) -> Expected<U> {
match self {
Expected::NoExpectation(_val) => Expected::NoExpectation(new),
Expected::ForReason(reason, _val, region) => {
Expected::ForReason(reason.clone(), new, *region)
}
Expected::FromAnnotation(pattern, size, source, _val) => {
Expected::FromAnnotation(pattern.clone(), *size, *source, new)
}
}
}
}