diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index bbf134f..cf4523e 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -30,7 +30,7 @@ pub type TypeName = Rc; pub struct TypeContext<'a> { variable_map: ScopeStack<'a, Rc, Type>, unification_table: InPlaceUnificationTable, - //evar_count: u32 + type_var_count: usize, } /// `InferResult` is the monad in which type inference takes place. @@ -207,7 +207,7 @@ impl<'a> TypeContext<'a> { TypeContext { variable_map: ScopeStack::new(None), unification_table: UnificationTable::new(), - //evar_count: 0 + type_var_count: 0, } } @@ -372,6 +372,12 @@ impl<'a> TypeContext<'a> { (a, b) => TypeError::new(format!("{:?} and {:?} do not unify", a, b)), } } + + fn fresh_type_variable(&mut self) -> TypeVar { + let n = self.type_var_count; + self.type_var_count += 1; + TypeVar(n) + } } #[cfg(test)]