Get severity from type problem variants

This commit is contained in:
Ayaz Hafiz 2022-12-02 11:27:54 -06:00
parent 5414b4b60f
commit 39f89e3d65
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
5 changed files with 99 additions and 37 deletions

View file

@ -7,6 +7,7 @@ use roc_module::{
ident::{Lowercase, TagIdIntType, TagName},
symbol::Symbol,
};
use roc_problem::Severity;
use roc_region::all::Region;
use self::Pattern::*;
@ -149,6 +150,17 @@ pub enum Error {
},
}
impl Error {
pub fn severity(&self) -> Severity {
use Severity::*;
match self {
Error::Incomplete(..) => RuntimeError,
Error::Redundant { .. } => Warning,
Error::Unmatchable { .. } => Warning,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Context {
BadArg,