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

Potentially problematic method definition #50

Open
jishnub opened this issue Dec 1, 2023 · 1 comment
Open

Potentially problematic method definition #50

jishnub opened this issue Dec 1, 2023 · 1 comment

Comments

@jishnub
Copy link
Member

jishnub commented Dec 1, 2023

Base.to_shape(dims::Tuple{Vararg{Union{Infinity, Integer, AbstractUnitRange}}}) = map(Base.to_shape, dims)

Aqua flags this method as potential type-piracy (see JuliaTesting/Aqua.jl#173). I think this is fine, and the flag is a false positive, but why do we need this method? Is a real infinity used as an array size or index, as opposed to the integer ℵ₀?

@dlfivefifty
Copy link
Member

It is indeed a false positive as all potential ambiguities have more restricted definitions eg

julia> @which Base.to_shape((),)
to_shape(::Tuple{})
     @ Base abstractarray.jl:851

Is a real infinity used as an array size or index, as opposed to the integer ℵ₀?

This is possibly just outdated code (it used to be the case that ∞ isa Integer hence played the role of ℵ₀). Alternatively it was to support a[∞] instead of a[ℵ₀].

Try deleting it and see if anything breaks?

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

No branches or pull requests

2 participants