We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62f5292 commit 59403d5Copy full SHA for 59403d5
src/typecheck.rs
@@ -61,7 +61,19 @@ fn check_stmt_types(
61
Stmt::Skip | Stmt::Step | Stmt::Fork => Ok(()),
62
Stmt::Assign(lhs, rhs) => {
63
let lhs_type = st[lhs].tpe();
64
- let rhs_type = check_expr_types(tr, st, handler, rhs)?;
+ let mut rhs_type = check_expr_types(tr, st, handler, rhs)?;
65
+ if rhs_type == Type::Unknown {
66
+ rhs_type = lhs_type.clone();
67
+ handler.emit_diagnostic_stmt(
68
+ tr,
69
+ stmt_id,
70
+ &format!(
71
+ "Inferred RHS type as {:?} from LHS type {:?}.",
72
+ rhs_type, lhs_type
73
+ ),
74
+ Level::Warning,
75
+ );
76
+ }
77
if lhs_type.is_equivalent(&rhs_type) {
78
Ok(())
79
} else {
0 commit comments