-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introduce function collect_as
for construction from an iterator
#48
Conversation
Codecov ReportAttention: Patch coverage is
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. |
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
There was a problem hiding this 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
One of these wasn't being recorded by code coverage (another Julia coverage bug, I guess).
@@ -94,6 +96,41 @@ end | |||
|
|||
# helper functions | |||
|
|||
dimension_count_of(::Base.SizeUnknown) = 1 | |||
dimension_count_of(::Base.HasLength) = 1 |
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess 🤷
There was a problem hiding this comment.
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()
.
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/113604The allocations in some code paths are probably excessive/could be optimized. But I guess this is good for a start.
Fixes #20