From 855c277fb5e5f9bfe99140191f3e7121974a1a9e Mon Sep 17 00:00:00 2001 From: Darwin Darakananda Date: Sun, 26 Aug 2018 19:24:54 -0400 Subject: [PATCH 1/3] `repmat` -> `repeat` --- src/Compat.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Compat.jl b/src/Compat.jl index c47ecc051..e3bc9982e 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1859,6 +1859,12 @@ if !isdefined(Base, :selectdim) # 0.7.0-DEV.3976 end end +if VERSION < v"0.7.0-DEV.3977" #26039 + Base.repeat(A::AbstractArray, counts::Integer...) = Base.repmat(A, counts...) + Base.repeat(a::AbstractVecOrMat, m::Integer, n::Integer=1) = Base.repmat(a, m, n) + Base.repeat(a::AbstractVector, m::Integer) = Base.repmat(a, m) +end + if VERSION < v"0.7.0-DEV.2337" # qr doesn't take the full keyword anymore since 0.7.0-DEV.5211; we still support it # here to avoid unneccesary breakage From 570bbae0b437657dfc9a13b7e868afe3eff545aa Mon Sep 17 00:00:00 2001 From: Darwin Darakananda Date: Mon, 27 Aug 2018 21:09:19 -0400 Subject: [PATCH 2/3] Edit README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 679ab15f4..f4f26e743 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Currently, the `@compat` macro supports the following syntaxes: `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. - + * Required keyword arguments ([#25830]). For example, `@compat foo(; x, y)` makes `x` and `y` required keyword arguments: when calling `foo`, an error is thrown if `x` or `y` is not explicitly provided. ## Module Aliases @@ -436,6 +436,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `squeeze` is now `dropdims` ([#28303], [#26660]). +* `repmat` is now `repeat` ([#26039]) + ## New macros * `@__DIR__` has been added ([#18380]) From aadac2489f538edd621e5685acfa1979ec32dc2a Mon Sep 17 00:00:00 2001 From: Darwin Darakananda Date: Mon, 27 Aug 2018 21:32:33 -0400 Subject: [PATCH 3/3] Fix alias and add tests --- src/Compat.jl | 2 +- test/runtests.jl | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Compat.jl b/src/Compat.jl index e3bc9982e..3b17b31ba 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1860,7 +1860,7 @@ if !isdefined(Base, :selectdim) # 0.7.0-DEV.3976 end if VERSION < v"0.7.0-DEV.3977" #26039 - Base.repeat(A::AbstractArray, counts::Integer...) = Base.repmat(A, counts...) + Base.repeat(A::AbstractArray, counts::Integer...) = Base.repeat(A, outer = counts) Base.repeat(a::AbstractVecOrMat, m::Integer, n::Integer=1) = Base.repmat(a, m, n) Base.repeat(a::AbstractVector, m::Integer) = Base.repmat(a, m) end diff --git a/test/runtests.jl b/test/runtests.jl index 7680c91fb..91054b10e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1965,4 +1965,12 @@ if VERSION < v"0.7.0-beta2.143" end end +@test repeat([1, 2], 3) == [1, 2, 1, 2, 1, 2] +@test repeat(1:4, 2) == [1, 2, 3, 4, 1, 2, 3, 4] +@test repeat([1 2; 3 4], 2, 3) == [1 2 1 2 1 2 + 3 4 3 4 3 4 + 1 2 1 2 1 2 + 3 4 3 4 3 4] +@test repeat([1, 2], 1, 2, 3) == [x for x in 1:2, y in 1:2, z in 1:3] + nothing