erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.68k stars 55 forks source link

fix(compiler): runtime type matching system #395

Closed mtshiba closed 1 year ago

mtshiba commented 1 year ago

Fix runtime type matching system and related things.

This patch resolves the following issues:

# this script is now compilable
re = pyimport "re"

badge_pattern = re.compile "a+"
badge_match = badge_pattern.search "aaaa"
match! badge_match:
    (some: re.Match) => print! "matched: \{some.group 0}"
    _ => print! "not matched"