diff --git a/stdlib/LinearAlgebra/src/givens.jl b/stdlib/LinearAlgebra/src/givens.jl index c37df41f9567c..4668d5f542a91 100644 --- a/stdlib/LinearAlgebra/src/givens.jl +++ b/stdlib/LinearAlgebra/src/givens.jl @@ -417,7 +417,9 @@ function *(G1::Givens{S}, G2::Givens{T}) where {S,T} TS = promote_type(T, S) Rotation{TS}([convert(AbstractRotation{TS}, G2), convert(AbstractRotation{TS}, G1)]) end -*(G::Givens{T}...) where {T} = Rotation([reverse(G)...]) +function *(G::Givens{T}, Gs::Givens{T}...) where {T} + return Rotation([reverse(Gs)..., G]) +end function *(G::Givens{S}, R::Rotation{T}) where {S,T} TS = promote_type(T, S) Rotation(vcat(convert(AbstractRotation{TS}, R).rotations, convert(AbstractRotation{TS}, G))) diff --git a/test/operators.jl b/test/operators.jl index 46cf6c7526299..715212a80a54f 100644 --- a/test/operators.jl +++ b/test/operators.jl @@ -154,6 +154,13 @@ Base.convert(::Type{T19714}, ::Int) = T19714() Base.promote_rule(::Type{T19714}, ::Type{Int}) = T19714 @test T19714()/1 === 1/T19714() === T19714() +@testset "operators with zero argument" begin + @test_throws(MethodError, +()) + @test_throws(MethodError, *()) + @test isempty(methods(+, ())) + @test isempty(methods(*, ())) +end + # pr #17155 and #33568 @testset "function composition" begin @test (uppercase∘(x->string(x,base=16)))(239487) == "3A77F"