[fine] OK

This commit is contained in:
John Doty 2024-01-13 15:07:38 -08:00
parent 50eb7a9673
commit 65fef78c44
10 changed files with 81 additions and 25 deletions

View file

@ -929,6 +929,18 @@ impl<'a> Semantics<'a> {
Some(*ret.clone())
}
Type::MagicPrintGarbage => {
if arg_types.len() > 1 {
self.report_error_tree(tree, "print takes a single argument");
Some(Type::Error)
} else if arg_types.len() == 0 {
Some(Type::Nothing)
} else {
let mut arg_types = arg_types;
let (_, t) = arg_types.pop().unwrap();
Some(t)
}
}
_ => {
self.report_error_tree_ref(f_ref, format!("expected a function type, got: {f}"));
Some(Type::Error)