Fix this thing

This commit is contained in:
greg 2018-05-21 12:21:42 -07:00
parent a80db9e4c2
commit 887ba46b0b

View File

@ -91,13 +91,17 @@ fn symbol_table(handle: &mut Schala, input: parsing::AST, comp: Option<&mut Unfi
fn typechecking(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result<parsing::AST, String> { fn typechecking(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result<parsing::AST, String> {
match handle.type_context.type_check_ast(&input) { match handle.type_context.type_check_ast(&input) {
Ok(ty) => { Ok(ty) => {
comp.map(|c| c.add_artifact(TraceArtifact::new("type_table", format!("{}", handle.type_context.debug_types())))); comp.map(|c| {
comp.map(|c| c.add_artifact(TraceArtifact::new("type_check", format!("{:?}", ty)))); c.add_artifact(TraceArtifact::new("type_table", format!("{}", handle.type_context.debug_types())));
c.add_artifact(TraceArtifact::new("type_check", format!("{:?}", ty)));
});
Ok(input) Ok(input)
}, },
Err(msg) => { Err(msg) => {
comp.map(|comp| comp.add_artifact(TraceArtifact::new("type_table", format!("{}", handle.type_context.debug_types())))); comp.map(|comp| {
comp.map(|comp| comp.add_artifact(TraceArtifact::new("type_check", format!("Type error: {:?}", msg)))); comp.add_artifact(TraceArtifact::new("type_table", format!("{}", handle.type_context.debug_types())));
comp.add_artifact(TraceArtifact::new("type_check", format!("Type error: {:?}", msg)));
});
Ok(input) Ok(input)
} }
} }