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

subtype: replace leaf-bound typevars if they would result in Tuple{Union{}} otherwise #49393

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Apr 17, 2023

This was a primary motivation for #49111. Previously, we'd see some some methods like convert(::Type{T}, ::T) where T<:Float64 (apparently from tuple convert specializations), which were not necessary

julia> which(Tuple{Type{T}, T} where {T<:Number}).specializations
svec(MethodInstance for Float64(::Float64), MethodInstance for AbstractFloat(::Float64), MethodInstance for AbstractFloat(::BigFloat), MethodInstance for AbstractFloat(::Float32), MethodInstance for Float32(::Float32), MethodInstance for Float16(::Float16), MethodInstance for Int64(::Int64), nothing, nothing, nothing)

@vtjnash vtjnash added the types and dispatch Types, subtyping and method dispatch label Apr 17, 2023
@vtjnash
Copy link
Member Author

vtjnash commented Apr 17, 2023

Note that the existing Core.Compiler.normalize_typevars fails this case because it has:

julia> (Tuple{Type{T},T} where T<:Int) <: Tuple{Type{Int},Int}
false

@vtjnash
Copy link
Member Author

vtjnash commented Apr 18, 2023

@nanosoldier runbenchmarks(!"scalar", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@N5N3
Copy link
Member

N5N3 commented Apr 19, 2023

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants