Previously tests for these were passing somewhat by accident,
however this commit's parent adds a case which showed that the
handling was missing.
Note that this also relies on the recent fix for nested tuples
which changed the `isinstance` check in `define_generics`.
This should help catch any errors in our handling of invalid cases.
While some of these produce outputs which aren't correct, what
we're checking here is that we don't _error_ while producing that
output.
Also fix a case which this showed up.