Skip to content

Commit 2479691

Browse files
authored
fix #37677, unreliable lowering of assignments to gensym'd names (#37717)
1 parent 3b55dae commit 2479691

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/ast.scm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@
264264
(define (reset-gensyms)
265265
(set! *current-gensyms* *gensyms*))
266266

267-
(define (some-gensym? x)
268-
(or (gensym? x) (memq x *gensyms*)))
269-
270267
(define make-ssavalue
271268
(let ((ssavalue-counter 0))
272269
(lambda ()

src/julia-syntax.scm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,9 @@
14501450
(loop (cdr lhss)
14511451
(cons L assigned)
14521452
(cdr rhss)
1453-
(cons (make-assignment temp R) stmts)
1453+
(if (symbol? temp)
1454+
(list* (make-assignment temp R) `(local-def ,temp) stmts)
1455+
(cons (make-assignment temp R) stmts))
14541456
(cons (make-assignment L temp) after)
14551457
(cons temp elts)))))))))
14561458

@@ -1468,6 +1470,7 @@
14681470
;; issue #22032
14691471
(let ((temp (gensy)))
14701472
`(block
1473+
(local-def ,temp)
14711474
(= ,temp (call (core getfield) ,t ,i))
14721475
(= ,(car lhs) ,temp)))
14731476
`(= ,(car lhs)
@@ -1664,6 +1667,7 @@
16641667
,body))
16651668
`(scope-block ,body))))
16661669
`(block (= ,coll ,(car itrs))
1670+
(local ,next)
16671671
(= ,next (call (top iterate) ,coll))
16681672
;; TODO avoid `local declared twice` error from this
16691673
;;,@(if outer `((local ,lhs)) '())
@@ -2694,8 +2698,7 @@
26942698
(implicit-globals (if toplevel? nonloc-assigned '()))
26952699
(implicit-locals
26962700
(filter (if toplevel?
2697-
;; make only assigned gensyms implicitly local at top level
2698-
some-gensym?
2701+
(lambda (v) #f) ;; no implicit locals at top level
26992702
(lambda (v) (and (memq (var-kind v scope #t) '(none static-parameter))
27002703
(not (and soft?
27012704
(or (memq v (scope:implicit-globals scope))

0 commit comments

Comments
 (0)