Merge pull request #14835 from igfoo/igfoo/findTopLevelFunctionOrWarn

Kotlin: Fix findTopLevelFunctionOrWarn for Kotlin 2
This commit is contained in:
Ian Lynagh
2023-11-20 12:11:58 +00:00
committed by GitHub

View File

@@ -2457,8 +2457,12 @@ open class KotlinFileExtractor(
val fn = getFunctionsByFqName(pluginContext, functionPkg, functionName)
.firstOrNull { fnSymbol ->
fnSymbol.owner.parentClassOrNull?.fqNameWhenAvailable?.asString() == type &&
fnSymbol.owner.valueParameters.map { it.type.classFqName?.asString() }.toTypedArray() contentEquals parameterTypes
val owner = fnSymbol.owner
(owner.parentClassOrNull?.fqNameWhenAvailable?.asString() == type
||
(owner.parent is IrExternalPackageFragment && getFileClassFqName(owner)?.asString() == type))
&&
owner.valueParameters.map { it.type.classFqName?.asString() }.toTypedArray() contentEquals parameterTypes
}?.owner
if (fn != null) {