mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-04 00:55:00 +00:00
Merge remote-tracking branch 'origin/main' into roc-dev-inline-expects
This commit is contained in:
commit
ebac056814
67 changed files with 851 additions and 1952 deletions
|
|
@ -1122,11 +1122,6 @@ mod hash {
|
|||
addU32: tAddU32,
|
||||
addU64: tAddU64,
|
||||
addU128: tAddU128,
|
||||
addI8: tAddI8,
|
||||
addI16: tAddI16,
|
||||
addI32: tAddI32,
|
||||
addI64: tAddI64,
|
||||
addI128: tAddI128,
|
||||
complete: tComplete,
|
||||
}]
|
||||
|
||||
|
|
@ -1165,11 +1160,6 @@ mod hash {
|
|||
tAddU32 = \@THasher total, n -> @THasher (do32 total n)
|
||||
tAddU64 = \@THasher total, n -> @THasher (do64 total n)
|
||||
tAddU128 = \@THasher total, n -> @THasher (do128 total n)
|
||||
tAddI8 = \@THasher total, n -> @THasher (do8 total (Num.toU8 n))
|
||||
tAddI16 = \@THasher total, n -> @THasher (do16 total (Num.toU16 n))
|
||||
tAddI32 = \@THasher total, n -> @THasher (do32 total (Num.toU32 n))
|
||||
tAddI64 = \@THasher total, n -> @THasher (do64 total (Num.toU64 n))
|
||||
tAddI128 = \@THasher total, n -> @THasher (do128 total (Num.toU128 n))
|
||||
tComplete = \@THasher _ -> Num.maxU64
|
||||
|
||||
tRead = \@THasher bytes -> bytes
|
||||
|
|
|
|||
|
|
@ -956,6 +956,12 @@ fn list_walk_until_even_prefix_sum() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_walk_from_sum() {
|
||||
assert_evals_to!(r#"List.walkFrom [1, 2, 3] 1 0 Num.add"#, 5, i64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_keep_if_empty_list_of_int() {
|
||||
|
|
@ -3482,16 +3488,6 @@ fn list_let_generalization() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_walk_backwards_until_sum() {
|
||||
assert_evals_to!(
|
||||
r#"List.walkBackwardsUntil [1, 2] 0 \a,b -> Continue (a + b)"#,
|
||||
3,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_walk_backwards_implements_position() {
|
||||
|
|
@ -3520,6 +3516,16 @@ fn list_walk_backwards_implements_position() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_walk_backwards_until_sum() {
|
||||
assert_evals_to!(
|
||||
r#"List.walkBackwardsUntil [1, 2] 0 \a,b -> Continue (a + b)"#,
|
||||
3,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_walk_backwards_until_even_prefix_sum() {
|
||||
|
|
@ -3537,3 +3543,31 @@ fn list_walk_backwards_until_even_prefix_sum() {
|
|||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_walk_from_until_sum() {
|
||||
assert_evals_to!(
|
||||
r#"List.walkFromUntil [1, 2, 3, 4] 2 0 \a,b -> Continue (a + b)"#,
|
||||
7,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn list_walk_from_even_prefix_sum() {
|
||||
assert_evals_to!(
|
||||
r#"
|
||||
helper = \a, b ->
|
||||
if Num.isEven b then
|
||||
Continue (a + b)
|
||||
|
||||
else
|
||||
Break a
|
||||
|
||||
List.walkFromUntil [2, 4, 8, 9] 1 0 helper"#,
|
||||
4 + 8,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue