AA FE1.0: don't return psi for fake overrides

This commit is contained in:
Jinseong Jeon
2022-08-17 17:38:26 -07:00
committed by Ilya Kirillov
parent 25f7554a31
commit 79686ba242
4 changed files with 4 additions and 13 deletions
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.analysis.api.descriptors.symbols.base.KtFe10Annotate
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.base.KtFe10Symbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbolOrigin
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource
import org.jetbrains.kotlin.descriptors.SourceElement
@@ -25,15 +24,7 @@ internal interface KtFe10DescSymbol<T : DeclarationDescriptor> : KtFe10Symbol, K
val source: SourceElement
get() = withValidityAssertion {
val descriptor = this.descriptor
if (descriptor is CallableMemberDescriptor && descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
val firstOverridden = descriptor.overriddenDescriptors.firstOrNull()
if (firstOverridden != null) {
return firstOverridden.source
}
}
return (descriptor as? DeclarationDescriptorWithSource)?.source ?: SourceElement.NO_SOURCE
(descriptor as? DeclarationDescriptorWithSource)?.source ?: SourceElement.NO_SOURCE
}
override val psi: PsiElement?
@@ -40,7 +40,6 @@ fun FirElement.findPsi(project: Project): PsiElement? =
getAllowedPsi()
?: FirDeserializedDeclarationSourceProvider.findPsi(this, project)
fun FirBasedSymbol<*>.findPsi(): PsiElement? =
fir.findPsi(fir.moduleData.session)
@@ -51,7 +51,7 @@ public interface KtMemberSymbolProviderMixin : KtAnalysisSessionMixIn {
* in `A` that takes the type parameter `T`. Given such a derived symbol, [originalOverriddenSymbol] recovers the original declared
* symbol.
*
* Such situation can also happens for intersection symbols (in case of multiple super types containing symbols with identical signature
* Such situation can also happen for intersection symbols (in case of multiple super types containing symbols with identical signature
* after specialization) and delegation.
*/
public val KtCallableSymbol.originalOverriddenSymbol: KtCallableSymbol?
@@ -95,7 +95,8 @@ public enum class KtSymbolOrigin {
* interface B : A<Int> { }
* ```
*
* The B will have a member B.foo(): Int, this member is generated inside interface B with substtution T -> Int, such members are SUBSTITUTION_OVERRIDE
* The B will have a member B.foo(): Int, this member is generated inside interface B with substitution T -> Int,
* such members are SUBSTITUTION_OVERRIDE
*/
SUBSTITUTION_OVERRIDE,