typing: cleanup imports and fix unit in return

This commit is contained in:
Romain Paquet 2024-12-06 18:28:37 +01:00
parent 1b91ee53d4
commit 78b20f3603

View file

@ -1,15 +1,10 @@
mod error;
use crate::ast::*;
use crate::typing::error::{TypeAndSpan, TypeError, TypeErrorKind};
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt::Display; use std::fmt::Display;
use BinaryExpression;
use ReturnStatement;
use crate::ast::ModulePath;
use crate::ast::*;
mod error;
use crate::typing::error::{TypeAndSpan, TypeError, TypeErrorKind};
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -178,7 +173,7 @@ impl TypeCheck for FunctionDefinition {
); );
} }
Ok(self.return_type.clone().unwrap()) Ok(self.return_type.clone().unwrap_or(Type::Unit))
} }
} }