core :: Object :: is_same_type
self
and other
have the same dynamic type.assert 1.is_same_type(2)
assert "Hello".is_same_type("World")
assert not "Hello".is_same_type(2)
The method returns false if the dynamic type of other
is a subtype of the dynamic type of self
(or the other way around).
Unless specific code, you should not use this method because it is inconsistent with the fact that a subclass can be used in lieu of a superclass.
# Return true if `self` and `other` have the same dynamic type.
#
# ~~~
# assert 1.is_same_type(2)
# assert "Hello".is_same_type("World")
# assert not "Hello".is_same_type(2)
# ~~~
#
# The method returns false if the dynamic type of `other` is a subtype of the dynamic type of `self`
# (or the other way around).
#
# Unless specific code, you should not use this method because it is inconsistent
# with the fact that a subclass can be used in lieu of a superclass.
fun is_same_type(other: Object): Bool is intern
lib/core/kernel.nit:94,2--107,48