Skip to content

Commit

Permalink
fix #45494, error in ssa conversion with complex type decl (#55744)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
JeffBezanson authored and KristofferC committed Sep 24, 2024
1 parent 2259c79 commit 578cb0f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,)

0 comments on commit 578cb0f

Please sign in to comment.