23 lines
626 B
Rust
23 lines
626 B
Rust
use crate::common::{CompilerMsg, CompilerOutput, FileSpan};
|
|
|
|
use super::{Type, UProgram};
|
|
|
|
impl CompilerOutput {
|
|
pub fn check_assign(&mut self, p: &UProgram, src: &Type, dest: &Type, span: FileSpan) {
|
|
// TODO: spans
|
|
if src != dest {
|
|
if !src.is_real() || !dest.is_real() {
|
|
return;
|
|
}
|
|
self.err(CompilerMsg {
|
|
msg: format!(
|
|
"Cannot assign type '{}' to '{}'",
|
|
p.type_name(src),
|
|
p.type_name(dest)
|
|
),
|
|
spans: vec![span],
|
|
});
|
|
}
|
|
}
|
|
}
|