Merge pull request #4976 from thehabbos007/list-concat

gen_dev: add `List.concat` and fix element width bug
This commit is contained in:
Folkert de Vries 2023-01-28 13:56:36 +01:00 committed by GitHub
commit 6fc57f0a0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 128 additions and 20 deletions

View file

@ -1601,7 +1601,7 @@ fn list_reverse_empty_list() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_two_empty_lists() {
assert_evals_to!(
"List.concat [] []",
@ -1611,7 +1611,7 @@ fn list_concat_two_empty_lists() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_two_empty_lists_of_int() {
assert_evals_to!(
indoc!(
@ -1633,7 +1633,7 @@ fn list_concat_two_empty_lists_of_int() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_second_list_is_empty() {
assert_evals_to!(
"List.concat [12, 13] []",
@ -1643,7 +1643,7 @@ fn list_concat_second_list_is_empty() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_first_list_is_empty() {
assert_evals_to!(
"List.concat [] [23, 24]",
@ -1653,7 +1653,7 @@ fn list_concat_first_list_is_empty() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_two_non_empty_lists() {
assert_evals_to!(
"List.concat [1, 2] [3, 4]",
@ -1679,7 +1679,7 @@ fn list_concat_two_bigger_non_empty_lists() {
}
#[allow(dead_code)]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn assert_concat_worked(num_elems1: i64, num_elems2: i64) {
let vec1: Vec<i64> = (0..num_elems1)
.map(|i| 12345 % (i + num_elems1 + num_elems2 + 1))
@ -1701,7 +1701,7 @@ fn assert_concat_worked(num_elems1: i64, num_elems2: i64) {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_empty_list() {
assert_concat_worked(0, 0);
assert_concat_worked(1, 0);
@ -1725,7 +1725,7 @@ fn list_concat_empty_list() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_nonempty_lists() {
assert_concat_worked(1, 1);
assert_concat_worked(1, 2);
@ -1741,7 +1741,7 @@ fn list_concat_nonempty_lists() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_concat_large() {
with_larger_debug_stack(|| {
// these values produce mono ASTs so large that

View file

@ -273,6 +273,7 @@ macro_rules! assert_evals_to {
let transform = |success| {
let expected = $expected;
#[allow(clippy::redundant_closure_call)]
let given = $transform(success);
assert_eq!(&given, &expected);
};