Type parameters can be referred from value parameters, so we should determine them earlier to be able to set their indexes