mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Crash at runtime rather than panicking when if condition is erroneous
Closes #5318
This commit is contained in:
parent
cdf8677dfb
commit
a9975b1f7f
4 changed files with 31 additions and 9 deletions
|
@ -6613,12 +6613,16 @@ pub fn from_can<'a>(
|
|||
branches,
|
||||
final_else,
|
||||
} => {
|
||||
let ret_layout = layout_cache
|
||||
.from_var(env.arena, branch_var, env.subs)
|
||||
.expect("invalid ret_layout");
|
||||
let cond_layout = layout_cache
|
||||
.from_var(env.arena, cond_var, env.subs)
|
||||
.expect("invalid cond_layout");
|
||||
let ret_layout = return_on_layout_error!(
|
||||
env,
|
||||
layout_cache.from_var(env.arena, branch_var, env.subs),
|
||||
"invalid return type in if expression"
|
||||
);
|
||||
let cond_layout = return_on_layout_error!(
|
||||
env,
|
||||
layout_cache.from_var(env.arena, cond_var, env.subs),
|
||||
"invalid condition type in if expression"
|
||||
);
|
||||
|
||||
let mut stmt = from_can(env, branch_var, final_else.value, procs, layout_cache);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue