Start handling function case
This commit is contained in:
parent
887ba46b0b
commit
d040d76bfa
@ -242,12 +242,20 @@ impl<'a> Infer<'a> {
|
||||
|
||||
fn infer_declaration(&mut self, decl: &parsing::Declaration) -> InferResult<MonoType> {
|
||||
use parsing::Declaration::*;
|
||||
use parsing::Signature;
|
||||
match decl {
|
||||
Binding { name, expr, .. } => {
|
||||
let tau: MonoType = self.infer_expression(&expr)?;
|
||||
let sigma = self.generalize(tau);
|
||||
self.env.extend(name, sigma);
|
||||
},
|
||||
FuncDecl(Signature { name, params, type_anno }, block) => {
|
||||
//TODO fill in here
|
||||
|
||||
|
||||
|
||||
return Err(InferError::Custom(format!("This decl not yet supported")))
|
||||
},
|
||||
_ => return Err(InferError::Custom(format!("This decl not yet supported")))
|
||||
}
|
||||
Ok(MonoType::Const(TypeConst::Unit))
|
||||
|
Loading…
Reference in New Issue
Block a user