mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 12:14:43 +00:00
fix: dynamic type checking bugs
This commit is contained in:
parent
a6b72ea636
commit
5affa5065f
12 changed files with 91 additions and 7 deletions
|
@ -2029,6 +2029,17 @@ impl Type {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_type(&self) -> bool {
|
||||
match self {
|
||||
Self::FreeVar(fv) if fv.is_linked() => fv.crack().is_type(),
|
||||
Self::Refinement(refine) => refine.t.is_type(),
|
||||
Self::ClassType | Self::TraitType | Self::Type => true,
|
||||
Self::Quantified(q) => q.is_type(),
|
||||
Self::Subr(subr) => subr.return_t.is_type(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_free(&self) -> Option<&FreeTyVar> {
|
||||
<&FreeTyVar>::try_from(self).ok()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue