Fixes #111510 and complements #106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
Fix #106547 by transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods.