Skip to content

more consistent findall output; fix #45495 #45538

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

Merged
merged 2 commits into from
Mar 10, 2023
Merged

Conversation

aplavin
Copy link
Contributor

@aplavin aplavin commented Jun 1, 2022

following @nalimilan's suggestion from #45495 discussion

@aplavin
Copy link
Contributor Author

aplavin commented Jul 1, 2022

bump!

@aplavin
Copy link
Contributor Author

aplavin commented Aug 15, 2022

bump

@gbaraldi gbaraldi requested a review from LilithHafner August 15, 2022 10:58
Copy link
Member

@LilithHafner LilithHafner left a comment

Choose a reason for hiding this comment

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

I think the correct behavior would be to return a Vector{eltype(collect(keys(A)))} We currently get that wrong when we can infer a narrower type. This would fix the issue for concrete types but not for non-concrete types.

I won't make a value judgment on whether it is better to patch the common case now and leave a more obscure bug lurking or to wait until we get the behavior right in all cases.

@LilithHafner LilithHafner requested a review from nalimilan August 18, 2022 15:24
@N5N3
Copy link
Member

N5N3 commented Aug 18, 2022

Another possible solution is defining something like

julia> Base._iterator_upper_bound(itr::Base.Generator) = itr.f(Base._iterator_upper_bound(itr.iter))

julia> Base._iterator_upper_bound(itr::Iterators.Filter) = Base._iterator_upper_bound(itr.itr)

julia> findall(x -> false, (1,2,3))
Int64[]

I'm not sure it's worth making such a change though.

@brenhinkeller brenhinkeller added search & find The find* family of functions compiler:inference Type inference labels Nov 17, 2022
@aplavin
Copy link
Contributor Author

aplavin commented Feb 5, 2023

As I understand from the @LilithHafner comment, this PR is in improvement, even though not perfect. Can this be merged as it is?
I don't grasp the implications of @N5N3 approach, they touch iterators on a deeper level.

@aplavin
Copy link
Contributor Author

aplavin commented Mar 9, 2023

bump...

@N5N3 N5N3 added the merge me PR is reviewed. Merge when all tests are passing label Mar 10, 2023
@N5N3 N5N3 merged commit 162b9e9 into JuliaLang:master Mar 10, 2023
@N5N3 N5N3 removed the merge me PR is reviewed. Merge when all tests are passing label Mar 10, 2023
LilithHafner added a commit that referenced this pull request Mar 10, 2023
LilithHafner added a commit that referenced this pull request Mar 10, 2023
LilithHafner added a commit that referenced this pull request Mar 10, 2023
LilithHafner added a commit that referenced this pull request Mar 10, 2023
LilithHafner added a commit that referenced this pull request Mar 11, 2023
Xnartharax pushed a commit to Xnartharax/julia that referenced this pull request Apr 19, 2023
vtjnash pushed a commit that referenced this pull request Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference search & find The find* family of functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants