mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-03 05:54:33 +00:00
Refactor
This commit is contained in:
parent
25094efd17
commit
fb0d2f5737
7 changed files with 23 additions and 25 deletions
|
@ -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())))
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue