Skip to content

Commit 050284c

Browse files
authored
Fix linearize of global with complex type (#58611)
1 parent 9108dd0 commit 050284c

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
@@ -5019,7 +5019,7 @@ f(x) = yt(x)
50195019
(if value (error "misplaced \"global\" declaration"))
50205020
(if (or (length= e 2) (atom? (caddr e))) (emit e)
50215021
(let ((rr (make-ssavalue)))
5022-
(emit `(= ,rr ,(caddr e)))
5022+
(emit `(= ,rr ,(compile (caddr e) break-labels #t #f)))
50235023
(emit `(globaldecl ,(cadr e) ,rr))))
50245024
(if (null? (cadr lam))
50255025
(emit `(latestworld))))

test/syntax.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4299,6 +4299,16 @@ end
42994299
@test letf_57470(3) == 5
43004300
@test letT_57470 === Int64
43014301

4302+
end # M57470_sub
4303+
4304+
# lowering globaldecl with complex type
4305+
module M58609
4306+
using Test
4307+
global x::T where T
4308+
global y::Type{<:Number}
4309+
4310+
@test Core.get_binding_type(M58609, :x) === Any
4311+
@test Core.get_binding_type(M58609, :y) == Type{<:Number}
43024312
end
43034313

43044314
# #57574

0 commit comments

Comments
 (0)