Skip to content
This repository was archived by the owner on Feb 7, 2019. It is now read-only.

Commit 8f28565

Browse files
committed
Issue #11355 still present
Issue JuliaLang/julia#11355 still a problem.
1 parent 4daa76e commit 8f28565

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src/Traits.jl

+23-19
Original file line numberDiff line numberDiff line change
@@ -496,28 +496,32 @@ end
496496

497497
# TODO issue https://github.com/JuliaLang/julia/issues/11355 and https://github.com/mauro3/Traits.jl/pull/13
498498
# this error-ed on test @test istrait(TT33{String}) on commit 565a4d4c27d59452f
499-
# function find_tvar{T<:Tuple}(sig::Type{T}, tv)
500-
# ns = length(sig)
501-
# out = Int[]
502-
# for i = 1:ns
503-
# @show sig[i], tv
504-
# if length(find_tvar(sig[i], tv))>0
505-
# push!(out,i)
506-
# end
507-
# end
508-
# return out
509-
# end
499+
function find_tvar{T<:Tuple}(sig::Type{T}, tv)
500+
ns = length(sig)
501+
out = Int[]
502+
@show sig, tv
503+
for i = 1:ns
504+
if length(find_tvar(sig[i], tv))>0
505+
push!(out,i)
506+
end
507+
end
508+
return out
509+
end
510510
find_tvar(sig::TypeVar, tv) = sig===tv ? [1] : Int[] # note ===, this is essential!
511511
function find_tvar(arg::DataType, tv)
512512
if arg<:Tuple # TODO issue https://github.com/JuliaLang/julia/issues/11327#issuecomment-103159360
513-
ns = length(arg)
514-
out = Int[]
515-
for i = 1:ns
516-
if length(find_tvar(arg[i], tv))>0
517-
push!(out,i)
518-
end
519-
end
520-
return out
513+
# ns = length(arg)
514+
# out = Int[]
515+
# for i = 1:ns
516+
# if length(find_tvar(arg[i], tv))>0
517+
# push!(out,i)
518+
# end
519+
# end
520+
# return out
521+
@show arg, tv
522+
xdump(arg)
523+
xdump(tv)
524+
error("Dispatch error!")
521525
end
522526
ns = length(arg.parameters)
523527
for i=1:ns

0 commit comments

Comments
 (0)