Actions
Bug #6020
closedUnexpected is_a/kind_of behaviour
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-02-14 trunk 34598) [x86_64-darwin11.3.0]
Backport:
Description
=begin
I've noticed some inconsistent is_a?/kind_of? methods behavior in a very special cases
self.class #=> Object
BasicObject.is_a?(BasicObject) #=> true
Module.is_a?(Module) #=> true
Class.is_a?(Class) #=> true
Object.is_a?(Object) #=> true
BasicObject.is_a?(Module) #=> true
Integer.is_a?(Integer) #=> false
class A; end
A.is_a?(A) #=> false
module B; end
B.is_a?(B) #=> false
class C < Object; end
C.is_a?(C) #=> false
C.is_a?(Object) #=> true
C.is_a?(BasicObject) #=> true
C.is_a?(Module) #=> true
C.is_a?(Class) #=> true
c = C.new
c.is_a?(Module) #=> false
c.is_a?(Class) #=> false
It looks like it's because Class, Module, Object and BasicObject have class Class, superclass is set properly.
Anyway all is logical but not expected.
=end
Actions
Like0
Like0Like0Like0Like0Like0Like0