@@ -7,9 +7,9 @@ export StaticInt, StaticFloat64, StaticSymbol, True, False, StaticBool, NDIndex
77export dynamic, is_static, known, static
88
99@static if VERSION >= v " 1.7.0-DEV.421"
10- using Base: @aggressive_constprop
10+ using Base: @constprop
1111else
12- macro aggressive_constprop ( ex)
12+ macro constprop (_, ex)
1313 ex
1414 end
1515end
@@ -30,7 +30,7 @@ Returns the known value corresponding to a static type `T`. If `T` is not a stat
3030See also: [`static`](@ref), [`is_static`](@ref)
3131"""
3232known
33- @aggressive_constprop known (x) = known (typeof (x))
33+ @constprop :aggressive known (x) = known (typeof (x))
3434known (:: Type{T} ) where {T} = nothing
3535known (:: Type{StaticInt{N}} ) where {N} = N:: Int
3636known (:: Type{StaticFloat64{N}} ) where {N} = N:: Float64
@@ -67,19 +67,19 @@ static(:x)
6767```
6868"""
6969static
70- @aggressive_constprop static (x:: X ) where {X} = ifelse (is_static (X), identity, _no_static_type)(x)
71- @aggressive_constprop static (x:: Int ) = StaticInt (x)
72- @aggressive_constprop static (x:: Union{Int8,UInt8,Int16,UInt16} ) = StaticInt (x % Int)
70+ @constprop :aggressive static (x:: X ) where {X} = ifelse (is_static (X), identity, _no_static_type)(x)
71+ @constprop :aggressive static (x:: Int ) = StaticInt (x)
72+ @constprop :aggressive static (x:: Union{Int8,UInt8,Int16,UInt16} ) = StaticInt (x % Int)
7373@static if sizeof (Int) == 8
74- @aggressive_constprop static (x:: Union{Int32,UInt32} ) = StaticInt (x % Int)
75- @aggressive_constprop static (x:: UInt64 ) = StaticInt (Int (x))
74+ @constprop :aggressive static (x:: Union{Int32,UInt32} ) = StaticInt (x % Int)
75+ @constprop :aggressive static (x:: UInt64 ) = StaticInt (Int (x))
7676else
77- @aggressive_constprop static (x:: UInt32 ) = StaticInt (Int (x))
77+ @constprop :aggressive static (x:: UInt32 ) = StaticInt (Int (x))
7878end
79- @aggressive_constprop static (x:: Float64 ) = StaticFloat64 (x)
80- @aggressive_constprop static (x:: Bool ) = StaticBool (x)
81- @aggressive_constprop static (x:: Symbol ) = StaticSymbol (x)
82- @aggressive_constprop static (x:: Tuple{Vararg{Any}} ) = map (static, x)
79+ @constprop :aggressive static (x:: Float64 ) = StaticFloat64 (x)
80+ @constprop :aggressive static (x:: Bool ) = StaticBool (x)
81+ @constprop :aggressive static (x:: Symbol ) = StaticSymbol (x)
82+ @constprop :aggressive static (x:: Tuple{Vararg{Any}} ) = map (static, x)
8383@generated static (:: Val{V} ) where {V} = static (V)
8484function _no_static_type (@nospecialize (x))
8585 error (" There is no static alternative for type $(typeof (x)) ." )
@@ -102,7 +102,7 @@ is_static(@nospecialize(x::Type{<:Val})) = True()
102102is_static (@nospecialize (x:: Type{<:StaticFloat64} )) = True ()
103103is_static (x:: Type{T} ) where {T} = False ()
104104
105- @aggressive_constprop _tuple_static (:: Type{T} , i) where {T} = is_static (_get_tuple (T, i))
105+ @constprop :aggressive _tuple_static (:: Type{T} , i) where {T} = is_static (_get_tuple (T, i))
106106function is_static (:: Type{T} ) where {N,T<: Tuple{Vararg{Any,N}} }
107107 if all (eachop (_tuple_static, nstatic (Val (N)), T))
108108 return True ()
@@ -119,7 +119,7 @@ Returns the "dynamic" or non-static form of `x`.
119119dynamic (x:: X ) where {X} = _dynamic (is_static (X), x)
120120_dynamic (:: True , x:: X ) where {X} = known (X)
121121_dynamic (:: False , x:: X ) where {X} = x
122- @aggressive_constprop dynamic (x:: Tuple ) = map (dynamic, x)
122+ @constprop :aggressive dynamic (x:: Tuple ) = map (dynamic, x)
123123dynamic (x:: NDIndex ) = CartesianIndex (dynamic (Tuple (x)))
124124
125125end
0 commit comments