erg-lang / erg

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

`Int` and `Nat` types cannot calc mod #214

Closed GreasySlug closed 1 month ago

GreasySlug commented 2 years ago

Describe the bug?

When trying to calculate mod with Int and Nat, the cast fails.

Reproducible code

cargo lwr

>>> 1 % 1 # or 1 % -1

Expected result

0

Actual result

TypeError: the subtype constraint in this expression cannot be satisfied:
subtype: {Int(-1), }
supertype: Div((({Int(-1), })))

Additional context

No response

Erg version

0.5.9

Python version

3.10.6

os

Windows 10