Skip to content

Commit c3a63ed

Browse files
JeffBezansonKristofferC
authored andcommitted
fix #43411, wrapped NamedTuple can be bitstype more often (#44311)
(cherry picked from commit f20d5de)
1 parent 1961a6a commit c3a63ed

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/jltypes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ static int layout_uses_free_typevars(jl_value_t *v, jl_typeenv_t *env)
6161
jl_datatype_t *dt = (jl_datatype_t*)v;
6262
if (dt->layout || dt->isconcretetype || !dt->name->mayinlinealloc)
6363
return 0;
64+
if (dt->name == jl_namedtuple_typename)
65+
return layout_uses_free_typevars(jl_tparam0(dt), env) || layout_uses_free_typevars(jl_tparam1(dt), env);
6466
jl_svec_t *types = jl_get_fieldtypes(dt);
6567
size_t i, l = jl_svec_len(types);
6668
for (i = 0; i < l; i++) {

test/core.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7241,6 +7241,12 @@ end
72417241
@test isbitstype(X41654)
72427242
@test ('a'=>X41654(),)[1][2] isa X41654
72437243

7244+
# issue #43411
7245+
struct A43411{S, T}
7246+
x::NamedTuple{S, T}
7247+
end
7248+
@test isbitstype(A43411{(:a,), Tuple{Int}})
7249+
72447250
# Issue #34206/34207
72457251
function mre34206(a, n)
72467252
va = view(a, :)

0 commit comments

Comments
 (0)