type checking !?!?

This commit is contained in:
2025-03-22 14:40:32 -04:00
parent 606cb30c6b
commit 7f809d797c
44 changed files with 664 additions and 314 deletions
+19
View File
@@ -0,0 +1,19 @@
use crate::common::{CompilerMsg, CompilerOutput, FileSpan};
use super::{IRUProgram, Type};
impl CompilerOutput {
pub fn check_assign(&mut self, p: &IRUProgram, src: &Type, dest: &Type, span: FileSpan) {
// TODO: spans
if src != dest {
self.err(CompilerMsg {
msg: format!(
"Cannot assign type '{}' to '{}'",
p.type_name(src),
p.type_name(dest)
),
spans: vec![span],
});
}
}
}