[IR] Fixed a problem with signature search
The function findDescriptorBySignature should return null if no such signature has been found letting the caller to handle this correctly. Fixes https://youtrack.jetbrains.com/issue/KT-50976
This commit is contained in:
+1
-7
@@ -151,13 +151,7 @@ class DescriptorByIdSignatureFinderImpl(
|
|||||||
}
|
}
|
||||||
val candidates = acc
|
val candidates = acc
|
||||||
|
|
||||||
return when (candidates.size) {
|
return candidates.singleOrNull() ?: findDescriptorByHash(candidates, signature.id)
|
||||||
1 -> candidates.first()
|
|
||||||
else -> {
|
|
||||||
findDescriptorByHash(candidates, signature.id)
|
|
||||||
?: error("No descriptor found for $signature")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findDescriptorByHash(candidates: Collection<DeclarationDescriptor>, id: Long?): DeclarationDescriptor? =
|
private fun findDescriptorByHash(candidates: Collection<DeclarationDescriptor>, id: Long?): DeclarationDescriptor? =
|
||||||
|
|||||||
Reference in New Issue
Block a user