Merge pull request #3747 from roc-lang/i2419

Add regression tests for #2419
This commit is contained in:
Richard Feldman 2022-08-12 19:53:53 -04:00 committed by GitHub
commit 99a22d6bbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 0 deletions

View file

@ -234,6 +234,14 @@ impl Wasm32Result for () {
}
}
impl Wasm32Result for std::convert::Infallible {
fn build_wrapper_body(code_builder: &mut CodeBuilder, main_function_index: u32) {
code_builder.call(main_function_index, 0, false);
code_builder.get_global(0);
code_builder.build_fn_header_and_footer(&[], 0, None);
}
}
impl<T, U> Wasm32Result for (T, U)
where
T: Wasm32Result + Wasm32Sized,

View file

@ -9,6 +9,8 @@ use crate::helpers::wasm::assert_evals_to;
use indoc::indoc;
#[allow(unused_imports)]
use roc_std::RocList;
#[allow(unused_imports)]
use roc_std::RocStr;
#[test]
@ -3838,3 +3840,47 @@ fn compose_recursive_lambda_set_productive_inferred() {
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn local_binding_aliases_function() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [ main ] to "./platform"
f : {} -> List a
f = \_ -> []
main : List U8
main =
g = f
g {}
"#
),
RocList::<u8>::from_slice(&[]),
RocList<u8>
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn local_binding_aliases_function_inferred() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [ main ] to "./platform"
f = \_ -> []
main =
g = f
g {}
"#
),
RocList::from_slice(&[]),
RocList<std::convert::Infallible>
);
}