Skip to content

Commit

Permalink
fix #32121, macro hygiene bug in named tuples
Browse files Browse the repository at this point in the history
(cherry picked from commit d8798be)
(cherry picked from commit d128ca1)
  • Loading branch information
JeffBezanson authored and KristofferC committed Aug 26, 2019
1 parent be954d4 commit 4dc49d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/macroexpand.scm
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,14 @@
(body (cadr e))
(m (caddr e)))
(resolve-expansion-vars-with-new-env body env m parent-scope inarg #t)))
((tuple)
(cons (car e)
(map (lambda (x)
(if (assignment? x)
`(= ,(unescape (cadr x))
,(resolve-expansion-vars-with-new-env x env m parent-scope inarg))
(resolve-expansion-vars-with-new-env x env m parent-scope inarg)))
(cdr e))))

;; todo: trycatch
(else
Expand Down
4 changes: 4 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,10 @@ end
end
end)), :thunk)

# issue #32121
macro id32121(x) x end
@test @id32121((a=1, b=2)) === (a=1, b=2)

# issue #30030
let x = 0
@test (a=1, b=2, c=(x=3)) == (a=1, b=2, c=3)
Expand Down

0 comments on commit 4dc49d8

Please sign in to comment.