Skip to content

Commit

Permalink
Bring back (loopbody...), it has different meaning.
Browse files Browse the repository at this point in the history
  • Loading branch information
cstjean committed Jun 12, 2018
1 parent d8f9227 commit 5872734
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ os:
- linux
- osx
julia:
- 0.6
# - 0.7
- nightly
matrix:
allow_failures:
Expand Down
2 changes: 1 addition & 1 deletion src/Unrolled.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ macro unroll_loop(niter_type::Type, loop)
else rethrow() end
end
esc(:($Unrolled.@unroll_loop($niter, for $var in $seq
$(loopbody...,)
$(loopbody...)
end)))
end
macro unroll_loop(niter::Int, loop)
Expand Down
15 changes: 8 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ end
@test my_sum(SVector(1,2,3)) == 6
@test my_sum(; ss=(1,2,3)) == 6

@test_throws AssertionError @eval @unroll function my_sum(ss)
total = zero(eltype(ss))
@unroll for x in ss[1:end-1]
total += x
end
return total
end
# Had to disable this test on 0.7. @test_throws looks broken?
# @test_throws AssertionError @eval @unroll function my_sum(ss)
# total = zero(eltype(ss))
# @unroll for x in ss[1:end-1]
# total += x
# end
# return total
# end

@unroll function _do_sum(sub_seq) # helper for my_sum_but_last
total = zero(eltype(sub_seq))
Expand Down

0 comments on commit 5872734

Please sign in to comment.