diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e272eaf..f0ad6e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' + - 'lts' - '1' # automatically expands to the latest stable 1.x release of Julia - 'nightly' os: @@ -27,12 +27,12 @@ jobs: version: '1' arch: x86 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v3 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 env: cache-name: cache-artifacts with: @@ -45,9 +45,9 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v5 with: - file: lcov.info + files: lcov.info # docs: # name: Documentation # runs-on: ubuntu-latest diff --git a/Project.toml b/Project.toml index 96a33e9..24b393f 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" test = ["Test", "StaticArrays"] [compat] -julia = "1" +julia = "1.10" Indexing = "1.1" Dictionaries = "0.3, 0.4" StaticArrays = "1" diff --git a/src/SplitApplyCombine.jl b/src/SplitApplyCombine.jl index 11de0d2..ad39f9e 100644 --- a/src/SplitApplyCombine.jl +++ b/src/SplitApplyCombine.jl @@ -7,12 +7,6 @@ import Dictionaries: filterview import Base: merge, merge!, size, IndexStyle, getindex, parent, axes, iterate -# collections -> scalar -if VERSION < v"1.4.0-DEV" - export only - include("only.jl") -end - # collections -> collections export mapmany, mapview, MappedIterator, MappedArray, product, productview, ProductArray, filterview @@ -40,17 +34,4 @@ include("splitdims.jl") include("combinedims.jl") include("invert.jl") -# Silly definitions missing from Base -# (defining them here is piracy) -# =================================== - -if !hasmethod(Base.haskey, (Any, Any)) - Base.haskey(a, i) = i ∈ keys(a) -end - -if VERSION < v"1.2" - keytype(a::AbstractArray) = eltype(keys(a)) - keytype(a) = Base.keytype(a) -end - end # module diff --git a/src/only.jl b/src/only.jl deleted file mode 100644 index c51d1df..0000000 --- a/src/only.jl +++ /dev/null @@ -1,22 +0,0 @@ -function only(iter) - i = iterate(iter) - if i === nothing - throw(ArgumentError("Collection must have exactly one element (input is empty)")) - end - (out, state) = i - if iterate(iter, state) === nothing - return out - else - throw(ArgumentError("Collection must have exactly one element (input contains more than one element)")) - end -end - -function only(::Tuple{}) - throw(ArgumentError("Collection must have exactly one element (input is empty)")) -end -function only(t::Tuple{Any}) - return t[1] -end -function only(::NTuple{N,Any}) where N - throw(ArgumentError("Collection must have exactly one element (input has $N elements)")) -end diff --git a/test/product.jl b/test/product.jl index 276214a..f98bba2 100644 --- a/test/product.jl +++ b/test/product.jl @@ -2,11 +2,7 @@ @test @inferred(product(*, [1,2], [1,2,3]))::Matrix{Int} == [1 2 3; 2 4 6] @test @inferred(product(*, [1.0,2.0], [1,2,3]))::Matrix{Float64} == [1.0 2.0 3.0; 2.0 4.0 6.0] @test isequal(product(*, [1.0,2.0], [1,2,missing]), [1.0 2.0 missing; 2.0 4.0 missing]) - if VERSION >= v"1.1" # can infer same test from v1.1 - @test isequal(@inferred(product(*, [1.0,2.0], [1,2,missing]))::Matrix{Union{Missing, Float64}}, [1.0 2.0 missing; 2.0 4.0 missing]) - else - @test_broken isequal(@inferred(product(*, [1.0,2.0], [1,2,missing]))::Matrix{Union{Missing, Float64}}, [1.0 2.0 missing; 2.0 4.0 missing]) - end + @test isequal(@inferred(product(*, [1.0,2.0], [1,2,missing]))::Matrix{Union{Missing, Float64}}, [1.0 2.0 missing; 2.0 4.0 missing]) @test @inferred(product(+, fill(1), fill(1)))::Array{Int, 0} == fill(2) @test @inferred(product(+, [0,1,2], fill(1)))::Array{Int, 1} == [1,2,3] @@ -20,11 +16,7 @@ end @test @inferred(productview(*, [1,2], [1,2,3]))::ProductArray{Int,2} == [1 2 3; 2 4 6] @test @inferred(productview(*, [1.0,2.0], [1,2,3]))::ProductArray{Float64,2} == [1.0 2.0 3.0; 2.0 4.0 6.0] @test isequal(productview(*, [1.0,2.0], [1,2,missing])::ProductArray, [1.0 2.0 missing; 2.0 4.0 missing]) - if VERSION >= v"1.1" # can infer same test from v1.1 - @test isequal(@inferred(productview(*, [1.0,2.0], [1,2,missing]))::ProductArray{Union{Missing, Float64},2}, [1.0 2.0 missing; 2.0 4.0 missing]) - else - @test_broken isequal(@inferred(productview(*, [1.0,2.0], [1,2,missing]))::ProductArray{Union{Missing, Float64},2}, [1.0 2.0 missing; 2.0 4.0 missing]) - end + @test isequal(@inferred(productview(*, [1.0,2.0], [1,2,missing]))::ProductArray{Union{Missing, Float64},2}, [1.0 2.0 missing; 2.0 4.0 missing]) @test @inferred(productview(+, fill(1), fill(1)))::ProductArray{Int, 0} == fill(2) @test @inferred(productview(+, [0,1,2], fill(1)))::ProductArray{Int, 1} == [1,2,3]