-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Make reshape accept a combination of Integers, Base.OneTo and a single Colon consistently #41069
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
base: master
Are you sure you want to change the base?
Conversation
| reshape(parent::AbstractArray, dims::Int...) = reshape(parent, dims) | ||
| reshape(parent::AbstractArray, dims::Union{Int,Colon}...) = reshape(parent, dims) | ||
| reshape(parent::AbstractArray, dims::Tuple{Vararg{Union{Int,Colon}}}) = reshape(parent, _reshape_uncolon(parent, dims)) | ||
| reshape(parent::AbstractArray, dims::Tuple{Vararg{Union{Integer,Colon,Base.OneTo}}}) = reshape(parent, _reshape_uncolon(parent, dims)) |
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.
This feels like it should be:
| reshape(parent::AbstractArray, dims::Tuple{Vararg{Union{Integer,Colon,Base.OneTo}}}) = reshape(parent, _reshape_uncolon(parent, dims)) | |
| reshape(parent::AbstractArray, dims::Tuple) = reshape(parent, _reshape_uncolon(parent, dims)) |
wdyt?
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 like it, although perhaps worth mentioning that this almost makes _reshape_uncolon part of the API (it becomes a tempting target for package specialization).
|
Is this PR still needed? If so, @jishnub can you rebase and fix the merge conflicts? |
This collects the less controversial fixes from #41003.
After this PR, the following will work: