Skip to content

Commit

Permalink
fix #45494, error in ssa conversion with complex type decl
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.
  • Loading branch information
JeffBezanson committed Sep 12, 2024
1 parent 1eabe90 commit 7ac032e
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 @@ -3977,7 +3977,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 parsed-method-stack 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 @@ -3975,3 +3975,13 @@ module UsingFailedExplicit
using .A: x as x
@test x === 1
end

# issue #45494
begin
local b::Tuple{<:Any} = (0,)
function f45494()
b = b
b
end
end
@test f45494() === (0,)

0 comments on commit 7ac032e

Please sign in to comment.