Skip to content

Commit a2559c0

Browse files
committed
Fix dim tests and remove old promote_shape
1 parent 1a43f42 commit a2559c0

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

src/dimensions.jl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@ function throw_dim_error(@nospecialize(x), @nospecialize(dim))
33
throw(DimensionMismatch("$x does not have dimension corresponding to $dim"))
44
end
55

6-
@propagate_inbounds function _promote_shape(a::Tuple{A,Vararg{Any}}, b::Tuple{B,Vararg{Any}}) where {A,B}
7-
(_try_static(getfield(a, 1), getfield(b, 1)), _promote_shape(tail(a), tail(b))...)
8-
end
9-
_promote_shape(::Tuple{}, ::Tuple{}) = ()
10-
@propagate_inbounds function _promote_shape(::Tuple{}, b::Tuple{B}) where {B}
11-
(_try_static(static(1), getfield(b, 1)),)
12-
end
13-
@propagate_inbounds function _promote_shape(a::Tuple{A}, ::Tuple{}) where {A}
14-
(_try_static(static(1), getfield(a, 1)),)
15-
end
16-
@propagate_inbounds function Base.promote_shape(a::Tuple{Vararg{CanonicalInt}}, b::Tuple{Vararg{CanonicalInt}})
17-
_promote_shape(a, b)
18-
end
19-
206
#julia> @btime ArrayInterfaceCore.is_increasing(ArrayInterfaceCore.nstatic(Val(10)))
217
# 0.045 ns (0 allocations: 0 bytes)
228
#ArrayInterfaceCore.True()

test/dimensions.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ end
108108
@test @inferred(ArrayInterface.known_dimnames(Iterators.flatten(1:10))) === (:_,)
109109
@test @inferred(ArrayInterface.known_dimnames(Iterators.flatten(1:10), static(1))) === :_
110110
@test @inferred(ArrayInterface.known_dimnames(z)) === (nothing, :y)
111-
@test @inferred(ArrayInterface.known_dimnames(reshape(x, (1, 4)))) == d
112-
@test @inferred(ArrayInterface.known_dimnames(r1)) == d
113-
@test @inferred(ArrayInterface.known_dimnames(r2)) == (:_, d...)
114-
@test @inferred(ArrayInterface.known_dimnames(r3)) == Base.tail(d)
115-
@test @inferred(ArrayInterface.known_dimnames(r4)) == d
116-
@test @inferred(ArrayInterface.known_dimnames(w)) == d
111+
@test @inferred(ArrayInterface.known_dimnames(reshape(x, (1, 4)))) === (:x, :y)
112+
@test @inferred(ArrayInterface.known_dimnames(r1)) === (:x, :y)
113+
@test @inferred(ArrayInterface.known_dimnames(r2)) === (:_, :x, :y)
114+
@test @inferred(ArrayInterface.known_dimnames(r3)) === (:y,)
115+
@test @inferred(ArrayInterface.known_dimnames(r4)) === (:x, :y)
116+
@test @inferred(ArrayInterface.known_dimnames(w)) === (:x, :y)
117117
@test @inferred(ArrayInterface.known_dimnames(reshape(x, :))) === (:_,)
118118
@test @inferred(ArrayInterface.known_dimnames(view(x, :, 1)')) === (:_, :x)
119119
end

0 commit comments

Comments
 (0)