@@ -545,6 +545,12 @@ typeinfo_eltype(typeinfo::Type{<:AbstractArray{T}}) where {T} = eltype(typeinfo)
545545typeinfo_eltype (typeinfo:: Type{<:AbstractDict{K,V}} ) where {K,V} = eltype (typeinfo)
546546typeinfo_eltype (typeinfo:: Type{<:AbstractSet{T}} ) where {T} = eltype (typeinfo)
547547
548+ # This is a fancy way to make de-specialize a call to `typeinfo_implicit(T)`
549+ # which is unfortunately invalidated by Dates
550+ # (https://github.com/JuliaLang/julia/issues/56080)
551+ #
552+ # This makes the call less efficient, but avoids being invalidated by Dates.
553+ _typeinfo_implicit (@nospecialize (T)) = Base. invoke_in_world (Base. tls_world_age (), typeinfo_implicit, T):: Bool
548554
549555# types that can be parsed back accurately from their un-decorated representations
550556function typeinfo_implicit (@nospecialize (T))
@@ -553,9 +559,9 @@ function typeinfo_implicit(@nospecialize(T))
553559 return true
554560 end
555561 return isconcretetype (T) &&
556- ((T <: Array && typeinfo_implicit (eltype (T))) ||
557- ((T <: Tuple || T <: NamedTuple || T <: Pair ) && all (typeinfo_implicit , fieldtypes (T))) ||
558- (T <: AbstractDict && typeinfo_implicit (keytype (T)) && typeinfo_implicit (valtype (T))))
562+ ((T <: Array && _typeinfo_implicit (eltype (T))) ||
563+ ((T <: Tuple || T <: NamedTuple || T <: Pair ) && all (_typeinfo_implicit , fieldtypes (T))) ||
564+ (T <: AbstractDict && _typeinfo_implicit (keytype (T)) && _typeinfo_implicit (valtype (T))))
559565end
560566
561567# X not constrained, can be any iterable (cf. show_vector)
@@ -573,7 +579,7 @@ function typeinfo_prefix(io::IO, X)
573579 if X isa AbstractDict
574580 if eltype_X == eltype_ctx
575581 sprint (show_type_name, typeof (X). name; context= io), false
576- elseif ! isempty (X) && typeinfo_implicit (keytype (X)) && typeinfo_implicit (valtype (X))
582+ elseif ! isempty (X) && _typeinfo_implicit (keytype (X)) && _typeinfo_implicit (valtype (X))
577583 sprint (show_type_name, typeof (X). name; context= io), true
578584 else
579585 sprint (print, typeof (X); context= io), false
@@ -582,7 +588,7 @@ function typeinfo_prefix(io::IO, X)
582588 # Types hard-coded here are those which are created by default for a given syntax
583589 if eltype_X == eltype_ctx
584590 " " , false
585- elseif ! isempty (X) && typeinfo_implicit (eltype_X)
591+ elseif ! isempty (X) && _typeinfo_implicit (eltype_X)
586592 " " , true
587593 elseif print_without_params (eltype_X)
588594 sprint (show_type_name, unwrap_unionall (eltype_X). name; context= io), false # Print "Array" rather than "Array{T,N}"
0 commit comments