Skip to content

Commit

Permalink
fix(Core/typetransforms): unwrapping Type in Union
Browse files Browse the repository at this point in the history
  • Loading branch information
tecosaur committed Oct 13, 2024
1 parent fb1bd40 commit 138ccd1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Core/src/interaction/typetransforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ function typevariants(T::Type)::Vector{Type}
elseif T isa UnionAll || (T isa DataType && T.name.name != :Type)
[T]
elseif T isa Union
Base.uniontypes(T)
Ta = Type[]
for Tu in Base.uniontypes(T)
append!(Ta, typevariants(Tu))
end
Ta
elseif T isa Type{<:Any}
typevariants(first(T.parameters))
else
Expand Down Expand Up @@ -212,7 +216,7 @@ function transformersigs(L::Type{<:DataLoader}, desired::Type)
if Tloader isa TypeVar
Tloader = Tloader.ub
end
if Tout1 == Type{Tin}
if Tout1 == Type{Tin} && Tin isa TypeVar || Tout1 == Type
push!(types, (Tloader, desired, desired))
else
for Tout in typevariants(Tout1)
Expand Down

0 comments on commit 138ccd1

Please sign in to comment.