mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Get severity from type problem variants
This commit is contained in:
parent
5414b4b60f
commit
39f89e3d65
5 changed files with 99 additions and 37 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3880,6 +3880,7 @@ dependencies = [
|
||||||
"roc_collections",
|
"roc_collections",
|
||||||
"roc_error_macros",
|
"roc_error_macros",
|
||||||
"roc_module",
|
"roc_module",
|
||||||
|
"roc_problem",
|
||||||
"roc_region",
|
"roc_region",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,4 @@ roc_collections = { path = "../collections" }
|
||||||
roc_region = { path = "../region" }
|
roc_region = { path = "../region" }
|
||||||
roc_module = { path = "../module" }
|
roc_module = { path = "../module" }
|
||||||
roc_error_macros = { path = "../../error_macros" }
|
roc_error_macros = { path = "../../error_macros" }
|
||||||
|
roc_problem = { path = "../problem" }
|
||||||
|
|
|
@ -7,6 +7,7 @@ use roc_module::{
|
||||||
ident::{Lowercase, TagIdIntType, TagName},
|
ident::{Lowercase, TagIdIntType, TagName},
|
||||||
symbol::Symbol,
|
symbol::Symbol,
|
||||||
};
|
};
|
||||||
|
use roc_problem::Severity;
|
||||||
use roc_region::all::Region;
|
use roc_region::all::Region;
|
||||||
|
|
||||||
use self::Pattern::*;
|
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)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum Context {
|
pub enum Context {
|
||||||
BadArg,
|
BadArg,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! Provides types to describe problems that can occur during solving.
|
//! Provides types to describe problems that can occur during solving.
|
||||||
use roc_can::expected::{Expected, PExpected};
|
use roc_can::expected::{Expected, PExpected};
|
||||||
use roc_module::{ident::Lowercase, symbol::Symbol};
|
use roc_module::{ident::Lowercase, symbol::Symbol};
|
||||||
use roc_problem::can::CycleEntry;
|
use roc_problem::{can::CycleEntry, Severity};
|
||||||
use roc_region::all::Region;
|
use roc_region::all::Region;
|
||||||
|
|
||||||
use roc_types::types::{Category, ErrorType, PatternCategory};
|
use roc_types::types::{Category, ErrorType, PatternCategory};
|
||||||
|
@ -31,6 +31,27 @@ pub enum TypeError {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TypeError {
|
||||||
|
pub fn severity(&self) -> Severity {
|
||||||
|
use Severity::*;
|
||||||
|
match self {
|
||||||
|
TypeError::BadExpr(..) => RuntimeError,
|
||||||
|
TypeError::BadPattern(..) => RuntimeError,
|
||||||
|
TypeError::CircularType(..) => RuntimeError,
|
||||||
|
TypeError::CircularDef(_) => RuntimeError,
|
||||||
|
TypeError::UnexposedLookup(_) => RuntimeError,
|
||||||
|
TypeError::UnfulfilledAbility(_) => RuntimeError,
|
||||||
|
TypeError::BadExprMissingAbility(_, _, _, _) => RuntimeError,
|
||||||
|
TypeError::BadPatternMissingAbility(_, _, _, _) => RuntimeError,
|
||||||
|
// NB: if bidirectional exhaustiveness checking is implemented, the other direction
|
||||||
|
// is also not a runtime error.
|
||||||
|
TypeError::Exhaustive(exhtv) => exhtv.severity(),
|
||||||
|
TypeError::StructuralSpecialization { .. } => RuntimeError,
|
||||||
|
TypeError::WrongSpecialization { .. } => RuntimeError,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Debug, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
pub enum Unfulfilled {
|
pub enum Unfulfilled {
|
||||||
/// No claimed implementation of an ability for an opaque type.
|
/// No claimed implementation of an ability for an opaque type.
|
||||||
|
|
|
@ -39,26 +39,30 @@ pub fn type_problem<'b>(
|
||||||
) -> Option<Report<'b>> {
|
) -> Option<Report<'b>> {
|
||||||
use TypeError::*;
|
use TypeError::*;
|
||||||
|
|
||||||
fn report(title: String, doc: RocDocBuilder<'_>, filename: PathBuf) -> Option<Report<'_>> {
|
let severity = problem.severity();
|
||||||
Some(Report {
|
|
||||||
title,
|
let report =
|
||||||
filename,
|
move |title: String, doc: RocDocBuilder<'b>, filename: PathBuf| -> Option<Report<'b>> {
|
||||||
doc,
|
Some(Report {
|
||||||
severity: Severity::RuntimeError,
|
title,
|
||||||
})
|
filename,
|
||||||
}
|
doc,
|
||||||
|
severity,
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
match problem {
|
match problem {
|
||||||
BadExpr(region, category, found, expected) => Some(to_expr_report(
|
BadExpr(region, category, found, expected) => Some(to_expr_report(
|
||||||
alloc, lines, filename, region, category, found, expected,
|
alloc, lines, filename, severity, region, category, found, expected,
|
||||||
)),
|
)),
|
||||||
BadPattern(region, category, found, expected) => Some(to_pattern_report(
|
BadPattern(region, category, found, expected) => Some(to_pattern_report(
|
||||||
alloc, lines, filename, region, category, found, expected,
|
alloc, lines, filename, severity, region, category, found, expected,
|
||||||
)),
|
)),
|
||||||
CircularType(region, symbol, overall_type) => Some(to_circular_report(
|
CircularType(region, symbol, overall_type) => Some(to_circular_report(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
region,
|
region,
|
||||||
symbol,
|
symbol,
|
||||||
overall_type,
|
overall_type,
|
||||||
|
@ -104,7 +108,7 @@ pub fn type_problem<'b>(
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
filename,
|
filename,
|
||||||
doc: alloc.stack(stack),
|
doc: alloc.stack(stack),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
};
|
};
|
||||||
Some(report)
|
Some(report)
|
||||||
}
|
}
|
||||||
|
@ -126,7 +130,7 @@ pub fn type_problem<'b>(
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
filename,
|
filename,
|
||||||
doc: alloc.stack(stack),
|
doc: alloc.stack(stack),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
};
|
};
|
||||||
Some(report)
|
Some(report)
|
||||||
}
|
}
|
||||||
|
@ -134,7 +138,6 @@ pub fn type_problem<'b>(
|
||||||
CircularDef(entries) => {
|
CircularDef(entries) => {
|
||||||
let doc = to_circular_def_doc(alloc, lines, &entries);
|
let doc = to_circular_def_doc(alloc, lines, &entries);
|
||||||
let title = CIRCULAR_DEF.to_string();
|
let title = CIRCULAR_DEF.to_string();
|
||||||
let severity = Severity::RuntimeError;
|
|
||||||
|
|
||||||
Some(Report {
|
Some(Report {
|
||||||
title,
|
title,
|
||||||
|
@ -170,7 +173,7 @@ pub fn type_problem<'b>(
|
||||||
title: "ILLEGAL SPECIALIZATION".to_string(),
|
title: "ILLEGAL SPECIALIZATION".to_string(),
|
||||||
filename,
|
filename,
|
||||||
doc: alloc.stack(stack),
|
doc: alloc.stack(stack),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
WrongSpecialization {
|
WrongSpecialization {
|
||||||
|
@ -199,7 +202,7 @@ pub fn type_problem<'b>(
|
||||||
title: "WRONG SPECIALIZATION TYPE".to_string(),
|
title: "WRONG SPECIALIZATION TYPE".to_string(),
|
||||||
filename,
|
filename,
|
||||||
doc: alloc.stack(stack),
|
doc: alloc.stack(stack),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,6 +460,7 @@ fn report_mismatch<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
|
severity: Severity,
|
||||||
category: &Category,
|
category: &Category,
|
||||||
found: ErrorType,
|
found: ErrorType,
|
||||||
expected_type: ErrorType,
|
expected_type: ErrorType,
|
||||||
|
@ -493,7 +497,7 @@ fn report_mismatch<'b>(
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
filename,
|
filename,
|
||||||
doc: alloc.stack(lines),
|
doc: alloc.stack(lines),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,6 +506,7 @@ fn report_bad_type<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
|
severity: Severity,
|
||||||
category: &Category,
|
category: &Category,
|
||||||
found: ErrorType,
|
found: ErrorType,
|
||||||
expected_type: ErrorType,
|
expected_type: ErrorType,
|
||||||
|
@ -536,7 +541,7 @@ fn report_bad_type<'b>(
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
filename,
|
filename,
|
||||||
doc: alloc.stack(lines),
|
doc: alloc.stack(lines),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,6 +569,7 @@ fn to_expr_report<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
|
severity: Severity,
|
||||||
expr_region: roc_region::all::Region,
|
expr_region: roc_region::all::Region,
|
||||||
category: Category,
|
category: Category,
|
||||||
found: ErrorType,
|
found: ErrorType,
|
||||||
|
@ -591,6 +597,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
opt_sym,
|
opt_sym,
|
||||||
".",
|
".",
|
||||||
field,
|
field,
|
||||||
|
@ -621,7 +628,7 @@ fn to_expr_report<'b>(
|
||||||
alloc.region(lines.convert_region(expr_region)),
|
alloc.region(lines.convert_region(expr_region)),
|
||||||
comparison,
|
comparison,
|
||||||
]),
|
]),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expected::FromAnnotation(name, _arity, annotation_source, expected_type) => {
|
Expected::FromAnnotation(name, _arity, annotation_source, expected_type) => {
|
||||||
|
@ -744,7 +751,7 @@ fn to_expr_report<'b>(
|
||||||
},
|
},
|
||||||
comparison,
|
comparison,
|
||||||
]),
|
]),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expected::ForReason(reason, expected_type, region) => match reason {
|
Expected::ForReason(reason, expected_type, region) => match reason {
|
||||||
|
@ -761,6 +768,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -800,6 +808,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -838,6 +847,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -866,6 +876,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -900,6 +911,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -925,6 +937,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -964,6 +977,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -979,6 +993,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -1014,6 +1029,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -1032,6 +1048,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
Some(symbol),
|
Some(symbol),
|
||||||
"",
|
"",
|
||||||
field,
|
field,
|
||||||
|
@ -1046,6 +1063,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -1088,7 +1106,7 @@ fn to_expr_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TOO MANY ARGS".to_string(),
|
title: "TOO MANY ARGS".to_string(),
|
||||||
doc: alloc.stack(lines),
|
doc: alloc.stack(lines),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
n => {
|
n => {
|
||||||
|
@ -1123,7 +1141,7 @@ fn to_expr_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TOO MANY ARGS".to_string(),
|
title: "TOO MANY ARGS".to_string(),
|
||||||
doc: alloc.stack(lines),
|
doc: alloc.stack(lines),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let lines = vec![
|
let lines = vec![
|
||||||
|
@ -1150,7 +1168,7 @@ fn to_expr_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TOO FEW ARGS".to_string(),
|
title: "TOO FEW ARGS".to_string(),
|
||||||
doc: alloc.stack(lines),
|
doc: alloc.stack(lines),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1167,6 +1185,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -1191,6 +1210,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -1242,6 +1262,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -1282,6 +1303,7 @@ fn to_expr_report<'b>(
|
||||||
alloc,
|
alloc,
|
||||||
lines,
|
lines,
|
||||||
filename,
|
filename,
|
||||||
|
severity,
|
||||||
&category,
|
&category,
|
||||||
found,
|
found,
|
||||||
expected_type,
|
expected_type,
|
||||||
|
@ -1335,7 +1357,7 @@ fn to_expr_report<'b>(
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
filename,
|
filename,
|
||||||
doc: alloc.stack(lines),
|
doc: alloc.stack(lines),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,7 +1394,7 @@ fn to_expr_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1408,7 +1430,7 @@ fn to_expr_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
doc: alloc.stack(lines),
|
doc: alloc.stack(lines),
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1757,6 +1779,7 @@ fn to_pattern_report<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
|
severity: Severity,
|
||||||
expr_region: roc_region::all::Region,
|
expr_region: roc_region::all::Region,
|
||||||
category: PatternCategory,
|
category: PatternCategory,
|
||||||
found: ErrorType,
|
found: ErrorType,
|
||||||
|
@ -1783,7 +1806,7 @@ fn to_pattern_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1826,7 +1849,7 @@ fn to_pattern_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PReason::WhenMatch { index, sub_pattern } => {
|
PReason::WhenMatch { index, sub_pattern } => {
|
||||||
|
@ -1906,7 +1929,7 @@ fn to_pattern_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PReason::ListElem => {
|
PReason::ListElem => {
|
||||||
|
@ -1933,7 +1956,7 @@ fn to_pattern_report<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PReason::TagArg { .. } | PReason::PatternGuard => {
|
PReason::TagArg { .. } | PReason::PatternGuard => {
|
||||||
|
@ -2008,6 +2031,7 @@ fn to_circular_report<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
|
severity: Severity,
|
||||||
region: roc_region::all::Region,
|
region: roc_region::all::Region,
|
||||||
symbol: Symbol,
|
symbol: Symbol,
|
||||||
overall_type: ErrorType,
|
overall_type: ErrorType,
|
||||||
|
@ -2032,7 +2056,7 @@ fn to_circular_report<'b>(
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4083,6 +4107,7 @@ fn report_record_field_typo<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
lines: &LineInfo,
|
lines: &LineInfo,
|
||||||
filename: PathBuf,
|
filename: PathBuf,
|
||||||
|
severity: Severity,
|
||||||
opt_sym: Option<Symbol>,
|
opt_sym: Option<Symbol>,
|
||||||
field_prefix: &str,
|
field_prefix: &str,
|
||||||
field: &Lowercase,
|
field: &Lowercase,
|
||||||
|
@ -4164,7 +4189,7 @@ fn report_record_field_typo<'b>(
|
||||||
filename,
|
filename,
|
||||||
title: "TYPE MISMATCH".to_string(),
|
title: "TYPE MISMATCH".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4177,6 +4202,8 @@ fn exhaustive_problem<'a>(
|
||||||
use roc_exhaustive::Context::*;
|
use roc_exhaustive::Context::*;
|
||||||
use roc_exhaustive::Error::*;
|
use roc_exhaustive::Error::*;
|
||||||
|
|
||||||
|
let severity = problem.severity();
|
||||||
|
|
||||||
match problem {
|
match problem {
|
||||||
Incomplete(region, context, missing) => match context {
|
Incomplete(region, context, missing) => match context {
|
||||||
BadArg => {
|
BadArg => {
|
||||||
|
@ -4199,7 +4226,7 @@ fn exhaustive_problem<'a>(
|
||||||
filename,
|
filename,
|
||||||
title: "UNSAFE PATTERN".to_string(),
|
title: "UNSAFE PATTERN".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BadDestruct => {
|
BadDestruct => {
|
||||||
|
@ -4223,7 +4250,7 @@ fn exhaustive_problem<'a>(
|
||||||
filename,
|
filename,
|
||||||
title: "UNSAFE PATTERN".to_string(),
|
title: "UNSAFE PATTERN".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BadCase => {
|
BadCase => {
|
||||||
|
@ -4247,7 +4274,7 @@ fn exhaustive_problem<'a>(
|
||||||
filename,
|
filename,
|
||||||
title: "UNSAFE PATTERN".to_string(),
|
title: "UNSAFE PATTERN".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::RuntimeError,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -4276,7 +4303,7 @@ fn exhaustive_problem<'a>(
|
||||||
filename,
|
filename,
|
||||||
title: "REDUNDANT PATTERN".to_string(),
|
title: "REDUNDANT PATTERN".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::Warning,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Unmatchable {
|
Unmatchable {
|
||||||
|
@ -4304,7 +4331,7 @@ fn exhaustive_problem<'a>(
|
||||||
filename,
|
filename,
|
||||||
title: "UNMATCHABLE PATTERN".to_string(),
|
title: "UNMATCHABLE PATTERN".to_string(),
|
||||||
doc,
|
doc,
|
||||||
severity: Severity::Warning,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue