Add more literals kill errors

This commit is contained in:
greg 2019-02-10 05:33:55 -08:00
parent cf91f74912
commit 0dff177e8f

View File

@ -7,7 +7,7 @@ pub type TypeName = Rc<String>;
pub struct TypeContext<'a> {
variable_map: ScopeStack<'a, Rc<String>, ()>,
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)
})
}