More type work
This commit is contained in:
parent
65c47c20fc
commit
e9b90412ce
@ -28,6 +28,7 @@ enum TConst {
|
||||
Int,
|
||||
Float,
|
||||
StringT,
|
||||
Bool,
|
||||
}
|
||||
|
||||
impl TConst {
|
||||
@ -80,12 +81,17 @@ impl TypeContext {
|
||||
|
||||
fn infer_expr_type(&mut self, expr_type: &ExpressionType) -> InferResult<MonoType> {
|
||||
use self::ExpressionType::*;
|
||||
match expr_type {
|
||||
NatLiteral(_) => Ok(MonoType::Const(TConst::Nat)),
|
||||
FloatLiteral(_) => Ok(MonoType::Const(TConst::Float)),
|
||||
StringLiteral(_) => Ok(MonoType::Const(TConst::StringT)),
|
||||
_ => Ok(MonoType::Const(TConst::user("unimplemented")))
|
||||
}
|
||||
Ok(match expr_type {
|
||||
NatLiteral(_) => MonoType::Const(TConst::Nat),
|
||||
FloatLiteral(_) => MonoType::Const(TConst::Float),
|
||||
StringLiteral(_) => MonoType::Const(TConst::StringT),
|
||||
BoolLiteral(_) => MonoType::Const(TConst::Bool),
|
||||
_ => MonoType::Const(TConst::user("unimplemented"))
|
||||
})
|
||||
}
|
||||
|
||||
fn unify(t1: MonoType, t2: MonoType) -> InferResult<MonoType> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user