Skip to content

Commit

Permalink
accumulate environment in forall loop in subtyping
Browse files Browse the repository at this point in the history
fix #26654, fix #26180, fix #25240
  • Loading branch information
JeffBezanson committed Apr 3, 2018
1 parent a55c280 commit 75ebf28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ static int forall_exists_subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t *e, in
int set = e->Lunions.more;
if (!sub || !set)
break;
save_env(e, &saved, &se);
for (int i = set; i <= lastset; i++)
statestack_set(&e->Lunions, i, 0);
lastset = set - 1;
Expand Down
14 changes: 14 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1259,3 +1259,17 @@ end
let (t, e) = intersection_env(Tuple{Union{Int,Int8}}, Tuple{T} where T)
@test e[1] isa TypeVar
end

# issue #26654
@test !(Ref{Union{Int64, Ref{Number}}} <: Ref{Union{Ref{T}, T}} where T)
@test !(Ref{Union{Int64, Val{Number}}} <: Ref{Union{Val{T}, T}} where T)
@test !(Ref{Union{Ref{Number}, Int64}} <: Ref{Union{Ref{T}, T}} where T)
@test !(Ref{Union{Val{Number}, Int64}} <: Ref{Union{Val{T}, T}} where T)

# issue #26180
@test !(Ref{Union{Ref{Int64}, Ref{Number}}} <: Ref{Ref{T}} where T)
@test !(Ref{Union{Ref{Int64}, Ref{Number}}} <: Ref{Union{Ref{T}, Ref{T}}} where T)

# issue #25240, #26405
f26405(::Type{T}) where {T<:Union{Integer, Missing}} = T
@test f26405(Union{Missing, Int}) == Union{Missing, Int}

0 comments on commit 75ebf28

Please sign in to comment.