From cc0c3d0e2ec57b06435f9a12b8fdec8dab434222 Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Mon, 11 Jul 2016 09:57:11 -0700 Subject: [PATCH] Deprecate no-op transpose fallback instead of error'ing. --- NEWS.md | 8 +++++++- base/deprecated.jl | 9 +++++++++ base/operators.jl | 1 - 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index d4143b0a6b066..7ce558b2f5e78 100644 --- a/NEWS.md +++ b/NEWS.md @@ -237,6 +237,9 @@ Deprecated or removed * `sub` and `slice` have been deprecated in favor of `view` ([#16972]) + * The no-op `transpose` fallback has been deprecated. Consider introducing suitable + `transpose` methods or calling `permutedims(x, [2,1])` ([#13171], [#17075], [#17374]). + [PkgDev]: https://github.com/JuliaLang/PkgDev.jl [#1090]: https://github.com/JuliaLang/julia/issues/1090 @@ -251,6 +254,7 @@ Deprecated or removed [#11196]: https://github.com/JuliaLang/julia/issues/11196 [#11242]: https://github.com/JuliaLang/julia/issues/11242 [#13062]: https://github.com/JuliaLang/julia/issues/13062 +[#13171]: https://github.com/JuliaLang/julia/issues/13171 [#13232]: https://github.com/JuliaLang/julia/issues/13232 [#13338]: https://github.com/JuliaLang/julia/issues/13338 [#13387]: https://github.com/JuliaLang/julia/issues/13387 @@ -299,5 +303,7 @@ Deprecated or removed [#16645]: https://github.com/JuliaLang/julia/issues/16645 [#16731]: https://github.com/JuliaLang/julia/issues/16731 [#16972]: https://github.com/JuliaLang/julia/issues/16972 -[#17266]: https://github.com/JuliaLang/julia/issues/17266 [#17037]: https://github.com/JuliaLang/julia/issues/17037 +[#17075]: https://github.com/JuliaLang/julia/issues/17075 +[#17266]: https://github.com/JuliaLang/julia/issues/17266 +[#17374]: https://github.com/JuliaLang/julia/issues/17374 diff --git a/base/deprecated.jl b/base/deprecated.jl index 10a50952a8cf7..9f0247a809e21 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -784,6 +784,15 @@ function symperm{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, pinv::Vector{Ti}) "Pkg.add(\"SuiteSparse\") to install SuiteSparse on Julia v0.5.")) end +# Deprecate no-op transpose fallback. Please see #13171 and #17075. +function transpose(x) + depwarn(string("the no-op `transpose` fallback is deprecated, and no more specific ", + "`transpose` method for $(typeof(x)) exists. Consider `permutedims(x, [2, 1])` ", + "or writing a specific `transpose(x::$(typeof(x)))` method if appropriate."), + :transpose) + return x +end + # During the 0.5 development cycle, do not add any deprecations below this line # To be deprecated in 0.6 diff --git a/base/operators.jl b/base/operators.jl index 7dc3aa539ab23..91b0e0fd4da37 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -293,7 +293,6 @@ fldmod1{T<:Real}(x::T, y::T) = (fld1(x,y), mod1(x,y)) fldmod1{T<:Integer}(x::T, y::T) = (fld1(x,y), mod1(x,y)) # transpose -transpose(x) = throw(ArgumentError("transpose not implemented for $(typeof(x)). Consider permutedims.")) ctranspose(x) = conj(transpose(x)) conj(x) = x