Use consistent descriptors as keys
This commit fixes exception during IR generation with enabled new inferece, but the problem also can affect old inference. We were using originalTypeArguments (`resolvedCall.typeArguments`) that uses type parameters from *candidate* descriptor and were trying to get value by key from `resolvedCall.resultingDescriptor.original`, assuming that resolvedCall.resultingDescriptor.original equals to resolvedCall.candidateDescriptor, which can be wrong
This commit is contained in:
+2
-1
@@ -381,6 +381,7 @@ fun StatementGenerator.pregenerateCallReceivers(resolvedCall: ResolvedCall<*>):
|
||||
|
||||
fun unwrapCallableDescriptorAndTypeArguments(resolvedCall: ResolvedCall<*>): CallBuilder {
|
||||
val originalDescriptor = resolvedCall.resultingDescriptor
|
||||
val candidateDescriptor = resolvedCall.candidateDescriptor
|
||||
|
||||
val unwrappedDescriptor = when (originalDescriptor) {
|
||||
is ImportedFromObjectCallableDescriptor<*> -> originalDescriptor.callableFromObject
|
||||
@@ -404,7 +405,7 @@ fun unwrapCallableDescriptorAndTypeArguments(resolvedCall: ResolvedCall<*>): Cal
|
||||
null
|
||||
else
|
||||
unsubstitutedUnwrappedTypeParameters.associate {
|
||||
val originalTypeParameter = originalDescriptor.original.typeParameters[it.index]
|
||||
val originalTypeParameter = candidateDescriptor.typeParameters[it.index]
|
||||
val originalTypeArgument = originalTypeArguments[originalTypeParameter]
|
||||
?: throw AssertionError("No type argument for $originalTypeParameter")
|
||||
it to originalTypeArgument
|
||||
|
||||
Reference in New Issue
Block a user