K2 IC: fix lookup recording for a "red" companion object

#KT-63665 fixed
This commit is contained in:
Ilya Chernikov
2023-12-07 18:02:25 +01:00
committed by Space Team
parent 6dfcc927f4
commit ed820d6b57
6 changed files with 82 additions and 3 deletions
@@ -19,10 +19,13 @@ abstract class FirLookupTrackerComponent : FirSessionComponent {
}
fun FirLookupTrackerComponent.recordCallLookup(callInfo: AbstractCallInfo, inType: ConeKotlinType) {
if (inType.classId?.isLocal == true) return
val classId = inType.classId
if (classId?.isLocal == true) return
val scopes = SmartList(inType.renderForDebugging().replace('/', '.'))
if (inType.classId?.shortClassName?.asString() == "Companion") {
scopes.add(inType.classId!!.outerClassId!!.asString().replace('/', '.'))
if (classId != null && classId.shortClassName.asString() == "Companion") {
classId.outerClassId?.asString()?.replace('/', '.')?.let {
scopes.add(it)
}
}
recordLookup(callInfo.name, scopes, callInfo.callSite.source, callInfo.containingFile.source)
}