mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Make sure self-recursive checks only happen after typechecking
Programs like ``` after : ({} -> a), ({} -> b) -> ({} -> b) fx = after (\{} -> {}) \{} -> if Bool.true then fx {} else {} ``` are legal because they always decay to functions, even if they may not look like functions syntactically. Rather than using a syntactic check to check for illegally-recursive functions, we should only perform such checks after we know the types of values. Closes #4291
This commit is contained in:
parent
99ad019d75
commit
ecab8fa25a
4 changed files with 74 additions and 80 deletions
|
@ -422,7 +422,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
};
|
||||
|
||||
let (mut declarations, mut output) =
|
||||
crate::def::sort_can_defs_new(&mut env, &mut scope, var_store, defs, new_output);
|
||||
crate::def::sort_can_defs_new(&mut scope, var_store, defs, new_output);
|
||||
|
||||
debug_assert!(
|
||||
output.pending_derives.is_empty(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue