Skip to content

Commit

Permalink
fix JuliaLang#43411, wrapped NamedTuple can be bitstype more often (J…
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Feb 24, 2022
1 parent 21e5a26 commit f20d5de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ static int layout_uses_free_typevars(jl_value_t *v, jl_typeenv_t *env)
jl_datatype_t *dt = (jl_datatype_t*)v;
if (dt->layout || dt->isconcretetype || !dt->name->mayinlinealloc)
return 0;
if (dt->name == jl_namedtuple_typename)
return layout_uses_free_typevars(jl_tparam0(dt), env) || layout_uses_free_typevars(jl_tparam1(dt), env);
jl_svec_t *types = jl_get_fieldtypes(dt);
size_t i, l = jl_svec_len(types);
for (i = 0; i < l; i++) {
Expand Down
6 changes: 6 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7324,6 +7324,12 @@ end
@test isbitstype(X41654)
@test ('a'=>X41654(),)[1][2] isa X41654

# issue #43411
struct A43411{S, T}
x::NamedTuple{S, T}
end
@test isbitstype(A43411{(:a,), Tuple{Int}})

# Issue #34206/34207
function mre34206(a, n)
va = view(a, :)
Expand Down

0 comments on commit f20d5de

Please sign in to comment.