Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/promotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ xor(x::T, y::T) where {T<:Integer} = no_op_err("xor", T)

(==)(x::T, y::T) where {T<:Number} = x === y
(< )(x::T, y::T) where {T<:Real} = no_op_err("<" , T)
(<=)(x::T, y::T) where {T<:Real} = no_op_err("<=", T)
(<=)(x::T, y::T) where {T<:Real} = (x == y) | (x < y)

rem(x::T, y::T) where {T<:Real} = no_op_err("rem", T)
mod(x::T, y::T) where {T<:Real} = no_op_err("mod", T)
Expand Down
11 changes: 11 additions & 0 deletions test/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,14 @@ end
illtype = Vector{Core._typevar(:T, Union{}, Any)}
@test Returns(illtype) == Returns{DataType}(illtype)
end

@testset "<= (issue #46327)" begin
struct A46327 <: Real end
Base.:(==)(::A46327, ::A46327) = false
Base.:(<)(::A46327, ::A46327) = false
@test !(A46327() <= A46327())
struct B46327 <: Real end
Base.:(==)(::B46327, ::B46327) = true
Base.:(<)(::B46327, ::B46327) = false
@test B46327() <= B46327()
end