Start work on typechecking

This commit is contained in:
Greg Shuflin 2022-01-25 01:43:54 -08:00
parent 1daf23b129
commit d9d6f7dc16
2 changed files with 7 additions and 3 deletions

View File

@ -88,8 +88,7 @@ impl<'a> Schala<'a> {
self.timings.push(("symbol_table", sw.elapsed()));
// Typechecking
// TODO typechecking not working
//let _overall_type = self.type_context.typecheck(&ast).map_err(SchalaError::from_type_error);
let _overall_type = self.type_context.typecheck(&ast).map_err(SchalaError::from_type_error);
let sw = Stopwatch::start_new();
let reduced_ir = reduced_ir::reduce(&ast, &self.symbol_table, &self.type_context);

View File

@ -1,7 +1,7 @@
use std::{collections::HashMap, convert::From};
use crate::{
ast::TypeIdentifier,
ast::{TypeIdentifier, AST},
identifier::{define_id_kind, Id, IdStore},
};
@ -96,6 +96,11 @@ impl TypeContext {
pub fn lookup_type(&self, type_id: &TypeId) -> Option<&DefinedType> {
self.defined_types.get(type_id)
}
//TODO return some kind of overall type later?
pub fn typecheck(&mut self, ast: &AST) -> Result<(), TypeError> {
Ok(())
}
}
/// A type defined in program source code, as opposed to a builtin.