
clojure - issue #94
(ancestors ClassName) does not include tag ancestors of ClassName's superclasses
ancestors does not include the tag parents of a class' superclasses. It therefore is inconsistent with isa?. Interaction example:
;;;;;;;;;;; user=> (ancestors String)
{java.io.Serializable java.lang.Object java.lang.CharSequence
java.lang.Comparable} user=> (ancestors Object) nil user=> (derive String ::foo) nil user=> (derive Object ::bar) nil user=> (isa? String ::foo) true user=> (isa? String ::bar) true user=> (ancestors Object)
{:user/bar}
user=> (ancestors String) ;; should include ::bar!
{java.io.Serializable java.lang.Object java.lang.CharSequence :user/
foo java.lang.Comparable} ;;;;;;;;;;;
I'd expect that ::bar would be included in the set returned by
(ancestors String). A similar interaction involving only keywords shows
that the tag ancestors of a parent are obviously included in the set of
ancestors of a child:
;;;;;;;;;; user=> (derive ::p ::gp) nil user=> (derive ::c ::p) nil user=> (ancestors ::c)
{:user/p :user/gp}
;;;;;;;;;;
The fix appears to be relatively simple, assuming I'm fully understanding the problem. Patch attached.
Comment #1
Posted on Mar 18, 2009 by Massive Dogpatch applied - r1334 - thanks!
Status: Fixed
Labels:
Type-Defect
Priority-Low