Refactor ParseProblem

* Remove the `pos` field, which was always being assigned Position::default()
* Remove one use of this `pos`, by removing the never-used SyntaxError::ConditionFailed variant
* Adjust the other use to do what was probably intended - which is to say, pointing to the beginning of the def with the error
* Rename to FileError, reuse `SourceError` as an inner field, to avoid duplicating the `bytes`
This commit is contained in:
Joshua Warner 2022-01-03 19:52:33 -08:00
parent 226237d1cd
commit f22f96843e
9 changed files with 53 additions and 66 deletions

View file

@ -16,7 +16,7 @@ use roc_module::symbol::{IdentIds, Interns, ModuleId, ModuleIds};
use roc_parse::ident::{parse_ident, Ident};
use roc_parse::parser::SyntaxError;
use roc_parse::state::State;
use roc_region::all::Region;
use roc_region::all::{Position, Region};
use std::fs;
use std::path::{Path, PathBuf};
@ -128,7 +128,7 @@ pub fn syntax_highlight_expr<'a>(
Ok(buf.to_string())
}
Err(fail) => Err(SyntaxError::Expr(fail)),
Err(fail) => Err(SyntaxError::Expr(fail, Position::default())),
}
}