Fix type check macro to add symbol table

This commit is contained in:
greg 2017-10-11 16:43:04 -07:00
parent 0ea9bd3d95
commit 5f1c46cb87

View File

@ -401,6 +401,7 @@ mod tests {
{ {
let mut tc = TypeContext::new(); let mut tc = TypeContext::new();
let ast = parse(tokenize($input)).0.unwrap() ; let ast = parse(tokenize($input)).0.unwrap() ;
tc.add_symbols(&ast);
assert_eq!($correct, tc.type_check(&ast).unwrap()) assert_eq!($correct, tc.type_check(&ast).unwrap())
} }
} }
@ -409,6 +410,6 @@ mod tests {
#[test] #[test]
fn basic_inference() { fn basic_inference() {
type_test!("30", TConst(Integer)); type_test!("30", TConst(Integer));
type_test!("1 + 2", TConst(Integer)); type_test!("fn x(a: Int): Bool {}; x(1)", TConst(Boolean));
} }
} }