mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Correct pattern matching of nullable wrapped tag unions
The nullable ID always has zero tags. For everything else, we should just match with the arity of the number of arguments, which doesn't include the tag ID.
This commit is contained in:
parent
d59b137f45
commit
3aab378bab
3 changed files with 70 additions and 23 deletions
|
@ -2314,3 +2314,29 @@ fn issue_4557() {
|
|||
"###
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn nullable_wrapped_with_non_nullable_singleton_tags() {
|
||||
indoc!(
|
||||
r###"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
F : [
|
||||
A F,
|
||||
B,
|
||||
C,
|
||||
]
|
||||
|
||||
g : F -> Str
|
||||
g = \f -> when f is
|
||||
A _ -> "A"
|
||||
B -> "B"
|
||||
C -> "C"
|
||||
|
||||
main =
|
||||
g (A (B))
|
||||
|> Str.concat (g B)
|
||||
|> Str.concat (g C)
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue