Skip to content

Commit 07c2ecc

Browse files
authored
fix the fix for #32121, more named tuple macro hygiene (#32464)
1 parent a3ac7b9 commit 07c2ecc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/macroexpand.scm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@
419419
(map (lambda (x)
420420
(if (assignment? x)
421421
`(= ,(unescape (cadr x))
422-
,(resolve-expansion-vars-with-new-env x env m parent-scope inarg))
422+
,(resolve-expansion-vars-with-new-env (caddr x) env m parent-scope inarg))
423423
(resolve-expansion-vars-with-new-env x env m parent-scope inarg)))
424424
(cdr e))))
425425

@@ -496,10 +496,17 @@
496496
((and (eq? (car e) '=) (not (function-def? e)))
497497
(append! (filter symbol? (decl-vars* (cadr e)))
498498
(find-assigned-vars-in-expansion (caddr e) #f)))
499+
((eq? (car e) 'tuple)
500+
(apply append! (map (lambda (x)
501+
(find-assigned-vars-in-expansion (if (assignment? x)
502+
(caddr x)
503+
x)
504+
#f))
505+
(cdr e))))
499506
(else
500507
(apply append! (map (lambda (x)
501508
(find-assigned-vars-in-expansion x #f))
502-
e)))))
509+
(cdr e))))))
503510

504511
(define (keywords-introduced-by e)
505512
(let ((v (pattern-expand1 keywords-introduced-by-patterns e)))

test/syntax.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,9 @@ macro id28992(x) x end
18501850

18511851
# issue #32121
18521852
@test @id28992((a=1, b=2)) === (a=1, b=2)
1853+
a32121 = 8
1854+
b32121 = 9
1855+
@test @id28992((a32121=a32121, b32121=b32121)) === (a32121=8, b32121=9)
18531856

18541857
# issue #31596
18551858
f31596(x; kw...) = x

0 commit comments

Comments
 (0)