mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-13 15:26:24 +00:00
Allow configuring whether can errors are acceptable in tests
This commit is contained in:
parent
73e5a9ed46
commit
b33393ca39
3 changed files with 62 additions and 5 deletions
|
@ -256,7 +256,6 @@ fn parse_queries(src: &str, line_info: &LineInfo) -> Vec<TypeQuery> {
|
|||
pub struct InferOptions {
|
||||
pub print_can_decls: bool,
|
||||
pub print_only_under_alias: bool,
|
||||
pub allow_errors: bool,
|
||||
pub no_promote: bool,
|
||||
}
|
||||
|
||||
|
@ -348,6 +347,7 @@ pub fn infer_queries<'a>(
|
|||
src: &str,
|
||||
dependencies: impl IntoIterator<Item = (&'a str, &'a str)>,
|
||||
options: InferOptions,
|
||||
allow_can_errors: bool,
|
||||
) -> Result<InferredProgram, Box<dyn Error>> {
|
||||
let (
|
||||
LoadedModule {
|
||||
|
@ -369,11 +369,11 @@ pub fn infer_queries<'a>(
|
|||
let can_problems = can_problems.remove(&home).unwrap_or_default();
|
||||
let type_problems = type_problems.remove(&home).unwrap_or_default();
|
||||
|
||||
if !options.allow_errors {
|
||||
{
|
||||
let (can_problems, type_problems) =
|
||||
format_problems(&src, home, &interns, can_problems, type_problems);
|
||||
|
||||
if !can_problems.is_empty() {
|
||||
if !can_problems.is_empty() && !allow_can_errors {
|
||||
return Err(format!("Canonicalization problems: {can_problems}",).into());
|
||||
}
|
||||
if !type_problems.is_empty() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue