From c4a1f2606de7ac3c9a93957811db96593f1c243c Mon Sep 17 00:00:00 2001 From: Romain Beauxis Date: Sun, 12 Nov 2023 17:03:43 -0600 Subject: [PATCH] Add tests. --- tests/core/types.ml | 6 ++++++ tests/language/type_errors.liq | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/core/types.ml b/tests/core/types.ml index 882d4110f4..9a5d7297d8 100644 --- a/tests/core/types.ml +++ b/tests/core/types.ml @@ -395,3 +395,9 @@ let () = in Typing.(a <: b) + +let () = + for _ = 0 to 20 do + let idx = Random.int 10_000 in + assert (Liquidsoap_lang.Type_base.(var_index (var_name idx) = idx)) + done diff --git a/tests/language/type_errors.liq b/tests/language/type_errors.liq index 24cc90ea07..169c6c7a55 100644 --- a/tests/language/type_errors.liq +++ b/tests/language/type_errors.liq @@ -105,6 +105,20 @@ def f() = incorrect('fallback(transitions=[],transitions=[])') section("FUNCTIONS") + incorrect( + 'def f((x:univ(a)), (y:univ(a))) = 1 end f(123, "aabb")' + ) + correct( + 'def f((x:univ(a)), (y:univ(b))) = 1 end f(123, "aabb")' + ) + + incorrect( + 'def x = (1:univ?) end x + 1' + ) + correct( + 'def x = (1:univ) end x + 1' + ) + # Partial application is not supported anymore incorrect( 'def f(x,y) = y end ignore(f(2))'