codon icon indicating copy to clipboard operation
codon copied to clipboard

codon throws error when comparing `union` value with `int` value

Open learnforpractice opened this issue 2 years ago • 0 comments

t3.py

a: Union[int, str] = 123
print(123 == a)
print(a == 123)
codon run t3.py

output:

internal.codon:125:13-75: error: 'str' object has no method '__eq__' with arguments (str, int)
├─ internal.codon:125:13-75: error: during the realization of _get_union_method(union: Union[int,str], method: '__eq__', *args: Tuple[int], **kwargs: KwTuple.N0)
╰─ t3.py:3:7-15: error: during the realization of get_union_method(union: Union[int,str], method: '__eq__', *args: Tuple[int], **kwargs: KwTuple.N0)

learnforpractice avatar Jan 06 '23 09:01 learnforpractice