@@ -507,7 +507,7 @@ function instances end
507
507
508
508
# subtypes
509
509
function _subtypes (m:: Module , x:: Union{DataType,UnionAll} ,
510
- sts= Set {Union{DataType,UnionAll}} (), visited= Set {Module} ())
510
+ sts= ObjectIdDict (), visited= Set {Module} ())
511
511
push! (visited, m)
512
512
xt = unwrap_unionall (x)
513
513
if ! isa (xt, DataType)
@@ -521,7 +521,7 @@ function _subtypes(m::Module, x::Union{DataType,UnionAll},
521
521
t = t:: DataType
522
522
if t. name. name === s && supertype (t). name == xt. name
523
523
ti = typeintersect (t, x)
524
- ti != Bottom && push! (sts, ti)
524
+ ti != Bottom && push! (sts, ti=> true )
525
525
end
526
526
elseif isa (t, UnionAll)
527
527
t = t:: UnionAll
@@ -530,7 +530,7 @@ function _subtypes(m::Module, x::Union{DataType,UnionAll},
530
530
tt = tt:: DataType
531
531
if tt. name. name === s && supertype (tt). name == xt. name
532
532
ti = typeintersect (t, x)
533
- ti != Bottom && push! (sts, ti)
533
+ ti != Bottom && push! (sts, ti=> true )
534
534
end
535
535
elseif isa (t, Module)
536
536
t = t:: Module
@@ -544,14 +544,14 @@ end
544
544
function _subtypes_in (mods:: Array , x:: Union{DataType,UnionAll} )
545
545
if ! isabstract (x)
546
546
# Fast path
547
- return Union{DataType,UnionAll} []
547
+ return Any []
548
548
end
549
- sts = Set {Union{DataType,UnionAll}} ()
549
+ sts = ObjectIdDict ()
550
550
visited = Set {Module} ()
551
551
for m in mods
552
552
_subtypes (m, x, sts, visited)
553
553
end
554
- return sort! (collect (sts), by= string)
554
+ return sort! (collect (Any, keys ( sts) ), by= string)
555
555
end
556
556
557
557
subtypes (m:: Module , x:: Union{DataType,UnionAll} ) = _subtypes_in ([m], x)
0 commit comments