Skip to content

Commit 1e323f9

Browse files
committed
Fix #356.
1 parent 9044eb2 commit 1e323f9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/SMatrix.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ end
5454
end
5555

5656
@inline convert(::Type{SMatrix{S1,S2}}, a::StaticArray{<:Any, T}) where {S1,S2,T} = SMatrix{S1,S2,T}(Tuple(a))
57-
@inline SMatrix(a::StaticMatrix) = SMatrix{size(typeof(a),1),size(typeof(a),2)}(Tuple(a))
57+
@inline SMatrix(a::StaticMatrix{S1, S2}) where {S1, S2} = SMatrix{S1, S2}(Tuple(a))
5858

5959
# Simplified show for the type
6060
show(io::IO, ::Type{SMatrix{N, M, T}}) where {N, M, T} = print(io, "SMatrix{$N,$M,$T}")

test/SMatrix.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
@test isa(@SMatrix(randexp(Float32, 2, 2)), SMatrix{2, 2, Float32})
6868

6969
@test isa(SMatrix(@SMatrix zeros(4,4)), SMatrix{4, 4, Float64})
70+
71+
@inferred SMatrix(rand(SMatrix{3, 3})) # issue 356
7072
end
7173

7274
@testset "Methods" begin

0 commit comments

Comments
 (0)