mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 19:32:17 +00:00
Correctly check mutual functional recursion between opaque types
The mutual-recursion checks does not admit types that are not function types; because Roc is strict, only functional values can be involved in mutual recursion. However, this check was exercised by checking the head constructor of a type, which is not the correct way to do it. Aliases and opaque types may in fact be function types as well, so we must chase their actual contents. Closes #4246
This commit is contained in:
parent
25d60d20cd
commit
d9863cbbaa
2 changed files with 32 additions and 2 deletions
|
@ -7940,4 +7940,22 @@ mod solve_expr {
|
|||
"U32 -> U32",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_4246_admit_recursion_between_opaque_functions() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [b] to "./platform"
|
||||
|
||||
O := {} -> {}
|
||||
|
||||
a = @O \{} -> ((\@O f -> f {}) b)
|
||||
|
||||
b = a
|
||||
"#
|
||||
),
|
||||
"O",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue