diff --git a/base/bool.jl b/base/bool.jl index cef413455db46..c867ede02515d 100644 --- a/base/bool.jl +++ b/base/bool.jl @@ -20,6 +20,10 @@ typemax(::Type{Bool}) = true (|)(x::Bool, y::Bool) = box(Bool,or_int(unbox(Bool,x),unbox(Bool,y))) ($)(x::Bool, y::Bool) = (x!=y) +>>(x::Bool, c::Unsigned) = Int(x) >> c +<<(x::Bool, c::Unsigned) = Int(x) << c +>>>(x::Bool, c::Unsigned) = Int(x) >>> c + signbit(x::Bool) = false sign(x::Bool) = x abs(x::Bool) = x diff --git a/test/int.jl b/test/int.jl index 40b79c726d2ac..cc724bac92173 100644 --- a/test/int.jl +++ b/test/int.jl @@ -190,3 +190,8 @@ end # issue #16700 @test_throws MethodError 1.0 >> 8 + +# PR #16988 +@test true << 2 === 1 << 2 +@test true >> 2 === 1 >> 2 +@test true >>> 2 === 1 >>> 2