@@ -727,11 +727,11 @@ function show_typealias(io::IO, @nospecialize(x::Type))
727
727
end
728
728
729
729
function make_typealiases (@nospecialize (x:: Type ))
730
- Any === x && return Core. svec (), Union{}
731
- x <: Tuple && return Core. svec (), Union{}
730
+ aliases = SimpleVector[]
731
+ Any === x && return aliases, Union{}
732
+ x <: Tuple && return aliases, Union{}
732
733
mods = modulesof! (Set {Module} (), x)
733
734
Core in mods && push! (mods, Base)
734
- aliases = SimpleVector[]
735
735
vars = Dict {Symbol,TypeVar} ()
736
736
xenv = UnionAll[]
737
737
each = Any[]
@@ -783,23 +783,24 @@ function make_typealiases(@nospecialize(x::Type))
783
783
end
784
784
end
785
785
if isempty (aliases)
786
- return Core . svec () , Union{}
786
+ return aliases , Union{}
787
787
end
788
- sort! (aliases, by = x -> x[4 ], rev = true ) # heuristic sort by "best" environment
788
+ sort! (aliases, by = x -> x[4 ]:: Tuple{Int,Int} , rev = true ) # heuristic sort by "best" environment
789
789
let applied = Union{}
790
790
applied1 = Union{}
791
791
keep = SimpleVector[]
792
792
prev = (0 , 0 )
793
793
for alias in aliases
794
- if alias[4 ][1 ] < 2
794
+ alias4 = alias[4 ]:: Tuple{Int,Int}
795
+ if alias4[1 ] < 2
795
796
if ! (alias[3 ] <: applied )
796
797
applied1 = Union{applied1, alias[3 ]}
797
798
push! (keep, alias)
798
799
end
799
- elseif alias[ 4 ] == prev || ! (alias[3 ] <: applied )
800
+ elseif alias4 == prev || ! (alias[3 ] <: applied )
800
801
applied = applied1 = Union{applied1, alias[3 ]}
801
802
push! (keep, alias)
802
- prev = alias[ 4 ]
803
+ prev = alias4
803
804
end
804
805
end
805
806
return keep, applied1
@@ -825,16 +826,17 @@ function show_unionaliases(io::IO, x::Union)
825
826
end
826
827
if first && ! tvar && length (aliases) == 1
827
828
alias = aliases[1 ]
828
- wheres = make_wheres (io, alias[2 ], x)
829
- show_typealias (io, alias[1 ], x, alias[2 ], wheres)
829
+ env = alias[2 ]:: SimpleVector
830
+ wheres = make_wheres (io, env, x)
831
+ show_typealias (io, alias[1 ], x, env, wheres)
830
832
show_wheres (io, wheres)
831
833
else
832
834
for alias in aliases
833
835
print (io, first ? " Union{" : " , " )
834
836
first = false
835
- env = alias[2 ]
836
- wheres = make_wheres (io, alias[ 2 ] , x)
837
- show_typealias (io, alias[1 ], x, alias[ 2 ] , wheres)
837
+ env = alias[2 ]:: SimpleVector
838
+ wheres = make_wheres (io, env , x)
839
+ show_typealias (io, alias[1 ], x, env , wheres)
838
840
show_wheres (io, wheres)
839
841
end
840
842
if tvar
879
881
show (io:: IO , @nospecialize (x:: Type )) = _show_type (io, inferencebarrier (x))
880
882
function _show_type (io:: IO , @nospecialize (x:: Type ))
881
883
if print_without_params (x)
882
- show_type_name (io, unwrap_unionall (x). name)
884
+ show_type_name (io, ( unwrap_unionall (x) :: DataType ). name)
883
885
return
884
886
elseif get (io, :compact , true ) && show_typealias (io, x)
885
887
return
@@ -1006,7 +1008,7 @@ function show_datatype(io::IO, x::DataType, wheres::Vector{TypeVar}=TypeVar[])
1006
1008
end
1007
1009
else
1008
1010
show_type_name (io, x. name)
1009
- show_typeparams (io, parameters, unwrap_unionall (x. name. wrapper). parameters, wheres)
1011
+ show_typeparams (io, parameters, ( unwrap_unionall (x. name. wrapper) :: DataType ). parameters, wheres)
1010
1012
end
1011
1013
end
1012
1014
0 commit comments