morphism instance: fix apply subst

This commit is contained in:
Michael Sippel 2025-04-03 15:39:25 +02:00
parent 6731f7fdea
commit 8c170baad3
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -330,10 +330,21 @@ impl<M: SugaredMorphism + Clone> MorphismInstance2<M> {
}
pub fn apply_subst(&mut self, γ: &std::collections::HashMap< TypeID, SugaredTypeTerm >) {
let ty = self.get_type();
match self {
MorphismInstance2::Primitive { ψ, σ, morph } => {
ψ.apply_subst(σ);
*σ = σ.clone().append(γ);
ψ.apply_subst(γ);
for (n,t) in σ.iter_mut() {
t.apply_subst(γ);
}
for (n,t) in γ.iter() {
if let TypeID::Var(varid) = n {
if morph.get_type().src_type.apply_subst(σ).contains_var(*varid)
|| morph.get_type().dst_type.apply_subst(σ).contains_var(*varid) {
σ.insert(n.clone(), t.clone());
}
}
}
},
MorphismInstance2::Chain { path } => {
for n in path.iter_mut() {