From 9e8cbe813fc4b290196d292686fd43eeef0923ef Mon Sep 17 00:00:00 2001 From: N5N3 <2642243996@qq.com> Date: Mon, 18 Dec 2023 21:12:45 +0800 Subject: [PATCH] inference: fix `istuple` check in `apply_type_tfunc` --- base/compiler/tfuncs.jl | 2 +- test/compiler/inference.jl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/base/compiler/tfuncs.jl b/base/compiler/tfuncs.jl index bb8712458e0be..a5790c052e24b 100644 --- a/base/compiler/tfuncs.jl +++ b/base/compiler/tfuncs.jl @@ -1743,7 +1743,7 @@ const _tvarnames = Symbol[:_A, :_B, :_C, :_D, :_E, :_F, :_G, :_H, :_I, :_J, :_K, end return allconst ? Const(ty) : Type{ty} end - istuple = isa(headtype, Type) && (headtype == Tuple) + istuple = headtype === Tuple if !istuple && !isa(headtype, UnionAll) && !isvarargtype(headtype) return Union{} end diff --git a/test/compiler/inference.jl b/test/compiler/inference.jl index c71fd3ca9b265..5e302f1743008 100644 --- a/test/compiler/inference.jl +++ b/test/compiler/inference.jl @@ -5609,3 +5609,8 @@ let x = 1, _Any = Any foo27031() = bar27031((x, 1.0), Val{_Any}) @test foo27031() == "OK" 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