Skip to content

Commit e12020f

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

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
@@ -7324,6 +7324,12 @@ end
73247324
@test isbitstype(X41654)
73257325
@test ('a'=>X41654(),)[1][2] isa X41654
73267326

7327+
# issue #43411
7328+
struct A43411{S, T}
7329+
x::NamedTuple{S, T}
7330+
end
7331+
@test isbitstype(A43411{(:a,), Tuple{Int}})
7332+
73277333
# Issue #34206/34207
73287334
function mre34206(a, n)
73297335
va = view(a, :)

0 commit comments

Comments
 (0)