@@ -33,16 +33,16 @@ containertype(ct1, ct2) = promote_containertype(containertype(ct1), containertyp
33
33
@inline containertype (ct1, ct2, cts... ) = promote_containertype (containertype (ct1), containertype (ct2, cts... ))
34
34
35
35
promote_containertype (ct1, ct2) = Array
36
+ promote_containertype {T<:AbstractArray} (:: Type{T} , :: Type{Tuple} ) = Array
37
+ promote_containertype {T<:AbstractArray} (:: Type{Tuple} , :: Type{T} ) = Array
36
38
promote_containertype (:: Type{Array} , :: Type{VecOrMat} ) = Array
37
39
promote_containertype (:: Type{VecOrMat} , :: Type{Array} ) = Array
38
- promote_containertype (:: Type{VecOrMat} , :: Type{Tuple} ) = Array
39
- promote_containertype (:: Type{Tuple} , :: Type{VecOrMat} ) = Array
40
- promote_containertype {T<:Array} (:: Type{T} , :: ScalarType ) = T
41
- promote_containertype {T<:Array} (:: ScalarType , :: Type{T} ) = T
42
40
promote_containertype (:: Type{Tuple} , :: ScalarType ) = Tuple
43
41
promote_containertype (:: ScalarType , :: Type{Tuple} ) = Tuple
44
42
promote_containertype (:: Type{Any} , :: Type{Nullable} ) = Nullable
45
43
promote_containertype (:: Type{Nullable} , :: Type{Any} ) = Nullable
44
+ promote_containertype (T:: Type , :: ScalarType ) = T
45
+ promote_containertype (:: ScalarType , T:: Type ) = T
46
46
promote_containertype {T} (:: Type{T} , :: Type{T} ) = T
47
47
48
48
# # Calculate the broadcast indices of the arguments, or error if incompatible
@@ -52,7 +52,7 @@ broadcast_indices(A) = broadcast_indices(containertype(A), A)
52
52
broadcast_indices (:: ScalarType , A) = ()
53
53
broadcast_indices (:: Type{Tuple} , A) = (OneTo (length (A)),)
54
54
broadcast_indices (:: Type{Array} , A:: Ref ) = ()
55
- broadcast_indices {T<:Array } (:: Type{T} , A) = indices (A)
55
+ broadcast_indices {T<:AbstractArray } (:: Type{T} , A) = indices (A)
56
56
@inline broadcast_indices (A, B... ) = broadcast_shape ((), broadcast_indices (A), map (broadcast_indices, B)... )
57
57
# shape (i.e., tuple-of-indices) inputs
58
58
broadcast_shape (shape:: Tuple ) = shape
0 commit comments