Skip to content

Commit

Permalink
fix lowering of <: to handle ... correctly (#26073)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Feb 16, 2018
1 parent 6d8ee74 commit b0303ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1617,10 +1617,6 @@
`(call (top next) ,coll ,state))
,body))))))

;; convert an operator parsed as (op a b) to (call op a b)
(define (syntactic-op-to-call e)
`(call ,(car e) ,@(map expand-forms (cdr e))))

;; wrap `expr` in a function appropriate for consuming values from given ranges
(define (func-for-generator-ranges expr range-exprs)
(let* ((vars (map cadr range-exprs))
Expand Down Expand Up @@ -1927,8 +1923,10 @@
(lambda (e)
(expand-fuse-broadcast (cadr e) (caddr e)))

'|<:| syntactic-op-to-call
'|>:| syntactic-op-to-call
'|<:|
(lambda (e) (expand-forms `(call |<:| ,@(cdr e))))
'|>:|
(lambda (e) (expand-forms `(call |>:| ,@(cdr e))))

'where
(lambda (e) (expand-forms (expand-wheres (cadr e) (cddr e))))
Expand Down
6 changes: 6 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,12 @@ function bar16239()
end
@test bar16239() == 0

# lowering of <: and >:
let args = (Int, Any)
@test <:(args...)
@test >:(reverse(args)...)
end

# issue #25020
@test_throws ParseError Meta.parse("using Colors()")

Expand Down

0 comments on commit b0303ca

Please sign in to comment.