From e66dd8011bb12f3d021ef3f1d42a7c4255453808 Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Fri, 18 Oct 2024 19:46:53 -0400 Subject: [PATCH] Add tests for singleton labeled argument function application --- test/Test_Elaboration.re | 87 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/test/Test_Elaboration.re b/test/Test_Elaboration.re index b492e8c15f..b4cc5b4796 100644 --- a/test/Test_Elaboration.re +++ b/test/Test_Elaboration.re @@ -479,4 +479,91 @@ let elaboration_tests = [ ), ) ), + test_case( + "Singleton labeled argument function application with known type", + `Quick, + () => + alco_check( + {|(fun a=x->x)(a=1)|}, + Ap( + Forward, + Fun( + Tuple([ + TupLabel(Label("a") |> Pat.fresh, Var("x") |> Pat.fresh) + |> Pat.fresh, + ]) + |> Pat.fresh, + Var("x") |> Exp.fresh, + None, + None, + ) + |> Exp.fresh, + Tuple([ + TupLabel(Label("a") |> Exp.fresh, Int(1) |> Exp.fresh) + |> Exp.fresh, + ]) + |> Exp.fresh, + ) + |> Exp.fresh, + dhexp_of_uexp(parse_exp({|(fun a=(x:Int) -> x)(a=1)|})), + ) + ), + test_case( + "Singleton labeled argument function application with no label in ap", + `Quick, + () => + alco_check( + {|(fun a=x->x)(a=1)|}, + Ap( + Forward, + Fun( + Tuple([ + TupLabel(Label("a") |> Pat.fresh, Var("x") |> Pat.fresh) + |> Pat.fresh, + ]) + |> Pat.fresh, + Var("x") |> Exp.fresh, + None, + None, + ) + |> Exp.fresh, + Tuple([ + TupLabel(Label("a") |> Exp.fresh, Int(1) |> Exp.fresh) + |> Exp.fresh, + ]) + |> Exp.fresh, + ) + |> Exp.fresh, + dhexp_of_uexp(parse_exp({|(fun a=(x:Int) -> x)(1)|})), + ) + ), + test_case( + "Singleton labeled argument function application with unknown type", + `Quick, + () => + alco_check( + {|(fun a=x->x)(a=1)|}, + Ap( + Forward, + Fun( + Tuple([ + TupLabel(Label("a") |> Pat.fresh, Var("x") |> Pat.fresh) + |> Pat.fresh, + ]) + |> Pat.fresh, + Var("x") |> Exp.fresh, + None, + None, + ) + |> Exp.fresh, + Tuple([ + TupLabel(Label("a") |> Exp.fresh, Int(1) |> Exp.fresh) + |> Exp.fresh, + ]) + |> Exp.fresh, + ) + |> Exp.fresh, + dhexp_of_uexp(parse_exp({|(fun a=x->x)(a=1)|})), + ) + ), ];