From cea74278478581449056b4428f1cb67dd3940ae0 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 20 May 2018 18:44:31 -0700 Subject: [PATCH] put TypeEnvironment on TypeContext --- schala-lang/src/typechecking.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/schala-lang/src/typechecking.rs b/schala-lang/src/typechecking.rs index 14e8824..de012a9 100644 --- a/schala-lang/src/typechecking.rs +++ b/schala-lang/src/typechecking.rs @@ -15,7 +15,7 @@ use itertools::Itertools; use parsing; pub struct TypeContext { - bindings: HashMap, Type>, + environment: TypeEnvironment, pub symbol_table: SymbolTable } @@ -214,7 +214,7 @@ pub type TypeResult = Result; impl TypeContext { pub fn new() -> TypeContext { - TypeContext { bindings: HashMap::new(), /*type_var_count: 0*/ symbol_table: SymbolTable::new() } + TypeContext { environment: TypeEnvironment::default(), /*type_var_count: 0*/ symbol_table: SymbolTable::new() } } /* note: this adds names for *forward reference* but doesn't actually create any types. solve that problem @@ -255,8 +255,8 @@ impl TypeContext { for (sym, ty) in &self.symbol_table.values { write!(output, "{} -> {:?}\n", sym, ty).unwrap(); } - write!(output, "\nBindings\n").unwrap(); - for (sym, ty) in &self.bindings { + write!(output, "\nType Env\n").unwrap(); + for (sym, ty) in &self.environment.map { write!(output, "{} : {:?}\n", sym, ty).unwrap(); } output