julia
69a1269c - subtype: Look through typevar bounds in `obviously_disjoint` (#64451)

Commit
22 days ago
subtype: Look through typevar bounds in `obviously_disjoint` (#64451) Activating a method loaded from a package image intersects its signature with every specialization of each method it may displace and with every typename backedge it may satisfy, and almost all of these intersections are empty. `jl_type_intersection_env_s` tries `obviously_disjoint` first, but that check gave up on any typevar: a tuple element `T` with `T<:AbstractString`, an invariant parameter such as `Vector{<:AbstractFloat}` against `Vector{Int}`, or `Type{T} where T<:AbstractFloat` against `Type{Int}`, so these pairs fell through to the full intersection. In covariant positions (top level, tuple elements, union members) a typevar now stands for its upper bound, since it admits only values of that bound. An invariant parameter that is a typevar is compared by its bound against the other parameter's typename, which is also used for `Type{A}` against `Type{B}` with free typevars. Invariant positions keep treating typevars as possibly `Union{}`, and the specificity mode is unchanged. Cold load time drops by about 9% for Distributions and 11% for Ferrite.
Author
Parents
Loading