Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid several bad
show_default
invalidations (JuliaLang#37125)
This fixes ~50 quite critical invalidations from loading StaticArrays, which manages to hit the package-loading code, the docstring code, and the `MethodError` display code. Since particularly the first two are used by *everything*, these invalidations are about as bad as it gets given that this is not a huge number of invalidations (at least, by our old standards). The invalidation of the package-loading code is due to a rather hilarious chain of events. [This method definition](https://github.com/JuliaArrays/StaticArrays.jl/blob/ad583c99768f3a381ba20b1a0782c9ca50890b50/src/SArray.jl#L125-L126) ends up invalidating [`show_default`](https://github.com/JuliaLang/julia/blob/89d6b469b633dde8f92b4d245ca3d8e5606e229c/base/show.jl#L417), which got called because `stale_cachefile` used an outdated variable name in a [`@debug` macro](https://github.com/JuliaLang/julia/blob/89d6b469b633dde8f92b4d245ca3d8e5606e229c/base/loading.jl#L1518) that ended up grabbing the global `mod` function. Since `show(::IO, ::Function)` can call `show_default`, this ended up invalidating basically all the package-loading code. The docstring code got invalidated because `show(::IO, ::Pair{Symbol,Any})` [calls `show_default`](https://github.com/JuliaLang/julia/blob/89d6b469b633dde8f92b4d245ca3d8e5606e229c/base/show.jl#L907). This PR provides a dedicated path that circumvents `show_default`. Finally, an innocuous-seeming function-print in `showerror(::IO, ::MethodError)` also led to quite a chain of invalidation. * Specify that getaddrinfo(::AbstractString) returns a `Union{IPv4,IPv6}` These are the only two types supported by `Sockets`, so this seems reasonable, although it does block further extension.
- Loading branch information