Merge branch 'main' into fromutf-roc

This commit is contained in:
shua 2025-01-18 01:58:14 +01:00
commit 17624a9d2c
No known key found for this signature in database
161 changed files with 2323 additions and 1168 deletions

View file

@ -337,7 +337,7 @@ fn decode() {
# impl MDecoding for MyU8
decoder = @MDecoder \lst, fmt ->
{ result, rest } = decode_with lst u8 fmt
{ result: Result.map result (\n -> @MyU8 n), rest }
{ result: Result.map_ok result (\n -> @MyU8 n), rest }
myU8 =
when from_bytes [15] (@Linear {}) is
@ -2210,7 +2210,7 @@ fn issue_4772_weakened_monomorphic_destructure() {
Err (ParsingFailure "not a number")
main =
get_number |> Result.map .val |> Result.with_default 0
get_number |> Result.map_ok .val |> Result.with_default 0
"#
),
1234i64,

View file

@ -554,7 +554,7 @@ fn list_split_first() {
assert_evals_to!(
r"
List.split_first [2, 3, 0, 4, 0, 6, 0, 8, 9] 0
|> Result.map .before
|> Result.map_ok .before
",
RocResult::ok(RocList::<i64>::from_slice(&[2, 3])),
RocResult<RocList<i64>, ()>
@ -562,7 +562,7 @@ fn list_split_first() {
assert_evals_to!(
r"
List.split_first [2, 3, 0, 4, 0, 6, 0, 8, 9] 0
|> Result.map .after
|> Result.map_ok .after
",
RocResult::ok(RocList::<i64>::from_slice(&[4, 0, 6, 0, 8, 9])),
RocResult<RocList<i64>, ()>
@ -587,7 +587,7 @@ fn list_split_last() {
assert_evals_to!(
r"
List.split_last [2, 3, 0, 4, 0, 6, 0, 8, 9] 0
|> Result.map .before
|> Result.map_ok .before
",
RocResult::ok(RocList::<i64>::from_slice(&[2, 3, 0, 4, 0, 6])),
RocResult<RocList<i64>, ()>
@ -595,7 +595,7 @@ fn list_split_last() {
assert_evals_to!(
r"
List.split_last [2, 3, 0, 4, 0, 6, 0, 8, 9] 0
|> Result.map .after
|> Result.map_ok .after
",
RocResult::ok(RocList::<i64>::from_slice(&[8, 9])),
RocResult<RocList<i64>, ()>
@ -2164,7 +2164,7 @@ fn first_wildcard_empty_list() {
assert_evals_to!(
indoc!(
r"
List.last [] |> Result.map (\_ -> 0i64)
List.last [] |> Result.map_ok (\_ -> 0i64)
"
),
RocResult::err(()),
@ -2209,7 +2209,7 @@ fn last_wildcard_empty_list() {
assert_evals_to!(
indoc!(
r"
List.last [] |> Result.map (\_ -> 0i64)
List.last [] |> Result.map_ok (\_ -> 0i64)
"
),
RocResult::err(()),
@ -2261,7 +2261,7 @@ fn get_wildcard_empty_list() {
indoc!(
r"
List.get [] 0
|> Result.map (\_ -> {})
|> Result.map_ok (\_ -> {})
"
),
RocResult::err(()),
@ -2978,7 +2978,7 @@ fn list_min() {
indoc!(
r"
List.min []
|> Result.map (\_ -> {})
|> Result.map_ok (\_ -> {})
"
),
RocResult::err(()),
@ -3003,7 +3003,7 @@ fn list_max() {
indoc!(
r"
List.max []
|> Result.map (\_ -> {})
|> Result.map_ok (\_ -> {})
"
),
RocResult::err(()),

View file

@ -56,7 +56,7 @@ fn result_map() {
result = Ok 2
result
|> Result.map (\x -> x + 1)
|> Result.map_ok (\x -> x + 1)
|> Result.with_default 0
"
),
@ -71,7 +71,7 @@ fn result_map() {
result = Err {}
result
|> Result.map (\x -> x + 1)
|> Result.map_ok (\x -> x + 1)
|> Result.with_default 0
"
),
@ -120,7 +120,7 @@ fn err_type_var() {
assert_evals_to!(
indoc!(
r"
Result.map (Ok 3) (\x -> x + 1)
Result.map_ok (Ok 3) (\x -> x + 1)
|> Result.with_default -1
"
),
@ -138,7 +138,7 @@ fn err_type_var_annotation() {
ok : Result I64 *
ok = Ok 3
Result.map ok (\x -> x + 1)
Result.map_ok ok (\x -> x + 1)
|> Result.with_default -1
"
),
@ -156,7 +156,7 @@ fn err_empty_tag_union() {
ok : Result I64 []
ok = Ok 3
Result.map ok (\x -> x + 1)
Result.map_ok ok (\x -> x + 1)
|> Result.with_default -1
"
),