Start work on typechecking

master
Greg Shuflin 1 year ago
parent 1daf23b129
commit d9d6f7dc16
  1. 3
      schala-lang/src/schala.rs
  2. 7
      schala-lang/src/type_inference/mod.rs

@ -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);

@ -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.

Loading…
Cancel
Save