@@ -695,7 +695,10 @@ function show_can_elide(p::TypeVar, wheres::Vector, elide::Int, env::SimpleVecto
695
695
return true
696
696
end
697
697
698
- function show_typeparams (io:: IO , env:: SimpleVector , orig:: SimpleVector , wheres:: Vector )
698
+ show_typeparams (io:: IO , env:: SimpleVector , orig:: SimpleVector , wheres:: Vector ) =
699
+ show (io, string_typeparams (io, env, orig, wheres))
700
+
701
+ function string_typeparams (io:: IO , env:: SimpleVector , orig:: SimpleVector , wheres:: Vector )
699
702
n = length (env)
700
703
elide = length (wheres)
701
704
function egal_var (p:: TypeVar , @nospecialize o)
@@ -716,29 +719,31 @@ function show_typeparams(io::IO, env::SimpleVector, orig::SimpleVector, wheres::
716
719
end
717
720
end
718
721
end
719
- if n > 0
720
- print (io, " {" )
721
- for i = 1 : n
722
- p = env[i]
723
- if p isa TypeVar
724
- if p. lb === Union{} && something (findfirst (@nospecialize (w) -> w === p, wheres), 0 ) > elide
725
- print (io, " <:" )
726
- show (io, p. ub)
727
- elseif p. ub === Any && something (findfirst (@nospecialize (w) -> w === p, wheres), 0 ) > elide
728
- print (io, " >:" )
729
- show (io, p. lb)
722
+
723
+ s_result = if n > 0
724
+ params_string = join (
725
+ map (1 : n) do i
726
+ p = env[i]
727
+ suffix = i < n ? " , " : " "
728
+ if p isa TypeVar
729
+ if p. lb === Union{} && something (findfirst (@nospecialize (w) -> w === p, wheres), 0 ) > elide
730
+ string (" <:" , p. ub, suffix)
731
+ elseif p. ub === Any && something (findfirst (@nospecialize (w) -> w === p, wheres), 0 ) > elide
732
+ string (" >:" , p. lb, suffix)
733
+ else
734
+ string (p, suffix)
735
+ end
730
736
else
731
- show (io, p )
737
+ string (p, suffix )
732
738
end
733
- else
734
- show (io, p)
735
739
end
736
- i < n && print (io, " , " )
737
- end
738
- print (io, " }" )
740
+ )
741
+ string (" {" , params_string, " }" )
742
+ else
743
+ " "
739
744
end
740
745
resize! (wheres, elide)
741
- nothing
746
+ return s_result
742
747
end
743
748
744
749
function show_typealias (io:: IO , name:: GlobalRef , x:: Type , env:: SimpleVector , wheres:: Vector )
0 commit comments