From 5c4fc5003a82c8f986fb3be48df85a0d8dd9792a Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Fri, 13 Sep 2024 15:57:19 -0400 Subject: [PATCH] fix #45494, error in ssa conversion with complex type decl (#55744) We were missing a call to `renumber-assigned-ssavalues` in the case where the declared type is used to assert the type of a value taken from a closure box. (cherry picked from commit 2616634a17fdd286e64d16d454bb8077c54d51c9) --- src/julia-syntax.scm | 5 ++++- test/syntax.jl | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 17092ca4cf7519..82140f25253ff7 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -3910,7 +3910,10 @@ f(x) = yt(x) (val (if (equal? typ '(core Any)) val `(call (core typeassert) ,val - ,(cl-convert typ fname lam namemap defined toplevel interp opaq globals locals))))) + ,(let ((convt (cl-convert typ fname lam namemap defined toplevel interp opaq parsed-method-stack globals locals))) + (if (or (symbol-like? convt) (quoted? convt)) + convt + (renumber-assigned-ssavalues convt))))))) `(block ,@(if (eq? box access) '() `((= ,access ,box))) ,undefcheck diff --git a/test/syntax.jl b/test/syntax.jl index 1a2d61e821ef17..4bea07842e3f9a 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -3697,3 +3697,13 @@ module UndefGlobal54954 end using .UndefGlobal54954: theglobal54954 @test Core.get_binding_type(@__MODULE__, :theglobal54954) === Int + +# issue #45494 +begin + local b::Tuple{<:Any} = (0,) + function f45494() + b = b + b + end +end +@test f45494() === (0,)