From 143b0f61a87e57c7ca6e6f531f17bfd64fcc5210 Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Thu, 5 May 2022 09:27:47 -0400 Subject: [PATCH] Add a couple tests --- compiler/test_gen/src/gen_primitives.rs | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/compiler/test_gen/src/gen_primitives.rs b/compiler/test_gen/src/gen_primitives.rs index c48c91d0a2..509bd3e886 100644 --- a/compiler/test_gen/src/gen_primitives.rs +++ b/compiler/test_gen/src/gen_primitives.rs @@ -3397,3 +3397,42 @@ fn issue_2894() { u32 ) } + +#[test] +#[cfg(any(feature = "gen-llvm"))] +fn polymorphic_def_used_in_closure() { + assert_evals_to!( + indoc!( + r#" + a : I64 -> _ + a = \g -> + f = { r: g, h: 32 } + + h1 : U64 + h1 = (\{} -> f.h) {} + h1 + a 1 + "# + ), + 32, + u64 + ) +} + +#[test] +#[cfg(any(feature = "gen-llvm"))] +#[ignore = "This still doesn't work... yet"] +fn polymorphic_lambda_set_usage() { + assert_evals_to!( + indoc!( + r#" + id1 = \x -> x + id2 = \y -> y + id = if True then id1 else id2 + id 9u8 + "# + ), + 9, + u8 + ) +}