55f384cb04
Descriptors are cached via weak references in moduleByClassLoader.kt and can be garbage-collected at any point. So relying on identity of descriptors in KTypeParameterImpl is dangerous because the same type parameter can be represented by different descriptors. For example, the test equalsOnFunctionParameters.kt was flaky before this change because of this issue, and that could be reproduced by running it a few hundred times in the same process. Instead, use the type parameter's container (which is either KClass or KCallable) and name, in equals/hashCode. KClass and KCallable already have equals/hashCode independent of descriptors, so this works in case the descriptor is invalidated.