Skip to content
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

fix #28900, macro hygiene bug inside keyword arg values #29043

Merged
merged 1 commit into from
Sep 5, 2018
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
4 changes: 2 additions & 2 deletions src/macroexpand.scm
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,12 @@
;; in keyword arg A=B, don't transform "A"
(unescape (cadr (cadr e))))
,(resolve-expansion-vars- (caddr (cadr e)) env m parent-scope inarg))
,(resolve-expansion-vars- (caddr e) env m parent-scope inarg)))
,(resolve-expansion-vars-with-new-env (caddr e) env m parent-scope inarg)))
(else
`(kw ,(if inarg
(resolve-expansion-vars- (cadr e) env m parent-scope inarg)
(unescape (cadr e)))
,(resolve-expansion-vars- (caddr e) env m parent-scope inarg)))))
,(resolve-expansion-vars-with-new-env (caddr e) env m parent-scope inarg)))))

((let)
(let* ((newenv (new-expansion-env-for e env))
Expand Down
11 changes: 11 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1673,3 +1673,14 @@ end
@test A28593.var.name === :S
@test B28593.var.name === :S
@test C28593.var.name === :S

# issue #28900
macro foo28900(x)
quote
$x
end
end
f28900(; kwarg) = kwarg
let g = @foo28900 f28900(kwarg = x->2x)
@test g(10) == 20
end