Skip to content

Commit ec3ce1c

Browse files
authored
Make empty Size() type stable (#28)
* Make empty Size() type stable * Bump version
1 parent e85e646 commit ec3ce1c

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "StaticArraysCore"
22
uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3-
version = "1.4.2"
3+
version = "1.4.3"
44

55
[compat]
66
julia = "1.6"

src/StaticArraysCore.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ end
491491

492492
Base.@pure Size(s::Tuple{Vararg{StaticDimension}}) = Size{s}()
493493
Base.@pure Size(s::StaticDimension...) = Size{s}()
494+
Size() = Size(())
494495
Size(::Type{T}) where {T<:Tuple} = Size{tuple_tuple(T)}()
495496

496497
Base.show(io::IO, ::Size{S}) where {S} = print(io, "Size", S)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ end
2929
@testset "Size" begin
3030
M = SArray{Tuple{2,3,4},Int,3}(tuple(rand(Int, 24)...))
3131
@test (@inferred Size(M)) === Size(2, 3, 4)
32+
@test (@inferred Size()) === Size{()}()
3233
Ms = Size(M)
3334
@test repr(Ms) == "Size(2, 3, 4)"
3435
@test Size(2, StaticArraysCore.Dynamic(), 5) === Size{(2, StaticArraysCore.Dynamic(), 5)}()

0 commit comments

Comments
 (0)