Remove compiler-file/line-dependent runtime error messages

This will help avoid the diff changes we've been running into often when
changes to mono line numbers change test results.
This commit is contained in:
Ayaz Hafiz 2022-07-12 15:17:19 -04:00
parent f5f137982c
commit 94142bf474
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 18 additions and 27 deletions

View file

@ -80,18 +80,15 @@ macro_rules! return_on_layout_error_help {
($env:expr, $error:expr, $context_msg:expr) => {{
match $error {
LayoutProblem::UnresolvedTypeVar(_) => {
return Stmt::RuntimeError($env.arena.alloc(format!(
"UnresolvedTypeVar {} at {}",
file!(),
$context_msg,
)));
return Stmt::RuntimeError(
$env.arena
.alloc(format!("UnresolvedTypeVar: {}", $context_msg,)),
);
}
LayoutProblem::Erroneous => {
return Stmt::RuntimeError($env.arena.alloc(format!(
"Erroneous {} at {}",
file!(),
$context_msg,
)));
return Stmt::RuntimeError(
$env.arena.alloc(format!("Erroneous: {}", $context_msg,)),
);
}
}
}};
@ -4599,12 +4596,10 @@ pub fn with_hole<'a>(
);
if let Err(runtime_error) = inserted {
return Stmt::RuntimeError(env.arena.alloc(format!(
"RuntimeError {} line {} {:?}",
file!(),
line!(),
runtime_error,
)));
return Stmt::RuntimeError(
env.arena
.alloc(format!("RuntimeError: {:?}", runtime_error,)),
);
} else {
drop(inserted);
}
@ -5322,16 +5317,14 @@ fn convert_tag_union<'a>(
Ok(cached) => cached,
Err(LayoutProblem::UnresolvedTypeVar(_)) => {
return Stmt::RuntimeError(env.arena.alloc(format!(
"UnresolvedTypeVar {} line {}",
file!(),
line!()
"Unresolved type variable for tag {}",
tag_name.0.as_str()
)))
}
Err(LayoutProblem::Erroneous) => {
return Stmt::RuntimeError(env.arena.alloc(format!(
"Erroneous {} line {}",
file!(),
line!()
"Tag {} was part of a type error!",
tag_name.0.as_str()
)));
}
};
@ -5614,9 +5607,7 @@ fn tag_union_to_function<'a>(
}
Err(runtime_error) => Stmt::RuntimeError(env.arena.alloc(format!(
"RuntimeError {} line {} {:?}",
file!(),
line!(),
"Could not produce tag function due to a runtime error: {:?}",
runtime_error,
))),
}

View file

@ -1,6 +1,6 @@
procedure List.5 (#Attr.2, #Attr.3):
Error UnresolvedTypeVar crates/compiler/mono/src/ir.rs at match_on_closure_argument
Error UnresolvedTypeVar: match_on_closure_argument
procedure Test.0 ():
let Test.1 : List [] = Array [];
Error UnresolvedTypeVar crates/compiler/mono/src/ir.rs at Expr::Closure
Error UnresolvedTypeVar: Expr::Closure