Skip to content

fix the fix for #32121, more named tuple macro hygiene #32464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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