Skip to content

Commit 64672f5

Browse files
xal-0mlechu
andcommitted
const lowering: resolve scopes under assign-const-if-global
Fixes #57574 Co-authored-by: Em Chu <[email protected]>
1 parent 9a437a5 commit 64672f5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/julia-syntax.scm

+3-1
Original file line numberDiff line numberDiff line change
@@ -3168,7 +3168,9 @@
31683168

31693169
((eq? (car e) 'assign-const-if-global)
31703170
(if (eq? (var-kind (cadr e) scope) 'local)
3171-
(if (length= e 2) (null) `(= ,@(cdr e)))
3171+
(if (length= e 2)
3172+
(null)
3173+
(resolve-scopes- `(= ,@(cdr e)) scope sp loc))
31723174
(resolve-scopes- `(const ,@(cdr e)) scope sp loc)))
31733175
((eq? (car e) 'global-if-global)
31743176
(if (eq? (var-kind (cadr e) scope) 'local)

test/syntax.jl

+13
Original file line numberDiff line numberDiff line change
@@ -4226,3 +4226,16 @@ end
42264226

42274227
end
42284228

4229+
# #57574
4230+
module M57574
4231+
struct A{T} end
4232+
out = let
4233+
for B in ()
4234+
end
4235+
let
4236+
B{T} = A{T}
4237+
B
4238+
end
4239+
end
4240+
end
4241+
@test M57574.out === M57574.A

0 commit comments

Comments
 (0)