Skip to content

Commit

Permalink
fix #39862, error in inference when trying to apply a non-type (#40047)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Mar 16, 2021
1 parent 046e2cf commit 845a52b
Show file tree
Hide file tree
Showing 2 changed files with 6 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 @@ -1144,7 +1144,7 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
end
return allconst ? Const(ty) : Type{ty}
end
istuple = (headtype == Tuple)
istuple = isa(headtype, Type) && (headtype == Tuple)
if !istuple && !isa(headtype, UnionAll)
return Union{}
end
Expand Down
5 changes: 5 additions & 0 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2985,3 +2985,8 @@ g38888() = S38888(Base.inferencebarrier(3), nothing)
# issue #38971
f28971() = (1, [2,3]...)::Tuple{Int,Int,Int}
@test @inferred(Tuple{Int,Vararg{Int}}, f28971()) == (1, 2, 3)

# issue #39862
let f() = sin{Int}()
@test Base.return_types(f, ()) == Any[Union{}]
end

0 comments on commit 845a52b

Please sign in to comment.