From bf0892a0f45fc227e8dcb430719489fc84c5ace8 Mon Sep 17 00:00:00 2001 From: kaandocal <26488673+kaandocal@users.noreply.github.com> Date: Thu, 2 Sep 2021 13:57:36 +0100 Subject: [PATCH 1/2] Fixed promote rule bug --- src/promote.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/promote.jl b/src/promote.jl index fe845060..d2cd49ce 100644 --- a/src/promote.jl +++ b/src/promote.jl @@ -26,7 +26,6 @@ end function promote_rule_constant(::Type{S}, PT::Type{<:APL{T}}) where {S, T} return polynomialtype(PT, promote_type(S, T)) end -Base.promote_rule(::Type{PT}, ::Type{T}) where {T, PT<:APL} = promote_rule_constant(T, PT) Base.promote_rule(::Type{T}, ::Type{PT}) where {T, PT<:APL} = promote_rule_constant(T, PT) # Resolve method ambiguity with Base: Base.promote_rule(::Type{Any}, ::Type{<:APL}) = Any From 6270127ce4659554fd3487d7dab891ddf9756a55 Mon Sep 17 00:00:00 2001 From: kaandocal <> Date: Sat, 9 Apr 2022 11:00:30 +0100 Subject: [PATCH 2/2] Added promote rule test --- test/promote.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/promote.jl b/test/promote.jl index 34426c93..53b6a18f 100644 --- a/test/promote.jl +++ b/test/promote.jl @@ -23,6 +23,8 @@ @test Y[2] == 2x + 4y @test dot(X, [1 2; 3 4] * X) == x^2 + 5x*y + 4y^2 + @test typeof(promote_type(Any, typeof(MP.changecoefficienttype(x + 1, Any)))) == Any + function _t(a, b, T) if VERSION < v"1.6" @test typeof(@inferred vcat(a, b)) in [Vector{T}, Vector{Any}]