Description
Spawned off of #5121.
Part of the bug underlying #5121 lay dormant for quite a while because some of the type-checking machinery is not as aggressive as it could be about ensuring that the types it is checking actually correspond to concrete types.
In particular, in a concrete function type, the bound-type/lifetimes (i.e. the "formals" in P.L. speak) from the function's signature have been replaced with other concrete types (i.e. the "actuals").
Currently, the ty
represetnation does not really distinguish between formals and actuals except for lifetimes. But nonetheless, we can at least safe-guard against this problem in that case (and presumably if we later change ty
to between distinguish between formal/actual for type variables as well, then similar checks would go into the same place, probably).