use crate::span::Span;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Severity {
Error,
Warning,
Info,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Diagnostic {
pub severity: Severity,
pub message: String,
pub span: Span,
}
impl Diagnostic {
pub fn error(span: Span, message: impl Into<String>) -> Self {
Self {
severity: Severity::Error,
message: message.into(),
span,
}
}
pub fn warning(span: Span, message: impl Into<String>) -> Self {
Self {
severity: Severity::Warning,
message: message.into(),
span,
}
}
pub fn info(span: Span, message: impl Into<String>) -> Self {
Self {
severity: Severity::Info,
message: message.into(),
span,
}
}
}