Closed kmr-srbh closed 3 months ago
The failing tests are those which checked for the semantic error before. I am pushing new tests.
@certik In CPython 1 == 1.0
returns True
as the value is the same. Should we do something similar, or is it okay to throw an error?
@certik In CPython 1 == 1.0 returns True as the value is the same. Should we do something similar, or is it okay to throw an error?
We currently throw an error because LPython has strict type checking and does not do implicit casting. The design of LPython is such that everything has to be explicitly casted by the user.
I feel this PR is not needed at this moment in LPython. I am temporarily marking this as draft.
Let's close this PR for now. We can reopen later if needed.
Fixes #2593
Comparison on dissimilar types can be handled the way CPython does - return
True
when comparing for inequality andFalse
when comparing for equality. Throw a semantic error when using>
,>=
,<
and<=
.On main branch
Checking equality
Similar error is thrown for other operators.
On local branch
Checking equality
Checking inequality
Checking greater than or equal to (>=) [similar for other operators]