From ea8d1dbecb808e4937688b359f91a4f1055a31ea Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 8 Feb 2018 11:35:37 -0500 Subject: [PATCH] fix lowering of `<:` to handle `...` correctly --- src/julia-syntax.scm | 10 ++++------ test/syntax.jl | 6 ++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 754b0f470b41c..a46c6ff628d27 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -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)) @@ -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)))) diff --git a/test/syntax.jl b/test/syntax.jl index 272bae8241e96..fbe6ba8f850bb 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -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()")