Skip to content

Commit

Permalink
fix #8338, syntax bug in 1-line function def with keyword args
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Sep 15, 2014
1 parent 6260d48 commit cb60fc8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@
(define (keywords-method-def-expr name sparams argl body)
(let* ((kargl (cdar argl)) ;; keyword expressions (= k v)
(pargl (cdr argl)) ;; positional args
(body (if (and (pair? body) (eq? (car body) 'block))
body
`(block ,body)))
;; 1-element list of vararg argument, or empty if none
(vararg (let ((l (if (null? pargl) '() (last pargl))))
(if (vararg? l)
Expand Down
6 changes: 6 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1829,3 +1829,9 @@ end

# issue #8213
@test map((x...)->x,(1,2),(3,4),(5,6)) === ((1,3,5),(2,4,6))

# issue #8338
let ex = Expr(:(=), :(f8338(x;y=4)), :(x*y))
eval(ex)
@test f8338(2) == 8
end

1 comment on commit cb60fc8

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging by all the merge commits, have you had this sitting in your local copy of release-0.3 for 9 months?

edit: wrong commit, meant to post on 2a355ef

Please sign in to comment.