From 018a8343eaecaff7350a250fe3d9d8f7c9e8eaf5 Mon Sep 17 00:00:00 2001 From: "Zachary P. Christensen" Date: Sat, 3 Dec 2022 01:21:42 -0500 Subject: [PATCH] Extend `isinteger(::StaticInt)` (#93) --- Project.toml | 2 +- src/Static.jl | 2 ++ test/runtests.jl | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7a9b126..4836eb6 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.2" +version = "0.8.3" [deps] IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" diff --git a/src/Static.jl b/src/Static.jl index 184eed7..db9e291 100644 --- a/src/Static.jl +++ b/src/Static.jl @@ -71,6 +71,8 @@ const IntType = Union{StaticInt, Int} IntType(x::Integer) = Int(x) IntType(@nospecialize x::Union{Int, StaticInt}) = x +Base.isinteger(@nospecialize x::StaticInt) = true + include("float.jl") const StaticNumber{N} = Union{StaticInt{N}, StaticBool{N}, StaticFloat64{N}} diff --git a/test/runtests.jl b/test/runtests.jl index 440a86a..391f95f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -34,6 +34,7 @@ end x = StaticInt(1) y = static(3) + @test isinteger(y) @test @inferred(minmax(x, y)) == @inferred(minmax(y, x)) == minmax(1, 3) @test @inferred(Bool(x)) isa Bool @test @inferred(BigInt(x)) isa BigInt