Skip to content

Commit f991f5c

Browse files
JeffBezansonKristofferC
authored andcommitted
fix #32121, macro hygiene bug in named tuples
(cherry picked from commit d8798be) (cherry picked from commit d128ca1)
1 parent 3fdb4c0 commit f991f5c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/macroexpand.scm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,14 @@
414414
(body (cadr e))
415415
(m (caddr e)))
416416
(resolve-expansion-vars-with-new-env body env m parent-scope inarg #t)))
417+
((tuple)
418+
(cons (car e)
419+
(map (lambda (x)
420+
(if (assignment? x)
421+
`(= ,(unescape (cadr x))
422+
,(resolve-expansion-vars-with-new-env x env m parent-scope inarg))
423+
(resolve-expansion-vars-with-new-env x env m parent-scope inarg)))
424+
(cdr e))))
417425

418426
;; todo: trycatch
419427
(else

test/syntax.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,10 @@ end
17411741
end
17421742
end)), :thunk)
17431743

1744+
# issue #32121
1745+
macro id32121(x) x end
1746+
@test @id32121((a=1, b=2)) === (a=1, b=2)
1747+
17441748
# issue #30030
17451749
let x = 0
17461750
@test (a=1, b=2, c=(x=3)) == (a=1, b=2, c=3)

0 commit comments

Comments
 (0)