K2: use lookupTag instead of classId in use-site scopes

We used this classId to get an associated symbol,
but this way is anyway not recommended (e.g. problems with local classes).
In this commit we migrated to usage of lookup tags instead.
This commit is contained in:
Mikhail Glukhikh
2023-12-20 10:22:17 +01:00
committed by Space Team
parent 79e041a310
commit 2f29738989
4 changed files with 9 additions and 10 deletions
@@ -617,7 +617,7 @@ private class ElementsToShortenCollector(
private fun FirScope.correspondingClassIdIfExists(): ClassId = when (this) {
is FirNestedClassifierScope -> klass.classId
is FirNestedClassifierScopeWithSubstitution -> originalScope.correspondingClassIdIfExists()
is FirClassUseSiteMemberScope -> classId
is FirClassUseSiteMemberScope -> ownerClassLookupTag.classId
else -> errorWithAttachment("FirScope ${this::class}` is expected to be one of FirNestedClassifierScope and FirClassUseSiteMemberScope to get ClassId") {
withEntry("firScope", this@correspondingClassIdIfExists) { it.toString() }
}