From e5614c478259e70ef1fb71b62e93320550c66ca5 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Fri, 13 Nov 2020 23:03:27 +1300 Subject: [PATCH] Add 1.6 to CI (#60) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add 1.6 to CI * Fix symbol representation in Julia 1.6 Julia changes the representation of :(.+) to that :.+ != :(.+)! * Implement ndims for DummyBigInt * Update ci.yml * Update Project.toml * Refactor ndims Co-authored-by: Benoît Legat --- .github/workflows/ci.yml | 3 +++ Project.toml | 2 +- src/rewrite.jl | 13 ++++++++----- test/dummy.jl | 4 +++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e33d402..0ebb401 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,9 @@ jobs: - version: '1' os: ubuntu-latest arch: x64 + # - version: nightly + # os: ubuntu-latest + # arch: x64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/Project.toml b/Project.toml index 04eadf1..bc1d4bf 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MutableArithmetics" uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" authors = ["Gilles Peiffer", "Benoît Legat", "Sascha Timme"] -version = "0.2.11" +version = "0.2.12" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/rewrite.jl b/src/rewrite.jl index f5de2f5..881b0fb 100644 --- a/src/rewrite.jl +++ b/src/rewrite.jl @@ -196,7 +196,7 @@ function _is_decomposable_with_factors(ex) # incorrect. return _is_complex_expr(ex) && ( isempty(ex.args) || - (ex.args[1] != :(.+) && ex.args[1] != :(.-)) + (ex.args[1] != :.+ && ex.args[1] != :.-) ) end @@ -331,7 +331,10 @@ function _rewrite( current_sum === nothing && isempty(left_factors) && isempty(right_factors) && - (inner_factor.args[1] == :(.+) || inner_factor.args[1] == :(.-)) + ( + inner_factor.args[1] == :.+ || + inner_factor.args[1] == :.- + ) ) ) # There are three cases here: @@ -360,13 +363,13 @@ function _rewrite( push!(code.args, new_code) start = 3 end - if inner_factor.args[1] == :- || inner_factor.args[1] == :(.-) + if inner_factor.args[1] == :- || inner_factor.args[1] == :.- minus = !minus end vectorized = ( vectorized || - inner_factor.args[1] == :(.+) || - inner_factor.args[1] == :(.-) + inner_factor.args[1] == :.+ || + inner_factor.args[1] == :.- ) return rewrite_sum( vectorized, diff --git a/test/dummy.jl b/test/dummy.jl index 2bd90a0..8311c32 100644 --- a/test/dummy.jl +++ b/test/dummy.jl @@ -6,8 +6,10 @@ end DummyBigInt(J::UniformScaling) = DummyBigInt(J.λ) # Broadcast -Base.ndims(::Type{DummyBigInt}) = 0 Base.broadcastable(x::DummyBigInt) = Ref(x) +# The version with `DummyBigInt` without `Type` is needed in LinearAlgebra for +# Julia v1.6+. +Base.ndims(::Union{Type{DummyBigInt}, DummyBigInt}) = 0 Base.promote_rule(::Type{DummyBigInt}, ::Type{<:Union{Integer, UniformScaling{<:Integer}}}) = DummyBigInt # `copy` on BigInt returns the same instance anyway