87
87
ifelse (:: True , @nospecialize (x), @nospecialize (y)) = x
88
88
ifelse (:: False , @nospecialize (x), @nospecialize (y)) = y
89
89
90
- StaticInt (x:: False ) = Zero ()
91
- StaticInt (x:: True ) = One ()
92
- Base. Bool (:: True ) = true
93
- Base. Bool (:: False ) = false
94
-
95
90
const Zero = StaticInt{0 }
96
91
const One = StaticInt{1 }
97
92
const FloatOne = StaticFloat64{one (Float64)}
98
93
const FloatZero = StaticFloat64{zero (Float64)}
99
94
100
95
const StaticType{T} = Union{StaticNumber{T}, StaticSymbol{T}}
101
96
97
+ StaticInt (x:: False ) = Zero ()
98
+ StaticInt (x:: True ) = One ()
99
+ Base. Bool (:: True ) = true
100
+ Base. Bool (:: False ) = false
101
+
102
102
Base. eltype (@nospecialize (T:: Type{<:StaticFloat64} )) = Float64
103
103
Base. eltype (@nospecialize (T:: Type{<:StaticInt} )) = Int
104
104
Base. eltype (@nospecialize (T:: Type{<:StaticBool} )) = Bool
@@ -423,8 +423,6 @@ Base.xor(x::Union{Integer, Missing}, ::StaticInteger{Y}) where {Y} = xor(x, Y)
423
423
Base.:(! )(:: True ) = False ()
424
424
Base.:(! )(:: False ) = True ()
425
425
426
- Base. real (@nospecialize (x:: StaticNumber )) = known (x)
427
-
428
426
Base. all (:: Tuple{Vararg{True}} ) = true
429
427
Base. all (:: Tuple{Vararg{Union{True, False}}} ) = false
430
428
Base. all (:: Tuple{Vararg{False}} ) = false
@@ -433,6 +431,10 @@ Base.any(::Tuple{Vararg{True}}) = true
433
431
Base. any (:: Tuple{Vararg{Union{True, False}}} ) = true
434
432
Base. any (:: Tuple{Vararg{False}} ) = false
435
433
434
+ Base. real (@nospecialize (x:: StaticNumber )) = x
435
+ Base. real (@nospecialize (T:: Type{<:StaticNumber} )) = eltype (T)
436
+ Base. imag (@nospecialize (x:: StaticNumber )) = zero (x)
437
+
436
438
"""
437
439
field_type(::Type{T}, f)
438
440
@@ -590,7 +592,7 @@ value is a `StaticInt`.
590
592
end
591
593
end
592
594
593
- function Base. invperm (p:: Tuple{StaticInt,Vararg{StaticInt,N}} ) where {N}
595
+ function Base. invperm (p:: Tuple{StaticInt, Vararg{StaticInt, N}} ) where {N}
594
596
map (Base. Fix2 (find_first_eq, p), ntuple (static, StaticInt (N + 1 )))
595
597
end
596
598
0 commit comments