Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ Currently, the `@compat` macro supports the following syntaxes:

* `repmat` is now `repeat` ([#26039])

* `range` supports `range(start, stop; length, step)` (`stop` as positional argument)
for Julia 0.7 and 1.0. ([#28708])

## New macros

* `@vectorize_1arg` and `@vectorize_2arg` are deprecated on Julia 0.6 in favor
Expand Down
7 changes: 7 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,9 @@ end
return linspace(start, stop, length)
end
end
elseif VERSION < v"1.0.0-DEV.57"
import LinRange
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this should be import Base: LinRange.

range(start; kwargs...) = Base.range(start; kwargs...)
else
import Base: range, LinRange
end
Expand Down Expand Up @@ -1839,6 +1842,10 @@ if VERSION < v"0.7.0-beta2.143"
end
end

if VERSION ≤ v"1.0" || isempty(methods(range, Tuple{Any,Any}))
range(start, stop; kwargs...) = range(start; stop=stop, kwargs...)
end

include("deprecated.jl")

end # module Compat
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1518,4 +1518,10 @@ end
3 4 3 4 3 4]
@test repeat([1, 2], 1, 2, 3) == [x for x in 1:2, y in 1:2, z in 1:3]

# [1.0, 1.1)
if v"0.7" ≤ VERSION && isempty(methods(range, Tuple{Any,Any}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still has the bogus && isempty(methods(range, Tuple{Any,Any})).

Copy link
Contributor Author

@Nosferican Nosferican Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What replacement do you recommend given that the PR hasn't been merged (can't use a precise v"1.0-xxxx")?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None. We want the tests to be run on all versions (0.7 and up, actually). If you look at the other tests, they don't come with an upper version bound. If Julia is recent enough that Compat doesn't have to do anything, we still test things work as expected/promised.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that would be

if v"0.7" ≤ VERSION

then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. (That's what I tried to say in #633 (comment)).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition should be completely removed now (assuming we succeed in making this work for 0.6).

@test range(0, 5, length = 6) == 0.0:1.0:5.0
@test range(0, 10, step = 2) == 0:2:10
end

nothing