Skip to content

Commit

Permalink
fix #28900, macro hygiene bug inside keyword arg values (#29043)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Sep 5, 2018
1 parent 8d99356 commit 1fb86d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit 1fb86d2

Please sign in to comment.