Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commutative arithmetic operation with Bool behaves different when order is different #110

Closed
ytoml opened this issue Sep 1, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ytoml
Copy link
Contributor

ytoml commented Sep 1, 2022

Describe the bug
When trying to some commutative arithmetic operations (like +, *)with Bool, we cannot do it if Bool value is in left hand side.

Reproducible code

Erg interpreter 0.3.2 (tags/?:2143343, 2022/09/01 15:00:27) on aarch64/macos
>>> 1 + True
2
>>> True + 1
Error[#0613]: File <stdin>, line 1, in <module>
1│ True + 1

   ^^^^^^^^
TypeError: the type of `+`::lhs is mismatched:
expected:  ?L(<: Add(?R(: Type (:> Never, <: Obj))[0])(cyclicity: Not))[0]
but found: {%v14: Bool | %v14 == True}
@ytoml ytoml added the bug Something isn't working label Sep 1, 2022
@mtshiba mtshiba closed this as completed in f71024e Sep 1, 2022
mtshiba added a commit that referenced this issue Sep 1, 2022
@mtshiba
Copy link
Member

mtshiba commented Sep 1, 2022

I solved this problem by implementing Add(Bool) on Bool, but I have found another problem related to this.
I will start another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants