diff --git a/README.md b/README.md index f27f035e9..321848940 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `Complex32`, `Complex64`, and `Complex128` are now `ComplexF16`, `ComplexF32`, and `ComplexF64`, respectively ([#24647]). +* `trace` is now `tr`, available as `Compat.tr` (#26365). + * `JULIA_HOME` is now `Sys.BINDIR`, available in the `Compat.Sys` submodule. ([#25102]) * `Associative` is now `AbstractDict` ([#25012]). @@ -546,6 +548,7 @@ includes this fix. Find the minimum version from there. [#26156]: https://github.com/JuliaLang/julia/issues/26156 [#26283]: https://github.com/JuliaLang/julia/issues/26283 [#26316]: https://github.com/JuliaLang/julia/issues/26316 +[#26365]: https://github.com/JuliaLang/julia/issues/26365 [#26369]: https://github.com/JuliaLang/julia/issues/26369 [#26436]: https://github.com/JuliaLang/julia/issues/26436 [#26442]: https://github.com/JuliaLang/julia/issues/26442 diff --git a/src/Compat.jl b/src/Compat.jl index 1f016d37b..c9fcd4a33 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -881,6 +881,14 @@ end export ComplexF64 end +# julia #26365 +@static if isdefined(LinearAlgebra, :tr) + const tr = LinearAlgebra.tr +else + # 0.6 + const tr = LinearAlgebra.trace +end + # 0.7.0-DEV.2915 module Unicode export graphemes, textwidth, isvalid, diff --git a/test/runtests.jl b/test/runtests.jl index 155b801eb..94a3cd494 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -50,6 +50,9 @@ let s = "Koala test: 🐨" end end +# julia#26365 +@test Compat.tr([1 2; 3 5]) == 6 + let x = view(1:10, 2:4) D = Diagonal(x)