From 1c516dc002cca734c6afd621e765bb97c5b49e86 Mon Sep 17 00:00:00 2001 From: Gabriel Baraldi Date: Mon, 16 Sep 2024 15:58:40 -0300 Subject: [PATCH] Fix hang in tmerge_types_slow (#55757) Fixes https://github.com/JuliaLang/julia/issues/55751 Co-authored-by: Jameson Nash (cherry picked from commit 753296e89ddc484e54937ce7195a3f152fd5a14a) --- base/compiler/typelimits.jl | 1 + test/compiler/inference.jl | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/base/compiler/typelimits.jl b/base/compiler/typelimits.jl index 318ac0b5c27e5..e5133f9aca0bf 100644 --- a/base/compiler/typelimits.jl +++ b/base/compiler/typelimits.jl @@ -815,6 +815,7 @@ end typenames[i] = Any.name simplify[i] = false types[j] = widen + typenames[j] = ijname break end end diff --git a/test/compiler/inference.jl b/test/compiler/inference.jl index f203d411a4424..a849ddbf982a8 100644 --- a/test/compiler/inference.jl +++ b/test/compiler/inference.jl @@ -5671,3 +5671,14 @@ end # fieldcount on `Tuple` should constant fold, even though `.fields` not const @test fully_eliminated(Base.fieldcount, Tuple{Type{Tuple{Nothing, Int, Int}}}) + +# Issue https://github.com/JuliaLang/julia/issues/55751 + +abstract type AbstractGrid55751{T, N} <: AbstractArray{T, N} end +struct Grid55751{T, N, AT} <: AbstractGrid55751{T, N} + axes::AT +end + +t155751 = Union{AbstractArray{UInt8, 4}, Array{Float32, 4}, Grid55751{Float32, 3, _A} where _A} +t255751 = Array{Float32, 3} +@test Core.Compiler.tmerge_types_slow(t155751,t255751) == AbstractArray # shouldn't hang