The code snippets built up for derived code are sometimes used as blocks
(e.g. in a function body) and sometimes used as expressions (e.g. in a match
arm). This structure avoids committing to either form until necessary,
avoiding the insertion of any unnecessary blocks.
This method helps to extract all the type parameters referenced from a
type. For a type parameter <T>, it looks for either a TyPath that
is not global and starts with T, or a TyQPath.
Also include bound generic params from the input type.