Skip to content

Commit

Permalink
fix #33987, some varargs not recognized in kwarg lowering (#33992)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Dec 2, 2019
1 parent 9478574 commit 2ced6c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/ast.scm
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,17 @@
e)

(define (vararg? x) (and (pair? x) (eq? (car x) '...)))
(define (varargexpr? x) (and
(pair? x)
(eq? (car x) '::)
(or
(eq? (caddr x) 'Vararg)
(and
(pair? (caddr x))
(length> (caddr x) 1)
(eq? (cadr (caddr x)) 'Vararg)))))
(define (vararg-type-expr? x)
(or (eq? x 'Vararg)
(and (length> x 1)
(or (and (eq? (car x) 'curly)
(vararg-type-expr? (cadr x)))
(and (eq? (car x) 'where)
(vararg-type-expr? (cadr x)))))))
(define (varargexpr? x)
(and (pair? x)
(eq? (car x) '::)
(vararg-type-expr? (caddr x))))
(define (linenum? x) (and (pair? x) (eq? (car x) 'line)))

(define (make-assignment l r) `(= ,l ,r))
Expand Down
4 changes: 4 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1965,3 +1965,7 @@ end
let a(; b) = b
@test a(b=3) == 3
end

# issue #33987
f33987(args::(Vararg{Any, N} where N); kwargs...) = args
@test f33987(1,2,3) === (1,2,3)

0 comments on commit 2ced6c4

Please sign in to comment.