Do not gather mixed types that are not to be generated.

This avoids compilation issues by ensuring that only types to be generated are gathered.