Skip to content

Commit

Permalink
Add tests for singleton labeled argument function application
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3kk1d committed Oct 18, 2024
1 parent 1bee9bb commit e66dd80
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions test/Test_Elaboration.re
Original file line number Diff line number Diff line change
Expand Up @@ -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)|})),
)
),
];

0 comments on commit e66dd80

Please sign in to comment.