Skip to content

Commit

Permalink
define propertynames(::FixedSizeArray)
Browse files Browse the repository at this point in the history
Make both fields private.
  • Loading branch information
nsajko committed Oct 21, 2024
1 parent 7d9f5d5 commit 3f204b5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/FixedSizeArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ struct FixedSizeArray{T,N,Mem<:GenericMemory{<:Any,T}} <: DenseArray{T,N}
end
end

function Base.propertynames(
# the `unused` is here because of https://github.com/JuliaLang/julia/issues/44428
(@nospecialize unused::FixedSizeArray),
::Bool = false,
)
()
end

const FixedSizeVector{T} = FixedSizeArray{T,1}
const FixedSizeMatrix{T} = FixedSizeArray{T,2}

Expand Down
11 changes: 11 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ end
FSM = fsm(storage_type)
FSA = fsa(storage_type)

@testset "`propertynames`" begin
for dim_count 0:4
for T (Int, Float32)
siz = ntuple(Returns(1), dim_count)
arr = FSA{T}(undef, siz)
test_inferred(propertynames, Tuple{}, (arr,))
test_inferred(propertynames, Tuple{}, (arr, false))
end
end
end

@testset "Constructors" begin
for dim_count 0:4
siz = ntuple(Returns(2), dim_count)
Expand Down

0 comments on commit 3f204b5

Please sign in to comment.