diff --git a/base/compiler/abstractinterpretation.jl b/base/compiler/abstractinterpretation.jl index 0ef21bc28fb50..58002602d95a5 100644 --- a/base/compiler/abstractinterpretation.jl +++ b/base/compiler/abstractinterpretation.jl @@ -2021,10 +2021,10 @@ function abstract_call_known(interp::AbstractInterpreter, @nospecialize(f), elseif isa(f, Core.OpaqueClosure) # calling an OpaqueClosure about which we have no information returns no information return CallMeta(typeof(f).parameters[2], Effects(), NoCallInfo()) - elseif f === TypeVar + elseif f === TypeVar && !isvarargtype(argtypes[end]) # Manually look through the definition of TypeVar to # make sure to be able to get `PartialTypeVar`s out. - (la < 2 || la > 4) && return CallMeta(Bottom, EFFECTS_THROWS, NoCallInfo()) + 2 ≤ la ≤ 4 || return CallMeta(Bottom, EFFECTS_THROWS, NoCallInfo()) n = argtypes[2] ub_var = Const(Any) lb_var = Const(Union{}) diff --git a/test/compiler/inference.jl b/test/compiler/inference.jl index 393d8cfd47548..3d7a79bf815b0 100644 --- a/test/compiler/inference.jl +++ b/test/compiler/inference.jl @@ -5130,7 +5130,5 @@ let TV = TypeVar(:T) @test abstract_call_unionall_vararg(some) isa UnionAll end -# Issue #51927 -let 𝕃 = Core.Compiler.fallback_lattice - @test apply_type_tfunc(𝕃, Const(Tuple{Vararg{Any,N}} where N), Int) == Type{NTuple{_A, Any}} where _A -end +# Issue #52613 +@test (code_typed((Any,)) do x; TypeVar(x...); end)[1][2] === TypeVar