Skip to content

Commit 5c4fc50

Browse files
JeffBezansonKristofferC
authored andcommitted
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 2616634)
1 parent 0e17bd7 commit 5c4fc50

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/julia-syntax.scm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3910,7 +3910,10 @@ f(x) = yt(x)
39103910
(val (if (equal? typ '(core Any))
39113911
val
39123912
`(call (core typeassert) ,val
3913-
,(cl-convert typ fname lam namemap defined toplevel interp opaq globals locals)))))
3913+
,(let ((convt (cl-convert typ fname lam namemap defined toplevel interp opaq parsed-method-stack globals locals)))
3914+
(if (or (symbol-like? convt) (quoted? convt))
3915+
convt
3916+
(renumber-assigned-ssavalues convt)))))))
39143917
`(block
39153918
,@(if (eq? box access) '() `((= ,access ,box)))
39163919
,undefcheck

test/syntax.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3697,3 +3697,13 @@ module UndefGlobal54954
36973697
end
36983698
using .UndefGlobal54954: theglobal54954
36993699
@test Core.get_binding_type(@__MODULE__, :theglobal54954) === Int
3700+
3701+
# issue #45494
3702+
begin
3703+
local b::Tuple{<:Any} = (0,)
3704+
function f45494()
3705+
b = b
3706+
b
3707+
end
3708+
end
3709+
@test f45494() === (0,)

0 commit comments

Comments
 (0)