fix: union/intersection types bugs

This commit is contained in:
Shunsuke Shibayama 2023-03-17 10:18:23 +09:00
parent 3ff0eb8f65
commit fd99524bbe
6 changed files with 93 additions and 12 deletions

View file

@ -12,3 +12,10 @@ print_to_str!|S <: Show|(s: S): Str =
s.to_str()
discard print_to_str!(1)
add1 x: Int = x + 1
then|T|(x: T or NoneType, f: (a: T) -> T) =
match x:
None -> x
(y: T) -> f y
assert then(1, add1) == 2