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

Refine eltype of Base.Generator when its type is concrete #54208

Closed
wants to merge 3 commits into from

Conversation

Tortar
Copy link
Contributor

@Tortar Tortar commented Apr 23, 2024

Tries to address #54157

Now:

julia> iter = (x^2 for x in 1:10)
Base.Generator{UnitRange{Int64}, var"#1#2"}(var"#1#2"(), 1:10)

julia> eltype(iter)
Int64

Before

julia> iter = (x^2 for x in 1:10)
Base.Generator{UnitRange{Int64}, var"#1#2"}(var"#1#2"(), 1:10)

julia> eltype(iter)
Any

Took inspiration from Base.@default_eltype for the infer_type macro. The first couldn't be used directly because it accepts an instance, not a type.

@Tortar Tortar closed this Apr 23, 2024
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.

None yet

1 participant