diff --git a/src/dump.c b/src/dump.c index 472e8752d040e..0a426f688acb6 100644 --- a/src/dump.c +++ b/src/dump.c @@ -257,7 +257,7 @@ static int type_parameter_recursively_external(jl_value_t *p0) JL_NOTSAFEPOINT return 0; if (module_in_worklist(p->name->module)) return 0; - if (p->name->wrapper != (jl_value_t*)p0) { + if (jl_unwrap_unionall(p->name->wrapper) != (jl_value_t*)p) { if (!type_recursively_external(p)) return 0; } @@ -745,7 +745,7 @@ static void jl_serialize_value_(jl_serializer_state *s, jl_value_t *v, int as_li else if (jl_is_unionall(v)) { write_uint8(s->s, TAG_UNIONALL); jl_datatype_t *d = (jl_datatype_t*)jl_unwrap_unionall(v); - if (jl_is_datatype(d) && d->name->wrapper == v && + if (jl_is_datatype(d) && jl_unwrap_unionall(d->name->wrapper) == (jl_value_t*)d && !module_in_worklist(d->name->module)) { write_uint8(s->s, 1); jl_serialize_value(s, d->name->module); diff --git a/test/precompile.jl b/test/precompile.jl index 448fc203ba532..ed93b60bfdd4f 100644 --- a/test/precompile.jl +++ b/test/precompile.jl @@ -744,5 +744,27 @@ let end end +# issue #29936 +let + load_path = mktempdir() + load_cache_path = mktempdir() + try + write(joinpath(load_path, "Foo29936.jl"), + """ + module Foo29936 + const global m = Val{nothing}() + const global h = Val{:hey}() + wab = [("a", m), ("b", h),] + end + """) + pushfirst!(LOAD_PATH, load_path) + pushfirst!(DEPOT_PATH, load_cache_path) + @eval using Foo29936 + @test [("Plan", Foo29936.m), ("Plan", Foo29936.h),] isa Vector{Tuple{String,Val}} + finally + rm(load_path, recursive=true) + rm(load_cache_path, recursive=true) + end +end end # !withenv