Using @nospecialize on a set of subtypes

Because the TypeVars T1 and T2 connect to something outside the @nospecialize scope you’ve essentially defeated the mechanism. If you write g as

g(@nospecialize(a::AbstractA), @nospecialize(b::AbstractB)) = ...

then I think you’ll get what you’re aiming for.

3 Likes