[FIR] Add toString to all type scopes

This commit is contained in:
Dmitriy Novozhilov
2021-12-09 12:02:10 +03:00
parent e4978d8022
commit d588b2e654
9 changed files with 36 additions and 0 deletions
@@ -87,4 +87,8 @@ class JavaAnnotationSyntheticPropertiesScope(
override fun getClassifierNames(): Set<Name> {
return delegateScope.getClassifierNames()
}
override fun toString(): String {
return "Java annotation synthetic properties scope for $classId"
}
}
@@ -133,4 +133,8 @@ class JavaClassMembersEnhancementScope(
override fun mayContainName(name: Name): Boolean {
return useSiteMemberScope.mayContainName(name)
}
override fun toString(): String {
return "Java enhancement scope for ${owner.classId}"
}
}
@@ -501,6 +501,10 @@ class JavaClassUseSiteMemberScope(
null
}
}
override fun toString(): String {
return "Java use site scope of $classId"
}
}
private fun FirCallableSymbol<*>.isFromBuiltInClass(session: FirSession) =
@@ -209,4 +209,8 @@ class JvmMappedScope(
return Signatures(visibleMethodsByName, hiddenConstructors)
}
}
override fun toString(): String {
return "JVM mapped scope for ${firKotlinClass.classId}"
}
}
@@ -347,6 +347,10 @@ class FirClassSubstitutionScope(
override fun getClassifierNames(): Set<Name> {
return useSiteMemberScope.getClassifierNames()
}
override fun toString(): String {
return "Substitution scope for [$useSiteMemberScope] for type $dispatchReceiverTypeForSubstitutedMembers"
}
}
class FirSubstitutionOverrideStorage(val session: FirSession) : FirSessionComponent {
@@ -55,4 +55,8 @@ class FirClassUseSiteMemberScope(
}
return result
}
override fun toString(): String {
return "Use site scope of $classId"
}
}
@@ -83,4 +83,8 @@ class FirScopeWithFakeOverrideTypeCalculator(
override val scopeOwnerLookupNames: List<String>
get() = delegate.scopeOwnerLookupNames
override fun toString(): String {
return delegate.toString()
}
}
@@ -127,6 +127,10 @@ class FirTypeIntersectionScope private constructor(
return scopes.flatMapTo(hashSetOf()) { it.getClassifierNames() }
}
override fun toString(): String {
return "Intersection of [${scopes.joinToString(", ")}]"
}
companion object {
fun prepareIntersectionScope(
session: FirSession,
@@ -58,6 +58,10 @@ abstract class FirTypeScope : FirContainingNamesAwareScope() {
override fun getCallableNames(): Set<Name> = emptySet()
override fun getClassifierNames(): Set<Name> = emptySet()
override fun toString(): String {
return "Empty scope"
}
}
protected companion object {