Skip to content

Commit

Permalink
Tests for multiple labels
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3kk1d committed Oct 14, 2024
1 parent b242321 commit de85c69
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/Test_MakeTerm.re
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,38 @@ let tests = [
let y : (l=Int) = x in y",
)
}),
test_case("Multiple labels in tuple", `Quick, () => {
exp_check(
Let(
Cast(
Var("x") |> Pat.fresh,
Parens(
Prod([
TupLabel(Label("l") |> Typ.fresh, Int |> Typ.fresh)
|> Typ.fresh,
TupLabel(Label("l2") |> Typ.fresh, String |> Typ.fresh)
|> Typ.fresh,
])
|> Typ.fresh,
)
|> Typ.fresh,
Unknown(Internal) |> Typ.fresh,
)
|> Pat.fresh,
Parens(
Tuple([
TupLabel(Label("l") |> Exp.fresh, Int(32) |> Exp.fresh)
|> Exp.fresh,
TupLabel(Label("l2") |> Exp.fresh, String("") |> Exp.fresh)
|> Exp.fresh,
])
|> Exp.fresh,
)
|> Exp.fresh,
Var("x") |> Exp.fresh,
)
|> Exp.fresh,
{|let x : (l=Int, l2=String) = (l=32, l2="") in x|},
)
}),
];
22 changes: 22 additions & 0 deletions test/Test_Statics.re
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,26 @@ let tests =
)
|> Exp.fresh,
),
fully_consistent_typecheck(
"Labeled tuple with multiple labels",
{|(l=32, l2="")|},
Some(
Prod([
TupLabel(Label("l") |> Typ.fresh, Int |> Typ.fresh) |> Typ.fresh,
TupLabel(Label("l2") |> Typ.fresh, String |> Typ.fresh)
|> Typ.fresh,
])
|> Typ.fresh,
),
Parens(
Tuple([
TupLabel(Label("l") |> Exp.fresh, Int(32) |> Exp.fresh)
|> Exp.fresh,
TupLabel(Label("l2") |> Exp.fresh, String("") |> Exp.fresh)
|> Exp.fresh,
])
|> Exp.fresh,
)
|> Exp.fresh,
),
];

0 comments on commit de85c69

Please sign in to comment.