Skip to content

Commit

Permalink
Merge pull request #18677 from JuliaLang/jb/fix18672
Browse files Browse the repository at this point in the history
fix #18672, `function f end` in some macro expansions
  • Loading branch information
JeffBezanson authored Sep 26, 2016
2 parents 12f02da + 0b5d5d6 commit 26d6c20
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/macroexpand.scm
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@
;; pick up only function name
(let ((fname (cond ((eq? (car e) '=) (cadr (cadr e)))
((eq? (car e) 'function)
(if (eq? (car (cadr e)) 'tuple)
#f
(cadr (cadr e))))
(cond ((atom? (cadr e)) (cadr e))
((eq? (car (cadr e)) 'tuple) #f)
(else (cadr (cadr e)))))
(else #f))))
(if (symbol? fname)
(list fname)
Expand Down
11 changes: 11 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3610,6 +3610,17 @@ end
@test TestMacroGlobalFunction.ff(1) == 2
@test TestMacroGlobalFunction.gg(1) == 3

# issue #18672
macro x18672()
quote
function f
end
end
end
let
@test isa(@x18672, Function)
end

# issue #14564
@test isa(object_id(Tuple.name.cache), Integer)

Expand Down

0 comments on commit 26d6c20

Please sign in to comment.