From b848316919ee36c2b1778495afcc5af9cef4724f Mon Sep 17 00:00:00 2001 From: Chris Elrod Date: Sun, 19 Feb 2023 23:37:25 -0500 Subject: [PATCH 1/2] Add oneto(::StaticInt{N}) --- Project.toml | 2 +- src/ranges.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4836eb6..cfcfd5b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Static" uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" authors = ["chriselrod", "ChrisRackauckas", "Tokazama"] -version = "0.8.3" +version = "0.8.4" [deps] IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" diff --git a/src/ranges.jl b/src/ranges.jl index 6a15be8..7d98663 100644 --- a/src/ranges.jl +++ b/src/ranges.jl @@ -144,6 +144,7 @@ An alias for `OptionallyStaticUnitRange` usfeul for statically sized axes. """ const SOneTo{L} = SUnitRange{1, L} SOneTo(n::Int) = SOneTo{n}() +Base.oneto(::StaticInt{N}) where {N} = SOneTo{N}() const OptionallyStaticRange{F, L} = Union{OptionallyStaticUnitRange{F, L}, OptionallyStaticStepRange{F, <:Any, L}} From 3a3069c799d5687175f1f562885180518873a208 Mon Sep 17 00:00:00 2001 From: Chris Elrod Date: Mon, 20 Feb 2023 00:06:01 -0500 Subject: [PATCH 2/2] Disable piracy test to avoid false positive. Example showing that `IntType` seems to be fine: ```julia julia> struct Bar end julia> const MyUnion = Union{Bar,Int} MyUnion (alias for Union{Bar, Int64}) julia> MyUnion(::Int) = throw("uh oh") MyUnion (alias for Union{Bar, Int64}) julia> MyUnion(3) ERROR: "uh oh" Stacktrace: [1] MyUnion(#unused#::Int64) @ Main ./REPL[4]:1 [2] top-level scope @ REPL[5]:1 julia> Int(3) 3 ``` --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 6a068da..95f9a87 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,7 @@ using Static, Aqua using Static: Zero using Test -Aqua.test_all(Static) +Aqua.test_all(Static, piracy = false) @testset "StaticSymbol" begin x = StaticSymbol(:x)