Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,10 @@
(stmts (if blk? (cdr (butlast test)) '()))
(test (if blk? (last test) test)))
(if (and (pair? test) (memq (car test) '(&& |\|\||)))
(let ((clauses `(,(car test) ,@(map expand-forms (cdr (flatten-ex (car test) test))))))
(let* ((clauses `(,(car test) ,@(map expand-forms (cdr (flatten-ex (car test) test)))))
(clauses (if (null? (cdr clauses))
(if (eq? (car clauses) '&&) '(true) '(false))
clauses)))
`(if ,(if blk?
`(block ,@(map expand-forms stmts) ,clauses)
clauses)
Expand Down
4 changes: 4 additions & 0 deletions test/cartesian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,7 @@ end

@test @inferred(intersect(I, J)) == CartesianIndices((2:3, 4:5))
end

# issue #39705
f39705() = Base.Cartesian.@nany 0 _ -> true
@test f39705() === false
4 changes: 4 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2707,3 +2707,7 @@ end == 4
@test ncalls_in_lowered(:(.!(1 .< A .< 2)), GlobalRef(Base, :materialize)) == 1
@test ncalls_in_lowered(:((.!)(1 .< A .< 2)), GlobalRef(Base, :materialize)) == 1
end

# issue #39705
@eval f39705(x) = $(Expr(:||)) && x
@test f39705(1) === false