mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Ignore type errors that have already been reported
This commit is contained in:
parent
cde9f97415
commit
a21ad7064c
6 changed files with 48 additions and 37 deletions
|
@ -16,28 +16,32 @@ pub fn type_problem<'b>(
|
|||
alloc: &'b RocDocAllocator<'b>,
|
||||
filename: PathBuf,
|
||||
problem: solve::TypeError,
|
||||
) -> Report<'b> {
|
||||
) -> Option<Report<'b>> {
|
||||
use solve::TypeError::*;
|
||||
|
||||
fn report(title: String, doc: RocDocBuilder<'_>, filename: PathBuf) -> Report<'_> {
|
||||
Report {
|
||||
fn report(title: String, doc: RocDocBuilder<'_>, filename: PathBuf) -> Option<Report<'_>> {
|
||||
Some(Report {
|
||||
title,
|
||||
filename,
|
||||
doc,
|
||||
severity: Severity::RuntimeError,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
match problem {
|
||||
BadExpr(region, category, found, expected) => {
|
||||
to_expr_report(alloc, filename, region, category, found, expected)
|
||||
}
|
||||
BadPattern(region, category, found, expected) => {
|
||||
to_pattern_report(alloc, filename, region, category, found, expected)
|
||||
}
|
||||
CircularType(region, symbol, overall_type) => {
|
||||
to_circular_report(alloc, filename, region, symbol, overall_type)
|
||||
}
|
||||
BadExpr(region, category, found, expected) => Some(to_expr_report(
|
||||
alloc, filename, region, category, found, expected,
|
||||
)),
|
||||
BadPattern(region, category, found, expected) => Some(to_pattern_report(
|
||||
alloc, filename, region, category, found, expected,
|
||||
)),
|
||||
CircularType(region, symbol, overall_type) => Some(to_circular_report(
|
||||
alloc,
|
||||
filename,
|
||||
region,
|
||||
symbol,
|
||||
overall_type,
|
||||
)),
|
||||
UnexposedLookup(symbol) => {
|
||||
let title = "UNRECOGNIZED NAME".to_string();
|
||||
let doc = alloc
|
||||
|
@ -97,6 +101,8 @@ pub fn type_problem<'b>(
|
|||
report(title, doc, filename)
|
||||
}
|
||||
|
||||
SolvedTypeError => None,
|
||||
|
||||
other => panic!("unhandled bad type: {:?}", other),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue