apply_substitution for PolyTypes

If I made an error it's likely here...
This commit is contained in:
greg 2018-05-17 01:06:52 -07:00
parent a26da934f4
commit 48e795decc

View File

@ -102,7 +102,15 @@ impl PolyType {
} }
fn apply_substitution(&self, s: &Substitution) -> PolyType { fn apply_substitution(&self, s: &Substitution) -> PolyType {
unimplemented!() let mut map: HashMap<Rc<String>, MonoType> = HashMap::new();
for (name, monotype) in s.0.iter() {
if let None = self.0.get(name) {
map.insert(name.clone(), monotype.clone());
}
}
let newsub = Substitution(map);
let new = self.1.apply_substitution(&newsub);
PolyType(self.0.clone(), new)
} }
} }