Skip to content

Commit

Permalink
Fix #31783 - Incorrect tfunc for apply_type(Union, ::TypeVar, ...) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Apr 22, 2019
1 parent d16efb4 commit c15d984
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
end
else
if !isType(ai)
if !isa(ai, Type) || typeintersect(ai, Type) !== Bottom
if !isa(ai, Type) || typeintersect(ai, Type) !== Bottom || typeintersect(ai, TypeVar) !== Bottom
hasnonType = true
else
return Bottom
Expand Down
7 changes: 7 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6915,3 +6915,10 @@ TupleOf31406(cols::Union{Shape31406,Type}...) = TupleOf31406(collect(Shape31406,
end
true
end

# Issue #31783
struct LL31783{T}
x::T
end
foo31783(tv::TypeVar) = tv.ub == Any ? Union{tv,LL31783{tv}} : tv
@test isa(foo31783(TypeVar(:T)),Union)

0 comments on commit c15d984

Please sign in to comment.