Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add univ type annotation #3524

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests.
toots committed Nov 12, 2023

Verified

This commit was signed with the committer’s verified signature.
paulmueller Paul Müller
commit 30d656c1bbdbc5f1a35c7749c256d227966fad4c
6 changes: 6 additions & 0 deletions tests/core/types.ml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions tests/language/type_errors.liq
Original file line number Diff line number Diff line change
@@ -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))'