use crate::diag::{Diag, DiagCode};
use crate::ir::DType;

/// Constructor for an implicit type-promotion diagnostic produced during optimisation.
pub fn opt_promotion(where_: &str, idx: usize, lhs: DType, rhs: DType, out: DType) -> Diag {
    Diag::new(
        DiagCode::OptPromotion,
        format!("implicit promotion in {where_} at node#{idx}: {lhs} + {rhs} -> {out}"),
        None,
        None,
    )
}
