@@ -219,12 +219,12 @@ Base.similar(::Broadcasted{ArrayConflict}, ::Type{ElType}, dims) where ElType =
219
219
Base. similar (:: Broadcasted{ArrayConflict} , :: Type{Bool} , dims) =
220
220
similar (BitArray, dims)
221
221
222
- @inline Base. axes (bc:: Broadcasted ) = _axes (bc, bc. axes)
222
+ Base. axes (bc:: Broadcasted ) = _axes (bc, bc. axes)
223
223
_axes (:: Broadcasted , axes:: Tuple ) = axes
224
- @inline _axes (bc:: Broadcasted , :: Nothing ) = combine_axes (bc. args... )
224
+ _axes (bc:: Broadcasted , :: Nothing ) = combine_axes (bc. args... )
225
225
_axes (bc:: Broadcasted{<:AbstractArrayStyle{0}} , :: Nothing ) = ()
226
226
227
- @inline Base. axes (bc:: Broadcasted{<:Any, <:NTuple{N}} , d:: Integer ) where N =
227
+ Base. axes (bc:: Broadcasted{<:Any, <:NTuple{N}} , d:: Integer ) where N =
228
228
d <= N ? axes (bc)[d] : OneTo (1 )
229
229
230
230
BroadcastStyle (:: Type{<:Broadcasted{Style}} ) where {Style} = Style ()
@@ -234,7 +234,7 @@ BroadcastStyle(::Type{<:Broadcasted{S}}) where {S<:Union{Nothing,Unknown}} =
234
234
argtype (:: Type{Broadcasted{Style,Axes,F,Args}} ) where {Style,Axes,F,Args} = Args
235
235
argtype (bc:: Broadcasted ) = argtype (typeof (bc))
236
236
237
- @inline Base. eachindex (bc:: Broadcasted ) = _eachindex (axes (bc))
237
+ Base. eachindex (bc:: Broadcasted ) = _eachindex (axes (bc))
238
238
_eachindex (t:: Tuple{Any} ) = t[1 ]
239
239
_eachindex (t:: Tuple ) = CartesianIndices (t)
240
240
@@ -289,7 +289,7 @@ Custom [`BroadcastStyle`](@ref)s may override this default in cases where it is
289
289
to compute and verify the resulting `axes` on-demand, leaving the `axis` field
290
290
of the `Broadcasted` object empty (populated with [`nothing`](@ref)).
291
291
"""
292
- @inline function instantiate (bc:: Broadcasted{Style} ) where {Style}
292
+ function instantiate (bc:: Broadcasted{Style} ) where {Style}
293
293
if bc. axes isa Nothing # Not done via dispatch to make it easier to extend instantiate(::Broadcasted{Style})
294
294
axes = combine_axes (bc. args... )
295
295
else
@@ -351,8 +351,8 @@ _isflat(args::NestedTuple) = false
351
351
_isflat (args:: Tuple ) = _isflat (tail (args))
352
352
_isflat (args:: Tuple{} ) = true
353
353
354
- cat_nested (t:: Broadcasted , rest... ) = (cat_nested (t. args... )... , cat_nested (rest... )... )
355
- cat_nested (t:: Any , rest... ) = (t, cat_nested (rest... )... )
354
+ cat_nested (t:: Broadcasted , rest:: Vararg{Any,N} ) where {N} = (cat_nested (t. args... )... , cat_nested (rest... )... )
355
+ cat_nested (t:: Any , rest:: Vararg{Any,N} ) where {N} = (t, cat_nested (rest... )... )
356
356
cat_nested () = ()
357
357
358
358
"""
@@ -371,7 +371,9 @@ by `t`).
371
371
@inline make_makeargs (makeargs_tail, t:: Tuple{} ) = makeargs_tail
372
372
@inline function make_makeargs (makeargs_tail, t:: Tuple )
373
373
makeargs = make_makeargs (makeargs_tail, tail (t))
374
- (head, tail... )-> (head, makeargs (tail... )... )
374
+ return @inline function (head, tail:: Vararg{Any,N} ) where {N}
375
+ (head, makeargs (tail... )... )
376
+ end
375
377
end
376
378
function make_makeargs (makeargs_tail, t:: Tuple{<:Broadcasted, Vararg{Any}} )
377
379
bc = t[1 ]
@@ -447,7 +449,7 @@ function combine_styles end
447
449
combine_styles () = DefaultArrayStyle {0} ()
448
450
combine_styles (c) = result_style (BroadcastStyle (typeof (c)))
449
451
combine_styles (c1, c2) = result_style (combine_styles (c1), combine_styles (c2))
450
- @inline combine_styles (c1, c2, cs... ) = result_style (combine_styles (c1), combine_styles (c2, cs... ))
452
+ combine_styles (c1, c2, cs:: Vararg{Any,N} ) where {N} = result_style (combine_styles (c1), combine_styles (c2, cs... ))
451
453
452
454
"""
453
455
result_style(s1::BroadcastStyle[, s2::BroadcastStyle]) -> BroadcastStyle
@@ -508,13 +510,13 @@ julia> Broadcast.combine_axes(1, 1, 1)
508
510
()
509
511
```
510
512
"""
511
- @inline combine_axes (A, B... ) = broadcast_shape (axes (A), combine_axes (B... ))
512
- @inline combine_axes (A, B) = broadcast_shape (axes (A), axes (B))
513
+ combine_axes (A, B:: Vararg{Any,N} ) where {N} = broadcast_shape (axes (A), combine_axes (B... ))
514
+ combine_axes (A, B) = broadcast_shape (axes (A), axes (B))
513
515
combine_axes (A) = axes (A)
514
516
515
517
# shape (i.e., tuple-of-indices) inputs
516
518
broadcast_shape (shape:: Tuple ) = shape
517
- broadcast_shape (shape:: Tuple , shape1:: Tuple , shapes:: Tuple... ) = broadcast_shape (_bcs (shape, shape1), shapes... )
519
+ broadcast_shape (shape:: Tuple , shape1:: Tuple , shapes:: Vararg{ Tuple,N} ) where {N} = broadcast_shape (_bcs (shape, shape1), shapes... )
518
520
# _bcs consolidates two shapes into a single output shape
519
521
_bcs (:: Tuple{} , :: Tuple{} ) = ()
520
522
_bcs (:: Tuple{} , newshape:: Tuple ) = (newshape[1 ], _bcs ((), tail (newshape))... )
@@ -553,9 +555,9 @@ function check_broadcast_shape(shp, Ashp::Tuple)
553
555
_bcsm (shp[1 ], Ashp[1 ]) || throw (DimensionMismatch (" array could not be broadcast to match destination" ))
554
556
check_broadcast_shape (tail (shp), tail (Ashp))
555
557
end
556
- @inline check_broadcast_axes (shp, A) = check_broadcast_shape (shp, axes (A))
558
+ check_broadcast_axes (shp, A) = check_broadcast_shape (shp, axes (A))
557
559
# comparing many inputs
558
- @inline function check_broadcast_axes (shp, A, As... )
560
+ function check_broadcast_axes (shp, A, As:: Vararg{Any,N} ) where {N}
559
561
check_broadcast_axes (shp, A)
560
562
check_broadcast_axes (shp, As... )
561
563
end
@@ -585,21 +587,21 @@ Base.@propagate_inbounds _newindex(ax::Tuple, I::Tuple{}) = (ax[1][1], _newindex
585
587
Base. @propagate_inbounds _newindex (ax:: Tuple{} , I:: Tuple{} ) = ()
586
588
587
589
# If dot-broadcasting were already defined, this would be `ifelse.(keep, I, Idefault)`.
588
- @inline newindex (I:: CartesianIndex , keep, Idefault) = CartesianIndex (_newindex (I. I, keep, Idefault))
589
- @inline newindex (i:: Integer , keep:: Tuple , idefault) = ifelse (keep[1 ], i, idefault[1 ])
590
- @inline newindex (i:: Integer , keep:: Tuple{} , idefault) = CartesianIndex (())
591
- @inline _newindex (I, keep, Idefault) =
590
+ newindex (I:: CartesianIndex , keep, Idefault) = CartesianIndex (_newindex (I. I, keep, Idefault))
591
+ newindex (i:: Integer , keep:: Tuple , idefault) = ifelse (keep[1 ], i, idefault[1 ])
592
+ newindex (i:: Integer , keep:: Tuple{} , idefault) = CartesianIndex (())
593
+ _newindex (I, keep, Idefault) =
592
594
(ifelse (keep[1 ], I[1 ], Idefault[1 ]), _newindex (tail (I), tail (keep), tail (Idefault))... )
593
- @inline _newindex (I, keep:: Tuple{} , Idefault) = () # truncate if keep is shorter than I
594
- @inline _newindex (I:: Tuple{} , keep, Idefault) = () # or I is shorter
595
- @inline _newindex (I:: Tuple{} , keep:: Tuple{} , Idefault) = () # or both
595
+ _newindex (I, keep:: Tuple{} , Idefault) = () # truncate if keep is shorter than I
596
+ _newindex (I:: Tuple{} , keep, Idefault) = () # or I is shorter
597
+ _newindex (I:: Tuple{} , keep:: Tuple{} , Idefault) = () # or both
596
598
597
599
# newindexer(A) generates `keep` and `Idefault` (for use by `newindex` above)
598
600
# for a particular array `A`; `shapeindexer` does so for its axes.
599
- @inline newindexer (A) = shapeindexer (axes (A))
600
- @inline shapeindexer (ax) = _newindexer (ax)
601
- @inline _newindexer (indsA:: Tuple{} ) = (), ()
602
- @inline function _newindexer (indsA:: Tuple )
601
+ newindexer (A) = shapeindexer (axes (A))
602
+ shapeindexer (ax) = _newindexer (ax)
603
+ _newindexer (indsA:: Tuple{} ) = (), ()
604
+ function _newindexer (indsA:: Tuple )
603
605
ind1 = indsA[1 ]
604
606
keep, Idefault = _newindexer (tail (indsA))
605
607
(Base. length (ind1):: Integer != 1 , keep... ), (first (ind1), Idefault... )
@@ -613,12 +615,12 @@ Base.@propagate_inbounds Base.getindex(
613
615
bc:: Broadcasted ,
614
616
i1:: Union{Integer,CartesianIndex} ,
615
617
i2:: Union{Integer,CartesianIndex} ,
616
- I:: Union{Integer,CartesianIndex} ...,
617
- ) =
618
+ I:: Vararg{ Union{Integer,CartesianIndex},N}
619
+ ) where {N} =
618
620
bc[CartesianIndex ((i1, i2, I... ))]
619
621
Base. @propagate_inbounds Base. getindex (bc:: Broadcasted ) = bc[CartesianIndex (())]
620
622
621
- @inline Base. checkbounds (bc:: Broadcasted , I:: Union{Integer,CartesianIndex} ) =
623
+ Base. checkbounds (bc:: Broadcasted , I:: Union{Integer,CartesianIndex} ) =
622
624
Base. checkbounds_indices (Bool, axes (bc), (I,)) || Base. throw_boundserror (bc, (I,))
623
625
624
626
@@ -645,7 +647,7 @@ struct Extruded{T, K, D}
645
647
keeps:: K # A tuple of booleans, specifying which indices should be passed normally
646
648
defaults:: D # A tuple of integers, specifying the index to use when keeps[i] is false (as defaults[i])
647
649
end
648
- @inline axes (b:: Extruded ) = axes (b. x)
650
+ axes (b:: Extruded ) = axes (b. x)
649
651
Base. @propagate_inbounds _broadcast_getindex (b:: Extruded , i) = b. x[newindex (i, b. keeps, b. defaults)]
650
652
extrude (x:: AbstractArray ) = Extruded (x, newindexer (x)... )
651
653
extrude (x) = x
@@ -680,7 +682,7 @@ Base.@propagate_inbounds _getindex(args::Tuple, I) = (_broadcast_getindex(args[1
680
682
Base. @propagate_inbounds _getindex (args:: Tuple{Any} , I) = (_broadcast_getindex (args[1 ], I),)
681
683
Base. @propagate_inbounds _getindex (args:: Tuple{} , I) = ()
682
684
683
- @inline _broadcast_getindex_evalf (f:: Tf , args:: Vararg{Any,N} ) where {Tf,N} = f (args... ) # not propagate_inbounds
685
+ _broadcast_getindex_evalf (f:: Tf , args:: Vararg{Any,N} ) where {Tf,N} = f (args... ) # not propagate_inbounds
684
686
685
687
"""
686
688
Broadcast.broadcastable(x)
@@ -724,7 +726,7 @@ _broadcast_getindex_eltype(A) = eltype(A) # Tuple, Array, etc.
724
726
eltypes (:: Tuple{} ) = Tuple{}
725
727
eltypes (t:: Tuple{Any} ) = Tuple{_broadcast_getindex_eltype (t[1 ])}
726
728
eltypes (t:: Tuple{Any,Any} ) = Tuple{_broadcast_getindex_eltype (t[1 ]), _broadcast_getindex_eltype (t[2 ])}
727
- eltypes (t:: Tuple ) = Tuple{_broadcast_getindex_eltype (t[ 1 ]), eltypes ( tail (t)) . types ... }
729
+ eltypes (t:: Tuple ) = Tuple{map (_broadcast_getindex_eltype, t) ... }
728
730
729
731
# Inferred eltype of result of broadcast(f, args...)
730
732
combine_eltypes (f, args:: Tuple ) =
@@ -808,11 +810,11 @@ julia> string.(("one","two","three","four"), ": ", 1:4)
808
810
809
811
```
810
812
"""
811
- broadcast (f:: Tf , As... ) where {Tf} = materialize (broadcasted (f, As... ))
813
+ broadcast (f:: Tf , As:: Vararg{Any,N} ) where {Tf,N } = materialize (broadcasted (f, As... ))
812
814
813
815
# special cases defined for performance
814
- @inline broadcast (f, x:: Number... ) = f (x... )
815
- @inline broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
816
+ broadcast (f, x:: Number... ) = f (x... )
817
+ broadcast (f, t:: NTuple{N,Any} , ts:: Vararg{NTuple{N,Any}} ) where {N} = map (f, t, ts... )
816
818
817
819
"""
818
820
broadcast!(f, dest, As...)
@@ -857,41 +859,41 @@ Like [`broadcast`](@ref), except in the case of a 0-dimensional result where it
857
859
Broadcast automatically unwraps zero-dimensional results to be just the element itself,
858
860
but in some cases it is necessary to always return a container — even in the 0-dimensional case.
859
861
"""
860
- @inline function broadcast_preserving_zero_d (f, As... )
862
+ function broadcast_preserving_zero_d (f, As... )
861
863
bc = broadcasted (f, As... )
862
864
r = materialize (bc)
863
865
return length (axes (bc)) == 0 ? fill! (similar (bc, typeof (r)), r) : r
864
866
end
865
- @inline broadcast_preserving_zero_d (f) = fill (f ())
866
- @inline broadcast_preserving_zero_d (f, as:: Number... ) = fill (f (as... ))
867
+ broadcast_preserving_zero_d (f) = fill (f ())
868
+ broadcast_preserving_zero_d (f, as:: Number... ) = fill (f (as... ))
867
869
868
870
"""
869
871
Broadcast.materialize(bc)
870
872
871
873
Take a lazy `Broadcasted` object and compute the result
872
874
"""
873
- @inline materialize (bc:: Broadcasted ) = copy (instantiate (bc))
875
+ materialize (bc:: Broadcasted ) = copy (instantiate (bc))
874
876
materialize (x) = x
875
877
876
- @inline function materialize! (dest, x)
878
+ function materialize! (dest, x)
877
879
return materialize! (dest, instantiate (Broadcasted (identity, (x,), axes (dest))))
878
880
end
879
881
880
- @inline function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
882
+ function materialize! (dest, bc:: Broadcasted{Style} ) where {Style}
881
883
return materialize! (combine_styles (dest, bc), dest, bc)
882
884
end
883
- @inline function materialize! (:: BroadcastStyle , dest, bc:: Broadcasted{Style} ) where {Style}
885
+ function materialize! (:: BroadcastStyle , dest, bc:: Broadcasted{Style} ) where {Style}
884
886
return copyto! (dest, instantiate (Broadcasted {Style} (bc. f, bc. args, axes (dest))))
885
887
end
886
888
887
889
# # general `copy` methods
888
- @inline copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
890
+ copy (bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = bc[CartesianIndex ()]
889
891
copy (bc:: Broadcasted{<:Union{Nothing,Unknown}} ) =
890
892
throw (ArgumentError (" broadcasting requires an assigned BroadcastStyle" ))
891
893
892
894
const NonleafHandlingStyles = Union{DefaultArrayStyle,ArrayConflict}
893
895
894
- @inline function copy (bc:: Broadcasted{Style} ) where {Style}
896
+ function copy (bc:: Broadcasted{Style} ) where {Style}
895
897
ElType = combine_eltypes (bc. f, bc. args)
896
898
if Base. isconcretetype (ElType)
897
899
# We can trust it and defer to the simpler `copyto!`
@@ -923,10 +925,10 @@ end
923
925
# # general `copyto!` methods
924
926
# The most general method falls back to a method that replaces Style->Nothing
925
927
# This permits specialization on typeof(dest) without introducing ambiguities
926
- @inline copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
928
+ copyto! (dest:: AbstractArray , bc:: Broadcasted ) = copyto! (dest, convert (Broadcasted{Nothing}, bc))
927
929
928
930
# Performance optimization for the common identity scalar case: dest .= val
929
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
931
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{<:AbstractArrayStyle{0}} )
930
932
# Typically, we must independently execute bc for every storage location in `dest`, but:
931
933
# IF we're in the common no-op identity case with no nested args (like `dest .= val`),
932
934
if bc. f === identity && bc. args isa Tuple{Any} && isflat (bc)
@@ -950,15 +952,15 @@ broadcast_unalias(::Nothing, src) = src
950
952
# Preprocessing a `Broadcasted` does two things:
951
953
# * unaliases any arguments from `dest`
952
954
# * "extrudes" the arguments where it is advantageous to pre-compute the broadcasted indices
953
- @inline preprocess (dest, bc:: Broadcasted{Style} ) where {Style} = Broadcasted {Style} (bc. f, preprocess_args (dest, bc. args), bc. axes)
955
+ preprocess (dest, bc:: Broadcasted{Style} ) where {Style} = Broadcasted {Style} (bc. f, preprocess_args (dest, bc. args), bc. axes)
954
956
preprocess (dest, x) = extrude (broadcast_unalias (dest, x))
955
957
956
- @inline preprocess_args (dest, args:: Tuple ) = (preprocess (dest, args[1 ]), preprocess_args (dest, tail (args))... )
957
- @inline preprocess_args (dest, args:: Tuple{Any} ) = (preprocess (dest, args[1 ]),)
958
- @inline preprocess_args (dest, args:: Tuple{} ) = ()
958
+ preprocess_args (dest, args:: Tuple ) = (preprocess (dest, args[1 ]), preprocess_args (dest, tail (args))... )
959
+ preprocess_args (dest, args:: Tuple{Any} ) = (preprocess (dest, args[1 ]),)
960
+ preprocess_args (dest, args:: Tuple{} ) = ()
959
961
960
962
# Specialize this method if all you want to do is specialize on typeof(dest)
961
- @inline function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
963
+ function copyto! (dest:: AbstractArray , bc:: Broadcasted{Nothing} )
962
964
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
963
965
# Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
964
966
if bc. f === identity && bc. args isa Tuple{AbstractArray} # only a single input argument to broadcast!
978
980
979
981
# Performance optimization: for BitArray outputs, we cache the result
980
982
# in a "small" Vector{Bool}, and then copy in chunks into the output
981
- @inline function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
983
+ function copyto! (dest:: BitArray , bc:: Broadcasted{Nothing} )
982
984
axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
983
985
ischunkedbroadcast (dest, bc) && return chunkedcopyto! (dest, bc)
984
986
length (dest) < 256 && return invoke (copyto!, Tuple{AbstractArray, Broadcasted{Nothing}}, dest, bc)
@@ -1032,9 +1034,9 @@ liftchunks(args::Tuple{<:BitArray,Vararg{Any}}) = (args[1].chunks, liftchunks(ta
1032
1034
# Transform scalars to repeated scalars the size of a chunk
1033
1035
liftchunks (args:: Tuple{<:Bool,Vararg{Any}} ) = (ifelse (args[1 ], typemax (UInt64), UInt64 (0 )), liftchunks (tail (args))... )
1034
1036
ithchunk (i) = ()
1035
- Base. @propagate_inbounds ithchunk (i, c:: Vector{UInt64} , args... ) = (c[i], ithchunk (i, args... )... )
1036
- Base. @propagate_inbounds ithchunk (i, b:: UInt64 , args... ) = (b, ithchunk (i, args... )... )
1037
- @inline function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
1037
+ Base. @propagate_inbounds ithchunk (i, c:: Vector{UInt64} , args:: Vararg{Any,N} ) where {N} = (c[i], ithchunk (i, args... )... )
1038
+ Base. @propagate_inbounds ithchunk (i, b:: UInt64 , args:: Vararg{Any,N} ) where {N} = (b, ithchunk (i, args... )... )
1039
+ function chunkedcopyto! (dest:: BitArray , bc:: Broadcasted )
1038
1040
isempty (dest) && return dest
1039
1041
f = flatten (liftfuncs (bc))
1040
1042
args = liftchunks (f. args)
@@ -1081,7 +1083,7 @@ end
1081
1083
1082
1084
# # Tuple methods
1083
1085
1084
- @inline function copy (bc:: Broadcasted{Style{Tuple}} )
1086
+ function copy (bc:: Broadcasted{Style{Tuple}} )
1085
1087
dim = axes (bc)
1086
1088
length (dim) == 1 || throw (DimensionMismatch (" tuple only supports one dimension" ))
1087
1089
N = length (dim[1 ])
@@ -1177,15 +1179,15 @@ struct BitMaskedBitArray{N,M}
1177
1179
mask:: BitArray{M}
1178
1180
BitMaskedBitArray {N,M} (parent, mask) where {N,M} = new (parent, mask)
1179
1181
end
1180
- @inline function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1182
+ function BitMaskedBitArray (parent:: BitArray{N} , mask:: BitArray{M} ) where {N,M}
1181
1183
@boundscheck checkbounds (parent, mask)
1182
1184
BitMaskedBitArray {N,M} (parent, mask)
1183
1185
end
1184
1186
Base. @propagate_inbounds dotview (B:: BitArray , i:: BitArray ) = BitMaskedBitArray (B, i)
1185
1187
Base. show (io:: IO , B:: BitMaskedBitArray ) = foreach (arg-> show (io, arg), (typeof (B), (B. parent, B. mask)))
1186
1188
# Override materialize! to prevent the BitMaskedBitArray from escaping to an overrideable method
1187
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1188
- @inline materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (@inbounds (view (B. parent, B. mask)), bc)
1189
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}} ) = fill! (B, bc. args[1 ])
1190
+ materialize! (B:: BitMaskedBitArray , bc:: Broadcasted{<:Any} ) = materialize! (@inbounds (view (B. parent, B. mask)), bc)
1189
1191
function Base. fill! (B:: BitMaskedBitArray , b:: Bool )
1190
1192
Bc = B. parent. chunks
1191
1193
Ic = B. mask. chunks
@@ -1211,7 +1213,7 @@ end
1211
1213
# explicit calls to view. (All of this can go away if slices
1212
1214
# are changed to generate views by default.)
1213
1215
1214
- Base. @propagate_inbounds dotview (args... ) = Base. maybeview (args... )
1216
+ Base. @propagate_inbounds dotview (args:: Vararg{Any,N} ) where {N} = Base. maybeview (args... )
1215
1217
1216
1218
# ###########################################################
1217
1219
# The parser turns @. into a call to the __dot__ macro,
@@ -1290,33 +1292,34 @@ macro __dot__(x)
1290
1292
esc (__dot__ (x))
1291
1293
end
1292
1294
1293
- @inline function broadcasted_kwsyntax (f, args... ; kwargs... )
1295
+
1296
+ function broadcasted_kwsyntax (f, args:: Vararg{Any,N} ; kwargs... ) where N
1294
1297
if isempty (kwargs) # some BroadcastStyles dispatch on `f`, so try to preserve its type
1295
1298
return broadcasted (f, args... )
1296
1299
else
1297
1300
return broadcasted ((args... ) -> f (args... ; kwargs... ), args... )
1298
1301
end
1299
1302
end
1300
- @inline function broadcasted (f, args ... )
1301
- args′ = map (broadcastable, args )
1302
- broadcasted (combine_styles (args′... ), f, args′... )
1303
+ function broadcasted (f)
1304
+ args′ = map (broadcastable, () )
1305
+ return broadcasted (combine_styles (args′... ), f, args′... )
1303
1306
end
1304
1307
# Due to the current Type{T}/DataType specialization heuristics within Tuples,
1305
1308
# the totally generic varargs broadcasted(f, args...) method above loses Type{T}s in
1306
1309
# mapping broadcastable across the args. These additional methods with explicit
1307
1310
# arguments ensure we preserve Type{T}s in the first or second argument position.
1308
- @inline function broadcasted (f, arg1, args ... )
1311
+ function broadcasted (f, arg1)
1309
1312
arg1′ = broadcastable (arg1)
1310
- args′ = map (broadcastable, args )
1311
- broadcasted (combine_styles (arg1′, args′... ), f, arg1′, args′... )
1313
+ args′ = map (broadcastable, () )
1314
+ return broadcasted (combine_styles (arg1′, args′... ), f, arg1′, args′... )
1312
1315
end
1313
- @inline function broadcasted (f, arg1, arg2, args... )
1316
+ function broadcasted (f, arg1, arg2, args:: Vararg{Any,N} ) where N
1314
1317
arg1′ = broadcastable (arg1)
1315
1318
arg2′ = broadcastable (arg2)
1316
1319
args′ = map (broadcastable, args)
1317
- broadcasted (combine_styles (arg1′, arg2′, args′... ), f, arg1′, arg2′, args′... )
1320
+ return broadcasted (combine_styles (arg1′, arg2′, args′... ), f, arg1′, arg2′, args′... )
1318
1321
end
1319
- @inline broadcasted (:: S , f, args... ) where S<: BroadcastStyle = Broadcasted {S} (f, args)
1322
+ broadcasted (:: S , f, args:: Vararg{Any,N} ) where { S<: BroadcastStyle ,N} = Broadcasted {S} (f, args)
1320
1323
1321
1324
"""
1322
1325
BroadcastFunction{F} <: Function
@@ -1348,7 +1351,7 @@ struct BroadcastFunction{F} <: Function
1348
1351
f:: F
1349
1352
end
1350
1353
1351
- @inline (op:: BroadcastFunction )(x ... ; kwargs... ) = op. f .(x ... ; kwargs... )
1354
+ (op:: BroadcastFunction )(args :: Vararg{Any,N} ; kwargs... ) where {N} = op. f .(args ... ; kwargs... )
1352
1355
1353
1356
function Base. show (io:: IO , op:: BroadcastFunction )
1354
1357
print (io, BroadcastFunction, ' (' )
0 commit comments