@@ -973,6 +973,7 @@ function _copy(f, args...)
973973 parevalf, passedargstup = capturescalars (f, args)
974974 return _copy (parevalf, passedargstup... )
975975end
976+ _copy (f) = throw (MethodError (_copy, (f,))) # avoid method ambiguity
976977
977978function _shapecheckbc (f, args... )
978979 _aresameshape (args... ) ? _noshapecheck_map (f, args... ) : _diffshape_broadcast (f, args... )
@@ -1006,10 +1007,6 @@ end
10061007 _copyto! (parevalf, dest, passedsrcargstup... )
10071008end
10081009
1009- struct CapturedScalars{F, Args, Order}
1010- args:: Args
1011- end
1012-
10131010# capturescalars takes a function (f) and a tuple of mixed sparse vectors/matrices and
10141011# broadcast scalar arguments (mixedargs), and returns a function (parevalf, i.e. partially
10151012# evaluated f) and a reduced argument tuple (passedargstup) containing only the sparse
@@ -1024,9 +1021,13 @@ end
10241021# Work around losing Type{T}s as DataTypes within the tuple that makeargs creates
10251022@inline capturescalars (f, mixedargs:: Tuple{Ref{Type{T}}, Vararg{Any}} ) where {T} =
10261023 capturescalars ((args... )-> f (T, args... ), Base. tail (mixedargs))
1024+ @inline capturescalars (f, mixedargs:: Tuple{Ref{Type{T}}, Ref{Type{S}}, Vararg{Any}} ) where {T, S} =
1025+ # This definition is identical to the one above and necessary only for
1026+ # avoiding method ambiguity.
1027+ capturescalars ((args... )-> f (T, args... ), Base. tail (mixedargs))
10271028@inline capturescalars (f, mixedargs:: Tuple{SparseVecOrMat, Ref{Type{T}}, Vararg{Any}} ) where {T} =
10281029 capturescalars ((a1, args... )-> f (a1, T, args... ), (mixedargs[1 ], Base. tail (Base. tail (mixedargs))... ))
1029- @inline capturescalars (f, mixedargs:: Tuple{Union{Ref,AbstractArray{0}}, Ref{Type{T}}, Vararg{Any}} ) where {T} =
1030+ @inline capturescalars (f, mixedargs:: Tuple{Union{Ref,AbstractArray{<:Any, 0}}, Ref{Type{T}}, Vararg{Any}} ) where {T} =
10301031 capturescalars ((args... )-> f (mixedargs[1 ], T, args... ), Base. tail (Base. tail (mixedargs)))
10311032
10321033nonscalararg (:: SparseVecOrMat ) = true
0 commit comments