This commit is contained in:
Shunsuke Shibayama 2022-09-05 11:11:57 +09:00
parent 25094efd17
commit fb0d2f5737
7 changed files with 23 additions and 25 deletions

View file

@ -512,19 +512,19 @@ impl<T: Clone + HasLevel> Free<T> {
})
}
pub fn type_of(&self) -> Option<Type> {
pub fn get_type(&self) -> Option<Type> {
self.borrow()
.constraint()
.and_then(|c| c.get_type().cloned())
}
pub fn crack_sup(&self) -> Option<Type> {
pub fn get_sup(&self) -> Option<Type> {
self.borrow()
.constraint()
.and_then(|c| c.get_super().cloned())
}
pub fn crack_bound_types(&self) -> Option<(Type, Type)> {
pub fn get_bound_types(&self) -> Option<(Type, Type)> {
self.borrow()
.constraint()
.and_then(|c| c.get_sub_sup().map(|(sub, sup)| (sub.clone(), sup.clone())))

View file

@ -1715,7 +1715,7 @@ impl Type {
Self::FreeVar(fv) => {
fv.unbound_name().map(|n| &n[..] == name).unwrap_or(false)
|| fv
.crack_bound_types()
.get_bound_types()
.map(|(sub, sup)| sub.contains_tvar(name) || sup.contains_tvar(name))
.unwrap_or(false)
}