Skip to content

Commit b8a2716

Browse files
authored
Merge pull request github#14835 from igfoo/igfoo/findTopLevelFunctionOrWarn
Kotlin: Fix findTopLevelFunctionOrWarn for Kotlin 2
2 parents fab6813 + 5c36e63 commit b8a2716

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,8 +2457,12 @@ open class KotlinFileExtractor(
24572457

24582458
val fn = getFunctionsByFqName(pluginContext, functionPkg, functionName)
24592459
.firstOrNull { fnSymbol ->
2460-
fnSymbol.owner.parentClassOrNull?.fqNameWhenAvailable?.asString() == type &&
2461-
fnSymbol.owner.valueParameters.map { it.type.classFqName?.asString() }.toTypedArray() contentEquals parameterTypes
2460+
val owner = fnSymbol.owner
2461+
(owner.parentClassOrNull?.fqNameWhenAvailable?.asString() == type
2462+
||
2463+
(owner.parent is IrExternalPackageFragment && getFileClassFqName(owner)?.asString() == type))
2464+
&&
2465+
owner.valueParameters.map { it.type.classFqName?.asString() }.toTypedArray() contentEquals parameterTypes
24622466
}?.owner
24632467

24642468
if (fn != null) {

0 commit comments

Comments
 (0)