I've long thought that f(x::Type) would not specialize on x, whereas g(::Type{x}) where x would. And indeed, methods(g)[1].specializations shows specializations on the few types that I called g on, unlike for f. But in https://github.com/JuliaLang/julia/pull/61156/changes, x::Type is changed to @nospecialize(x::Type), with clear results. Why is @nospecialize useful on x::Type ?
Last updated: Apr 21 2026 at 06:18 UTC