Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix missing field type initialization vars #44797

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ void jl_reinstantiate_inner_types(jl_datatype_t *t) // can throw!
for (i = 0; i < n; i++)
env[i].val = jl_svecref(ndt->parameters, i);

ndt->super = (jl_datatype_t*)inst_type_w_((jl_value_t*)t->super, env, &top, 1);
ndt->super = (jl_datatype_t*)inst_type_w_((jl_value_t*)t->super, &env[n - 1], &top, 1);
jl_gc_wb(ndt, ndt->super);
}

Expand All @@ -1944,7 +1944,7 @@ void jl_reinstantiate_inner_types(jl_datatype_t *t) // can throw!
for (i = 0; i < n; i++)
env[i].val = jl_svecref(ndt->parameters, i);
assert(ndt->types == NULL);
ndt->types = inst_ftypes(t->types, env, &top);
ndt->types = inst_ftypes(t->types, &env[n - 1], &top);
jl_gc_wb(ndt, ndt->types);
if (ndt->isconcretetype) { // cacheable
jl_compute_field_offsets(ndt);
Expand Down
9 changes: 9 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,15 @@ end
#struct S22624{A,B,C} <: Ref{S22624{Int64,A}}; end
@test_broken @isdefined S22624

# issue #42297
mutable struct Node42297{T, V}
value::V
next::Union{Node42297{T, T}, Node42297{T, Val{T}}, Nothing}
Node42297{T}(value) where {T} = new{T, typeof(value)}(value, nothing)
end
@test fieldtype(Node42297{Int,Val{Int}}, 1) === Val{Int}
@test fieldtype(Node42297{Int,Int}, 1) === Int

# issue #3890
mutable struct A3890{T1}
x::Matrix{Complex{T1}}
Expand Down