[AA K2] add missing resolve for signature creation

^KT-54311
This commit is contained in:
Dmitrii Gridin
2022-11-07 12:04:45 +01:00
committed by Space Team
parent 202a022b49
commit 638eccac16
6 changed files with 10 additions and 7 deletions
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.ideSessionComponents
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
import org.jetbrains.kotlin.fir.renderWithType
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
import org.jetbrains.kotlin.fir.scopes.FirScope
@@ -16,6 +17,7 @@ import org.jetbrains.kotlin.fir.scopes.processClassifiersByName
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.Name
@@ -59,13 +61,14 @@ internal inline fun <reified D : FirDeclaration> Collection<FirCallableSymbol<*>
return declaration
}
}
return null
}
internal fun FirBasedSymbol<*>.createSignature(): IdSignature =
fir.createSignature()
internal fun FirBasedSymbol<*>.createSignature(): IdSignature = fir.createSignature()
internal fun FirDeclaration.createSignature(): IdSignature {
lazyResolveToPhase(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE)
val signatureComposer = moduleData.session.ideSessionComponents.signatureComposer
return signatureComposer.composeSignature(this, allowLocalClasses = true)
?: error("Could not compose signature for ${this.renderWithType()}, looks like it is private or local")
@@ -1,4 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
annotation class ReceiverAnnotation
@Target(AnnotationTarget.TYPE)
annotation class ReceiverTypeAnnotation
@@ -1,4 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
class A {
val a: Int = 10
fun x() = 10
@@ -1,4 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
context(kotlin.Int, s@kotlin.String)
class A {
constructor(int: Int) {}
@@ -1,4 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
class A {
constructor(i: Int)
}
@@ -1,4 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
val x: Int = 10
val Int.y get() = this