Skip to content

Commit

Permalink
ameliorate __eq__ when types are not comparable
Browse files Browse the repository at this point in the history
Signed-off-by: rd4com <[email protected]>
  • Loading branch information
rd4com committed Oct 30, 2024
1 parent 919abbc commit a4767f0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions stdlib/src/builtin/object.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -1086,9 +1086,13 @@ struct object(
)
return bool(c)
except e:
print(e)
print("objects are not comparable")
return False
#TODO: re-raise error from _comparison_type_check
# _comparison_op -> _comparison_type_check()
debug_assert(
str(e) == "TypeError: not a valid comparison type",
"expecting error: TypeError: not a valid comparison type"
)
return False

fn __ne__(self, rhs: object) -> Bool:
"""Inequality comparator. This compares the elements of strings
Expand Down

0 comments on commit a4767f0

Please sign in to comment.