mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
implement standard as patterns in mono IR
This commit is contained in:
parent
726d8d80c4
commit
cf15654ee5
7 changed files with 347 additions and 128 deletions
|
@ -2217,7 +2217,7 @@ fn issue_4749() {
|
|||
|
||||
expect
|
||||
input = [82, 111, 99]
|
||||
got = Decode.fromBytes input Json.fromUtf8
|
||||
got = Decode.fromBytes input Json.fromUtf8
|
||||
got == Ok "Roc"
|
||||
"###
|
||||
)
|
||||
|
@ -2246,7 +2246,7 @@ fn lambda_set_with_imported_toplevels_issue_4733() {
|
|||
fn order_list_size_tests_issue_4732() {
|
||||
indoc!(
|
||||
r###"
|
||||
when [] is
|
||||
when [] is
|
||||
[1, ..] -> "B1"
|
||||
[2, 1, ..] -> "B2"
|
||||
[3, 2, 1, ..] -> "B3"
|
||||
|
@ -2363,3 +2363,48 @@ fn nullable_wrapped_with_nullable_not_last_index() {
|
|||
"###
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn pattern_as_toplevel() {
|
||||
indoc!(
|
||||
r###"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
record = { a: 42i64, b: "foo" }
|
||||
|
||||
main =
|
||||
when record is
|
||||
{ a: 42i64 } as r -> record == r
|
||||
_ -> Bool.false
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn pattern_as_nested() {
|
||||
indoc!(
|
||||
r###"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
record = { a: 42i64, b: "foo" }
|
||||
|
||||
main =
|
||||
when Pair {} record is
|
||||
Pair {} ({ a: 42i64 } as r) -> record == r
|
||||
_ -> Bool.false
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn pattern_as_of_symbol() {
|
||||
indoc!(
|
||||
r###"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
main =
|
||||
when "foo" is
|
||||
a as b -> a == b
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue