Skip to content

Commit 3936c61

Browse files
committed
fix #40742, unset has_concrete_subtype for types like Tuple{:x}
1 parent 7d4876f commit 3936c61

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/jltypes.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,12 @@ void jl_precompute_memoized_dt(jl_datatype_t *dt, int cacheable)
10991099
((!jl_is_kind(p) && ((jl_datatype_t*)p)->isconcretetype) ||
11001100
(((jl_datatype_t*)p)->name == jl_type_typename && !((jl_datatype_t*)p)->hasfreetypevars));
11011101
}
1102+
if (istuple && dt->has_concrete_subtype) {
1103+
if (jl_is_vararg(p))
1104+
p = ((jl_vararg_t*)p)->T;
1105+
if (p && !jl_is_type(p) && !jl_is_typevar(p))
1106+
dt->has_concrete_subtype = 0;
1107+
}
11021108
}
11031109
if (dt->name == jl_type_typename)
11041110
cacheable = 0; // the cache for Type ignores parameter normalization, so it can't be used as a regular hash

test/compiler/inference.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,3 +3270,6 @@ end == [Union{Some{Float64}, Some{Int}, Some{UInt8}}]
32703270
true
32713271
end
32723272
end
3273+
3274+
# issue #40742
3275+
@test code_typed(string, (Vector{Tuple{:x}},))[1][2] === String

0 commit comments

Comments
 (0)