fix: dynamic type checking bugs

This commit is contained in:
Shunsuke Shibayama 2023-08-19 16:34:07 +09:00
parent a6b72ea636
commit 5affa5065f
12 changed files with 91 additions and 7 deletions

View file

@ -5,9 +5,9 @@ from _erg_control import then__
class Int(int):
def try_new(i): # -> Result[Nat]
if isinstance(i, int):
Int(i)
return Int(i)
else:
Error("not an integer")
return Error("not an integer")
def succ(self):
return Int(self + 1)