Skip to content

Commit

Permalink
Drop compat code for dropdims from #618
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent 15342cd commit 28e2fc5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 29 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ Currently, the `@compat` macro supports the following syntaxes:

## Renaming

* `squeeze` is now `dropdims` ([#28303], [#26660]).

## New macros

## Other changes
Expand Down
19 changes: 0 additions & 19 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,6 @@ end
end
end

# https://github.com/JuliaLang/julia/pull/28303
if VERSION < v"0.7.0-beta2.143"
export dropdims
# https://github.com/JuliaLang/julia/pull/26660
if VERSION >= v"0.7.0-DEV.4738"
dropdims(
X;
dims = throw(
UndefKeywordError("dropdims: keyword argument dims not assigned"))
) = squeeze(X, dims = dims)
else
dropdims(
X;
dims = throw(
UndefKeywordError("dropdims: keyword argument dims not assigned"))
) = squeeze(X, dims)
end
end

function rangedepwarn(;step=nothing, length=nothing, kwargs...)
if step===nothing && length===nothing
Base.depwarn("`range(start, stop)` (with neither `length` nor `step` given) is deprecated, use `range(start, stop=stop)` instead.", :range)
Expand Down
8 changes: 8 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1264,3 +1264,11 @@ end
@test floatmin(Float16) == @eval $(Core.Intrinsics.bitcast(Float16, 0x0400))
@test floatmax(Float32) == @eval $(Core.Intrinsics.bitcast(Float32, 0x7f7fffff))
@test floatmin(zero(Float64)) == floatmin(Float64)

# 0.7.0-beta2.143
if VERSION < v"0.7.0-beta2.143"
let a = reshape(Vector(1:4),(2,2,1,1)), b = reshape(Vector(1:4), (2,2,1))
@test dropdims(a; dims=3) == b
@test_throws UndefKeywordError dropdims(a)
end
end
8 changes: 0 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ let
@test_throws UndefKeywordError func5(x=2)
end

# 0.7.0-beta2.143
if VERSION < v"0.7.0-beta2.143"
let a = reshape(Vector(1:4),(2,2,1,1)), b = reshape(Vector(1:4), (2,2,1))
@test dropdims(a; dims=3) == b
@test_throws UndefKeywordError dropdims(a)
end
end

# Support for positional `stop`
@test Compat.range(0, 5, length = 6) == 0.0:1.0:5.0
@test Compat.range(0, 10, step = 2) == 0:2:10
Expand Down

0 comments on commit 28e2fc5

Please sign in to comment.