Solve all when branch pattern constraints before solving their bodies

Closes #2886
This commit is contained in:
Ayaz Hafiz 2022-04-18 11:03:25 -04:00
parent e0c9931326
commit 2856a38236
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 127 additions and 104 deletions

View file

@ -5932,4 +5932,21 @@ mod solve_expr {
"a -> U64 | a has Hash",
)
}
#[test]
fn when_branch_and_body_flipflop() {
infer_eq_without_problem(
indoc!(
r#"
func = \record ->
when record.tag is
A -> { record & tag: B }
B -> { record & tag: A }
func
"#
),
"{ tag : [ A, B ] }a -> { tag : [ A, B ] }a",
)
}
}