Skip to content

Commit

Permalink
Drop compat code for CartesianRange in at-compat from #377
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent ebc8817 commit f44606b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 27 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ Please check the list below for the specific syntax you need.

Currently, the `@compat` macro supports the following syntaxes:

* `@compat foo(::CartesianRange{N})` to replace the former
`foo(::CartesianRange{CartesianIndex{N}})` ([#20974]). Note that
`CartesianRange` now has two type parameters, so using them as
fields in other `struct`s requires manual intervention.

## Module Aliases

## New functions, macros, and methods
Expand Down
8 changes: 0 additions & 8 deletions src/compatmacro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ function _compat(ex::Expr)
# Passthrough
return ex
end
if VERSION < v"0.7.0-DEV.880"
if ex.head == :curly && ex.args[1] == :CartesianRange && length(ex.args) >= 2
a = ex.args[2]
if a != :CartesianIndex && !(isa(a, Expr) && a.head == :curly && a.args[1] == :CartesianIndex)
return Expr(:curly, :CartesianRange, Expr(:curly, :CartesianIndex, ex.args[2]))
end
end
end
if VERSION < v"0.7.0-DEV.2562"
if ex.head == :call && ex.args[1] == :finalizer
ex.args[2], ex.args[3] = ex.args[3], ex.args[2]
Expand Down
6 changes: 6 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1295,3 +1295,9 @@ let
@test func5(y=3, x=2) == 6
@test_throws UndefKeywordError func5(x=2)
end

let
@compat cr(::CartesianIndices{2}) = 2
@test cr(CartesianIndices((5, 3))) == 2
@test_throws MethodError cr(CartesianIndices((5, 3, 2)))
end
14 changes: 0 additions & 14 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ for x in (3.1, -17, 3//4, big(111.1), Inf)
@test minmax(x) == (x, x)
end

let
@compat cr(::CartesianIndices{2}) = 2
@test cr(CartesianIndices((5, 3))) == 2
@test_throws MethodError cr(CartesianIndices((5, 3, 2)))
end
if VERSION < v"0.7.0-DEV.880"
# ensure we don't bork any non-updated expressions
let
@compat cr(::CartesianRange{CartesianIndex{2}}) = 2
@test cr(CartesianRange((5, 3))) == 2
@test_throws MethodError cr(CartesianRange((5, 3, 2)))
end
end

# 0.7
let A = [1]
local x = 0
Expand Down

0 comments on commit f44606b

Please sign in to comment.