use serde::{Deserialize, Serialize};
use crate::Span;
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub enum Severity {
Error,
Warning,
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Diagnostic {
pub code: String,
pub severity: Severity,
pub span: Span,
pub semantic_path: Vec<String>,
pub message: String,
pub hint: Option<String>,
}
impl Diagnostic {
pub(crate) fn error(code: &str, span: Span, message: impl Into<String>) -> Self {
Self {
code: code.to_owned(),
severity: Severity::Error,
span,
semantic_path: Vec::new(),
message: message.into(),
hint: None,
}
}
}