diff --git a/src/methods.jl b/src/methods.jl index a8b5645bc..2baef6424 100644 --- a/src/methods.jl +++ b/src/methods.jl @@ -165,6 +165,8 @@ promote_symtype(::typeof(Base.conj), T::Type{<:Number}) = T Base.conj(s::Symbolic{<:Number}) = islike(s, Real) ? s : term(conj, s) promote_symtype(::typeof(Base.imag), T::Type{<:Number}) = Real Base.imag(s::Symbolic{<:Number}) = islike(s, Real) ? zero(symtype(s)) : term(imag, s) +Base.adjoint(s::Symbolic{<:Number}) = conj(s) + ## Booleans diff --git a/test/basics.jl b/test/basics.jl index f40da5e2d..7c29162ef 100644 --- a/test/basics.jl +++ b/test/basics.jl @@ -357,3 +357,11 @@ end end @test repr(sin(x) + sin(x)) == "sin(x) + sin(x)" end + +@testset "Adjoint" begin + @syms x::Real y + ax = adjoint(x) + @test isequal(ax, x) + @test ax === x + @test isequal(adjoint(y), conj(y)) +end