Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/typemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static jl_value_t *jl_type_extract_name(jl_value_t *t1 JL_PROPAGATES_ROOT, int i
return jl_type_extract_name(jl_unwrap_vararg(t1), invariant);
}
else if (jl_is_typevar(t1)) {
return jl_type_extract_name(((jl_tvar_t*)t1)->ub, invariant);
return jl_type_extract_name(((jl_tvar_t*)t1)->ub, 0);
}
else if (t1 == jl_bottom_type || t1 == (jl_value_t*)jl_typeofbottom_type || t1 == (jl_value_t*)jl_typeofbottom_type->super) {
return (jl_value_t*)jl_typeofbottom_type->name; // put Union{} and typeof(Union{}) and Type{Union{}} together for convenience
Expand Down
26 changes: 26 additions & 0 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,32 @@ fLargeTable(::Union, ::Union) = "b"
@test length(methods(fLargeTable)) == 205
@test fLargeTable(Union{Int, Missing}, Union{Int, Missing}) == "b"

# issue #58479
fLargeTable(::Type) = "Type"
fLargeTable(::Type{<:DataType}) = "DataType"
@test fLargeTable(Type) == "Type"
@test fLargeTable(DataType) == "DataType"
@test fLargeTable(Type{DataType}) == "DataType"
@test fLargeTable(Type{UnionAll}) == "DataType"
@test fLargeTable(Type{Int}) == "DataType"
@test fLargeTable(Type{Vector}) == "Type"
@test fLargeTable(Type{Type{Union{}}}) == "DataType"
@test fLargeTable(Type{Union{}}) == "Type"
@test fLargeTable(Union{}) == "DataType"
@test fLargeTable(Type{<:DataType}) == "Type"
fLargeTable(::Type{<:UnionAll}) = "UnionAll"
@test fLargeTable(UnionAll) == "UnionAll"
@test fLargeTable(Type{Vector}) == "UnionAll"
@test fLargeTable(Type{Int}) == "DataType"
@test fLargeTable(Type{Type{Union{}}}) == "DataType"
@test fLargeTable(Type{Union{}}) == "Type"
@test_throws MethodError fLargeTable(Union{})
@test fLargeTable(Type{<:DataType}) == "Type"
@test fLargeTable(Type{Vector{T}} where T) == "DataType"
@test fLargeTable(Union{DataType,Type{Vector{T}} where T}) == "DataType"
@test fLargeTable(Union{DataType,UnionAll,Type{Vector{T}} where T}) == "Type"
@test fLargeTable(Union{Type{Vector},Type{Vector{T}} where T}) == "Type"

# issue #15280
function f15280(x) end
@test functionloc(f15280)[2] > 0
Expand Down