diff --git a/base/operators.jl b/base/operators.jl index 74cf3e95145a6..1966ae8faf164 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -137,7 +137,7 @@ julia> isequal(missing, missing) true ``` """ -isequal(x, y) = x == y +isequal(x, y) = (x == y)::Bool # all `missing` cases are handled in missing.jl signequal(x, y) = signbit(x)::Bool == signbit(y)::Bool signless(x, y) = signbit(x)::Bool & !signbit(y)::Bool diff --git a/test/operators.jl b/test/operators.jl index d07f3382f53a5..97edebc0ea6f3 100644 --- a/test/operators.jl +++ b/test/operators.jl @@ -81,6 +81,14 @@ import Base.< @test isequal(minmax(TO23094(2), TO23094(1))[1], TO23094(1)) @test isequal(minmax(TO23094(2), TO23094(1))[2], TO23094(2)) +let m = Module() + @eval m begin + struct Foo end + foo(xs) = isequal(xs[1], Foo()) + end + @test !(@inferred m.foo(Any[42])) +end + @test isless('a','b') @testset "isgreater" begin