Skip to content
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

simplify undef-taking constructors #96

Merged
merged 7 commits into from
Feb 5, 2025

Conversation

nsajko
Copy link
Collaborator

@nsajko nsajko commented Jan 31, 2025

Prevent doubling in the number of these constructor methods with each additional FixedSizeArray type parameter.

I think the code is nicer, too.

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 5 lines in your changes missing coverage. Please review.

Project coverage is 95.96%. Comparing base (ee6bcd9) to head (7289116).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/FixedSizeArray.jl 83.33% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
- Coverage   96.00%   95.96%   -0.04%     
==========================================
  Files           3        3              
  Lines         250      248       -2     
==========================================
- Hits          240      238       -2     
  Misses         10       10              

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

@nsajko
Copy link
Collaborator Author

nsajko commented Jan 31, 2025

The context is that a future PR will consider adding a fourth type parameter to FixedSizeArray, which would make this PR kind of necessary.

@nsajko
Copy link
Collaborator Author

nsajko commented Jan 31, 2025

The code coverage misses are the same false positives as in #88, becase of moving the code around.

Prevent an exponential increase in the number of these constructor
methods in case `FixedSizeArray` gets more type parameters.
@nsajko nsajko force-pushed the simpler_constructor_methods branch from 1de7f6e to 64a2d2b Compare February 1, 2025 13:08
function FixedSizeArray{T,N,V}(::UndefInitializer, size::Vararg{Integer,N}) where {T,N,V}
FixedSizeArray{T,N,V}(undef, size)
function parent_type_with_default(::Type{<:FixedSizeArray})
default_underlying_storage_type
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not concrete, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That particular method shouldn't ever be called here, it's used in collect_as.

Copy link
Collaborator Author

@nsajko nsajko Feb 1, 2025

Choose a reason for hiding this comment

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

All the parent_type_with_default methods were moved from collect_as.jl to this file in the first commit, to be shared between files.

src/FixedSizeArray.jl Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@nsajko nsajko left a comment

Choose a reason for hiding this comment

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

return size from check_ndims

src/FixedSizeArray.jl Outdated Show resolved Hide resolved
src/FixedSizeArray.jl Show resolved Hide resolved
src/FixedSizeArray.jl Outdated Show resolved Hide resolved
@nsajko nsajko merged commit 2309eb7 into JuliaArrays:main Feb 5, 2025
9 of 11 checks passed
@nsajko nsajko deleted the simpler_constructor_methods branch February 5, 2025 13:59
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.

3 participants