show platform header in error messages

This commit is contained in:
Folkert 2021-03-23 23:00:18 +01:00
parent c9f396b985
commit dd8bdcb806
2 changed files with 48 additions and 20 deletions

View file

@ -456,7 +456,7 @@ impl<'a> Procs<'a> {
name,
PartialProc {
annotation,
pattern_symbols: pattern_symbols.into_bump_slice() ,
pattern_symbols: pattern_symbols.into_bump_slice(),
captured_symbols: CapturedSymbols::None,
body: roc_can::expr::Expr::RuntimeError(error.value),
is_self_recursive: false,
@ -1795,10 +1795,11 @@ fn specialize_external<'a>(
let snapshot = env.subs.snapshot();
let cache_snapshot = layout_cache.snapshot();
let unified = roc_unify::unify::unify(env.subs, annotation, fn_var);
let _unified = roc_unify::unify::unify(env.subs, annotation, fn_var);
let is_valid = matches!(unified, roc_unify::unify::Unified::Success(_));
debug_assert!(is_valid, "unificaton failure for {:?}", proc_name);
// This will not hold for programs with type errors
// let is_valid = matches!(unified, roc_unify::unify::Unified::Success(_));
// debug_assert!(is_valid, "unificaton failure for {:?}", proc_name);
// if this is a closure, add the closure record argument
let pattern_symbols = if let CapturedSymbols::Captured(_) = captured_symbols {
@ -2138,9 +2139,7 @@ fn build_specialized_proc_adapter<'a>(
arg_layouts.push(layout);
}
let ret_layout = layout_cache
.from_var(&env.arena, ret_var, env.subs)
.unwrap_or_else(|err| panic!("TODO handle invalid function {:?}", err));
let ret_layout = layout_cache.from_var(&env.arena, ret_var, env.subs)?;
build_specialized_proc(
env.arena,