Skip to content

Conversation

@nsajko
Copy link
Member

@nsajko nsajko commented Apr 29, 2024

Makes constructing FixedSizeArrays more convenient!

Inspired by
JuliaLang/julia#36288

This currently ignores Base.IteratorElType, xref https://discourse.julialang.org/t/i-dont-get-base-iteratoreltype/113604

The allocations in some code paths are probably excessive/could be optimized. But I guess this is good for a start.

Fixes #20

@codecov
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

Attention: Patch coverage is 97.80220% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 98.36%. Comparing base (11ec2b2) to head (480cb96).

Files Patch % Lines
src/FixedSizeArrays.jl 97.80% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
- Coverage   98.91%   98.36%   -0.56%     
==========================================
  Files           1        1              
  Lines          92      183      +91     
==========================================
+ Hits           91      180      +89     
- Misses          1        3       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

nsajko added 3 commits April 30, 2024 13:19
Makes constructing `FixedSizeArray`s more convenient!

Inspired by
JuliaLang/julia#36288

This currently ignores `Base.IteratorElType`, xref
https://discourse.julialang.org/t/i-dont-get-base-iteratoreltype/113604

The allocations in some code paths are probably excessive/could be
optimized. But I guess this is good for a start.

Fixes #20
Copy link
Collaborator

@giordano giordano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a new user-facing function, maybe it should be documented at least in the README? We can also set up proper docs

@nsajko nsajko requested a review from giordano April 30, 2024 20:30
nsajko added 3 commits May 1, 2024 06:35
One of these wasn't being recorded by code coverage (another Julia
coverage bug, I guess).
# helper functions

dimension_count_of(::Base.SizeUnknown) = 1
dimension_count_of(::Base.HasLength) = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last line still not covered (unless it's another coverage bug?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's JuliaLang/julia#54214 again. I guess this form is buggy:

f(::SingletonType) = isbits_literal

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it isn't just empty tuple but any singleton?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess 🤷

Copy link
Member Author

@nsajko nsajko May 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did check that these lines are in actuality covered by the tests, by replacing 1 with error().

@nsajko nsajko merged commit c102065 into JuliaArrays:main May 1, 2024
@nsajko nsajko deleted the collect_as branch May 1, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

constructing a FixedSizeArray from a generator

2 participants