Commit 5a4d6492 authored by John Zhang's avatar John Zhang

type enforced null reference equality

parent 4f65f3bc
Pipeline #901 failed with stage
in 0 seconds
......@@ -697,7 +697,8 @@ class _mugeneral_reference(object):
))
def __eq__(self, other):
return (self is other) or (self._is_null() and other._is_null())
return (self is other) or \
((self._TYPE == other._TYPE) and (self._is_null() and other._is_null()))
def __str__(self):
if self._is_null():
......
......@@ -183,6 +183,11 @@ def test_null():
assert not nullOpqRef
assert nullOpqRef._is_null()
# type enforced equality
assert nullRef2 != nullOpqRef
assert nullRef2 != MU_VOIDR._null()
assert nullRef2 == Ref2._null()
def test_ref():
# Spec of what ref can do
S = MuStruct("Point", ("x", MU_INT64), ("y", MU_INT64))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment