diff --git a/src/subtype.c b/src/subtype.c index 841ea17ff3584..4aadeef340440 100644 --- a/src/subtype.c +++ b/src/subtype.c @@ -2750,7 +2750,7 @@ static jl_value_t *intersect_sub_datatype(jl_datatype_t *xd, jl_datatype_t *yd, jl_value_t *isuper = R ? intersect((jl_value_t*)yd, (jl_value_t*)xd->super, e, param) : intersect((jl_value_t*)xd->super, (jl_value_t*)yd, e, param); if (isuper == jl_bottom_type) return jl_bottom_type; - if (jl_nparams(xd) == 0 || jl_nparams(xd->super) == 0) + if (jl_nparams(xd) == 0 || jl_nparams(xd->super) == 0 || !jl_has_free_typevars(xd)) return (jl_value_t*)xd; jl_value_t *super_pattern=NULL; JL_GC_PUSH2(&isuper, &super_pattern); diff --git a/test/subtype.jl b/test/subtype.jl index d528a2230fca9..11589afdf1271 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -1757,3 +1757,10 @@ s26065 = Ref{Tuple{T,Ref{Union{Ref{Tuple{Ref{Union{Ref{Ref{Tuple{Ref{Tuple{Union # issue 36100 @test NamedTuple{(:a, :b), Tuple{Missing, Union{}}} == NamedTuple{(:a, :b), Tuple{Missing, Union{}}} @test Val{Tuple{Missing, Union{}}} === Val{Tuple{Missing, Union{}}} + +# issue #36869 +struct F36869{T, V} <: AbstractArray{Union{T, V}, 1} +end +@testintersect(Tuple{Type{T}, AbstractVector{T}} where T, + Tuple{Union, F36869{Int64, Missing}}, + Tuple{Union, F36869{Int64, Missing}})