Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -110,6 +110,9 @@ Currently, the `@compat` macro supports the following syntaxes:
* `using Compat.SparseArrays` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25249]).

* `using Compat.LinearAlgebra` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25571]).

* `using Compat.Random` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#24874]).

Expand Down
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,12 @@ else
import IterativeEigensolvers
end

@static if VERSION < v"0.7.0-DEV.3449"
const LinearAlgebra = Base.LinAlg
Copy link
Member

Choose a reason for hiding this comment

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

Does this work with using/import statements?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes :)

else
import LinearAlgebra
end

if VERSION < v"0.7.0-DEV.3389"
const SparseArrays = Base.SparseArrays
else
Expand Down
2 changes: 1 addition & 1 deletion src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ end
Base.@deprecate_binding AsyncCondition Base.AsyncCondition
Base.@deprecate_binding promote_eltype_op Base.promote_eltype_op
@eval Base.@deprecate_binding $(Symbol("@irrational")) Base.$(Symbol("@irrational"))
@eval Base.@deprecate_binding $(Symbol("@blasfunc")) Base.LinAlg.BLAS.$(Symbol("@blasfunc"))
@eval Base.@deprecate_binding $(Symbol("@blasfunc")) Compat.LinearAlgebra.BLAS.$(Symbol("@blasfunc"))
else
const KERNEL = Sys.KERNEL
const UTF8String = Core.String
Expand Down
8 changes: 7 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Compat
using Compat.Test
using Compat.LinearAlgebra
using Compat.SparseArrays

@test isempty(detect_ambiguities(Base, Core, Compat))
Expand Down Expand Up @@ -712,7 +713,7 @@ end
for T in (Float64, ComplexF32, BigFloat, Int)
λ = T(4)
@test chol(λ*I).λ ≈ √λ
@test_throws Union{ArgumentError,LinAlg.PosDefException} chol(-λ*I)
@test_throws Union{ArgumentError,Compat.LinearAlgebra.PosDefException} chol(-λ*I)
end

let
Expand Down Expand Up @@ -1091,6 +1092,11 @@ using Compat.Random
# 0.7
@test contains("Hello, World!", r"World")

# 0.7.0-DEV.3449
let A = [2.0 1.0; 1.0 3.0], b = [1.0, 2.0], x = [0.2, 0.6]
@test cholfact(A) \ b ≈ x
end

# 0.7.0-DEV.3173
@test invpermute!(permute!([1, 2], 2:-1:1), 2:-1:1) == [1, 2]

Expand Down