mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix: subtyping bug
This commit is contained in:
parent
57e5a50e1b
commit
0840d9bf60
11 changed files with 120 additions and 81 deletions
|
@ -209,9 +209,13 @@ impl TyVarCache {
|
|||
|
||||
pub(crate) fn get_tyvar(&self, name: &str) -> Option<&Type> {
|
||||
self.tyvar_instances.get(name).or_else(|| {
|
||||
self.typaram_instances
|
||||
.get(name)
|
||||
.map(|tp| <&Type>::try_from(tp).unwrap())
|
||||
self.typaram_instances.get(name).and_then(|tp| {
|
||||
<&Type>::try_from(tp)
|
||||
.map_err(|_| {
|
||||
log!(err "cannot convert {tp} into a type");
|
||||
})
|
||||
.ok()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue