mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
fix: declaration bugs
This commit is contained in:
parent
14b26a7f4d
commit
6c3536cc31
16 changed files with 275 additions and 61 deletions
|
@ -13,6 +13,7 @@ use erg_parser::ast::VarName;
|
|||
|
||||
use crate::ty::constructors::*;
|
||||
use crate::ty::free::FreeTyParam;
|
||||
use crate::ty::free::GENERIC_LEVEL;
|
||||
use crate::ty::free::{Constraint, HasLevel};
|
||||
use crate::ty::typaram::{TyParam, TyParamLambda};
|
||||
use crate::ty::ValueObj;
|
||||
|
@ -44,7 +45,7 @@ impl fmt::Display for TyVarCache {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"TyVarInstContext {{ tyvar_instances: {}, typaram_instances: {} }}",
|
||||
"TyVarContext {{ tyvar_instances: {}, typaram_instances: {} }}",
|
||||
self.tyvar_instances, self.typaram_instances,
|
||||
)
|
||||
}
|
||||
|
@ -192,6 +193,10 @@ impl TyVarCache {
|
|||
}
|
||||
|
||||
fn update_typaram(&self, inst: &TyParam, tp: &TyParam, ctx: &Context) {
|
||||
if inst.level() == Some(GENERIC_LEVEL) {
|
||||
log!(err "{inst} is fixed");
|
||||
return;
|
||||
}
|
||||
let Ok(free_inst) = <&FreeTyParam>::try_from(inst) else {
|
||||
if let (Ok(inst), Ok(t)) = (<&Type>::try_from(inst), <&Type>::try_from(tp)) {
|
||||
return self.update_tyvar(inst, t, ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue