Skip to content

Commit d8798be

Browse files
committed
fix #32121, macro hygiene bug in named tuples
1 parent 6da7aa8 commit d8798be

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,6 +1848,9 @@ macro id28992(x) x end
18481848
@test @id28992(2 ^ -2) == 0.25
18491849
@test @id28992(2 .^ -2) == 0.25
18501850

1851+
# issue #32121
1852+
@test @id28992((a=1, b=2)) === (a=1, b=2)
1853+
18511854
# issue #31596
18521855
f31596(x; kw...) = x
18531856
@test f31596((a=1,), b = 1.0) === (a=1,)

0 commit comments

Comments
 (0)