Skip to content

Commit 747cc66

Browse files
authored
Merge pull request #49 from SciML/revert
Revert "Return `missing` instead of `nothing`." and adjust find_first_eq
2 parents c14c7a0 + 951af7e commit 747cc66

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Static"
22
uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
33
authors = ["chriselrod", "ChrisRackauckas", "Tokazama"]
4-
version = "0.5.6"
4+
version = "0.6.0"
55

66
[deps]
77
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"

src/Static.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ include("tuples.jl")
2626
known(::Type{T})
2727
2828
Returns the known value corresponding to a static type `T`. If `T` is not a static type then
29-
`missing` is returned.
29+
`nothing` is returned.
3030
3131
See also: [`static`](@ref), [`is_static`](@ref)
3232
"""
3333
known
3434
@constprop :aggressive known(x) = known(typeof(x))
35-
known(::Type{T}) where {T} = missing
35+
known(::Type{T}) where {T} = nothing
3636
known(::Type{StaticInt{N}}) where {N} = N::Int
3737
known(::Type{StaticFloat64{N}}) where {N} = N::Float64
3838
known(::Type{StaticSymbol{S}}) where {S} = S::Symbol

src/int.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ end
119119

120120
@inline function maybe_static(f::F, g::G, x) where {F,G}
121121
L = f(x)
122-
if L === missing
122+
if L === nothing
123123
return g(x)
124124
else
125125
return static(L)

src/tuples.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ value is a `StaticInt`.
7373
@generated function find_first_eq(x::X, itr::I) where {X,N,I<:Tuple{Vararg{Any,N}}}
7474
# we avoid incidental code gen when evaluated a tuple of known values by iterating
7575
# through `I.parameters` instead of `known(I)`.
76-
index = ifelse(known(X) === missing, nothing, findfirst(==(X), I.parameters))
76+
index = ifelse(known(X) === nothing, nothing, findfirst(==(X), I.parameters))
7777
if index === nothing
7878
:(Base.Cartesian.@nif $(N + 1) d->(x == getfield(itr, d)) d->(d) d->(nothing))
7979
else

test/runtests.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ using Test
274274
@test @inferred(Static.known(typeof(static(1.0)))) === 1.0
275275
@test @inferred(Static.known(typeof(static(1)))) === 1
276276
@test @inferred(Static.known(typeof(static(:x)))) === :x
277-
@test @inferred(Static.known(typeof(1))) === missing
277+
@test @inferred(Static.known(typeof(1))) === nothing
278278
@test @inferred(Static.known(typeof((static(:x),static(:x))))) === (:x, :x)
279-
@test @inferred(Static.known(typeof((static(:x),:x)))) === (:x, missing)
279+
@test @inferred(Static.known(typeof((static(:x),:x)))) === (:x, nothing)
280280

281281
@test @inferred(Static.dynamic((static(:a), static(1), true))) === (:a, 1, true)
282282
end
@@ -369,7 +369,7 @@ end
369369
# for some reason this can't be inferred when in the "Static.jl" test set
370370
known_length(x) = known_length(typeof(x))
371371
known_length(::Type{T}) where {N,T<:Tuple{Vararg{Any,N}}} = N
372-
known_length(::Type{T}) where {T} = missing
372+
known_length(::Type{T}) where {T} = nothing
373373
maybe_static_length(x) = Static.maybe_static(known_length, length, x)
374374
x = ntuple(+, 10)
375375
y = 1:10

0 commit comments

Comments
 (0)