Skip to content

Commit

Permalink
fix the fix for #32121, more named tuple macro hygiene (#32464)
Browse files Browse the repository at this point in the history
(cherry picked from commit 07c2ecc)
  • Loading branch information
JeffBezanson authored and KristofferC committed Jul 3, 2019
1 parent 525d4e9 commit 44a224c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/macroexpand.scm
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
(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 (caddr x) env m parent-scope inarg))
(resolve-expansion-vars-with-new-env x env m parent-scope inarg)))
(cdr e))))

Expand Down Expand Up @@ -496,10 +496,17 @@
((and (eq? (car e) '=) (not (function-def? e)))
(append! (filter symbol? (decl-vars* (cadr e)))
(find-assigned-vars-in-expansion (caddr e) #f)))
((eq? (car e) 'tuple)
(apply append! (map (lambda (x)
(find-assigned-vars-in-expansion (if (assignment? x)
(caddr x)
x)
#f))
(cdr e))))
(else
(apply append! (map (lambda (x)
(find-assigned-vars-in-expansion x #f))
e)))))
(cdr e))))))

(define (keywords-introduced-by e)
(let ((v (pattern-expand1 keywords-introduced-by-patterns e)))
Expand Down
3 changes: 3 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,9 @@ macro id28992(x) x end

# issue #32121
@test @id28992((a=1, b=2)) === (a=1, b=2)
a32121 = 8
b32121 = 9
@test @id28992((a32121=a32121, b32121=b32121)) === (a32121=8, b32121=9)

# issue #31596
f31596(x; kw...) = x
Expand Down

0 comments on commit 44a224c

Please sign in to comment.