From 0dff177e8f22acc4d4a132c3e4b36a1f15ecbabb Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 10 Feb 2019 05:33:55 -0800 Subject: [PATCH] Add more literals kill errors --- schala-lang/language/src/typechecking.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 39cbe5d..7a71f3e 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -7,7 +7,7 @@ pub type TypeName = Rc; pub struct TypeContext<'a> { variable_map: ScopeStack<'a, Rc, ()>, - evar_count: u32 + //evar_count: u32 } /// `InferResult` is the monad in which type inference takes place. @@ -41,10 +41,6 @@ pub enum TypeConst { } impl Type { - fn arrow(a: Type, b: Type) -> Type { - Type::Arrow(Box::new(a), Box::new(b)) - } - fn to_string(&self) -> String { use self::Type::*; use self::TypeConst::*; @@ -150,7 +146,7 @@ impl<'a> TypeContext<'a> { pub fn new() -> TypeContext<'a> { TypeContext { variable_map: ScopeStack::new(None), - evar_count: 0 + //evar_count: 0 } } @@ -188,6 +184,8 @@ impl<'a> TypeContext<'a> { Ok(match expr { NatLiteral(_) => Type::Const(TypeConst::Nat), BoolLiteral(_) => Type::Const(TypeConst::Bool), + FloatLiteral(_) => Type::Const(TypeConst::Float), + StringLiteral(_) => Type::Const(TypeConst::StringT), _ => Type::Const(TypeConst::Unit) }) }