Skip to content

Commit f99741a

Browse files
authored
Merge pull request #660 from JuliaOpt/bl/typepiracy
Fix type piracy
2 parents 03cb091 + c13aded commit f99741a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Utilities/functions.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,10 @@ end
10591059
function Base.:+(args::VectorLike{T}...) where T
10601060
return operate(+, T, args...)
10611061
end
1062-
function Base.:+::Vector{T}, f::VectorLike{T}...) where T
1063-
return operate(+, T, α, f...)
1062+
# Base.:+(α::Vector{T}, f::VectorLike{T}...) is too general as it also covers
1063+
# Base.:+(α::Vector) which is type piracy
1064+
function Base.:+::Vector{T}, f::VectorLike{T}, g::VectorLike{T}...) where T
1065+
return operate(+, T, α, f, g...)
10641066
end
10651067
function Base.:+(f::VectorLike{T}, α::Vector{T}) where T
10661068
return operate(+, T, f, α)

0 commit comments

Comments
 (0)