mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
drilling into every error type when getting region
This commit is contained in:
parent
81f2095e61
commit
7eb81fbcf3
2 changed files with 642 additions and 48 deletions
|
@ -75,6 +75,7 @@ impl ToRocPosition for tower_lsp::lsp_types::Position {
|
|||
pub(crate) mod diag {
|
||||
use std::{fmt::Debug, path::Path};
|
||||
|
||||
use log::debug;
|
||||
use roc_load::LoadingProblem;
|
||||
use roc_region::all::{LineInfo, Region};
|
||||
use roc_solve_problem::TypeError;
|
||||
|
@ -117,6 +118,8 @@ pub(crate) mod diag {
|
|||
))
|
||||
.to_range(line_info);
|
||||
|
||||
debug!("range is {:?}", range);
|
||||
|
||||
let msg = match self {
|
||||
LoadingProblem::FileProblem { filename, error } => {
|
||||
format!(
|
||||
|
@ -153,10 +156,8 @@ pub(crate) mod diag {
|
|||
LoadingProblem::TriedToImportAppModule => {
|
||||
"Attempted to import app module".to_string()
|
||||
}
|
||||
LoadingProblem::FormattedReport(report, region) => {
|
||||
range = region.unwrap_or(Region::zero()).to_range(line_info);
|
||||
report.clone()
|
||||
}
|
||||
LoadingProblem::FormattedReport(report, region) =>
|
||||
report.clone(),
|
||||
LoadingProblem::ImportCycle(_, _) => {
|
||||
"Circular dependency between modules".to_string()
|
||||
}
|
||||
|
@ -204,6 +205,7 @@ pub(crate) mod diag {
|
|||
))
|
||||
.to_range(fmt.line_info);
|
||||
|
||||
debug!("range is {:?}", range);
|
||||
let report = roc_reporting::report::can_problem(
|
||||
fmt.alloc,
|
||||
fmt.line_info,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue