Skip to content

Commit 9aa677c

Browse files
mlechuKristofferC
authored andcommitted
Fix linearize of global with complex type (#58611)
(cherry picked from commit 050284c)
1 parent c8a4fd2 commit 9aa677c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/julia-syntax.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4972,7 +4972,7 @@ f(x) = yt(x)
49724972
(if value (error "misplaced \"global\" declaration"))
49734973
(if (or (length= e 2) (atom? (caddr e))) (emit e)
49744974
(let ((rr (make-ssavalue)))
4975-
(emit `(= ,rr ,(caddr e)))
4975+
(emit `(= ,rr ,(compile (caddr e) break-labels #t #f)))
49764976
(emit `(globaldecl ,(cadr e) ,rr))))
49774977
(if (null? (cadr lam))
49784978
(emit `(latestworld))))

test/syntax.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4237,6 +4237,16 @@ end
42374237
@test letf_57470(3) == 5
42384238
@test letT_57470 === Int64
42394239

4240+
end # M57470_sub
4241+
4242+
# lowering globaldecl with complex type
4243+
module M58609
4244+
using Test
4245+
global x::T where T
4246+
global y::Type{<:Number}
4247+
4248+
@test Core.get_binding_type(M58609, :x) === Any
4249+
@test Core.get_binding_type(M58609, :y) == Type{<:Number}
42404250
end
42414251

42424252
# #57574

0 commit comments

Comments
 (0)