mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix: union/intersection types bugs
This commit is contained in:
parent
3ff0eb8f65
commit
fd99524bbe
6 changed files with 93 additions and 12 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue