Add variance and isReified into KtTypeParameterSymbol
This commit is contained in:
+3
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.*
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
sealed class KtClassifierSymbol : KtSymbol, KtNamedSymbol
|
||||
|
||||
@@ -16,6 +17,8 @@ abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbol {
|
||||
abstract override fun createPointer(): KtSymbolPointer<KtTypeParameterSymbol>
|
||||
|
||||
abstract val upperBounds: List<KtType>
|
||||
abstract val variance: Variance
|
||||
abstract val isReified: Boolean
|
||||
}
|
||||
|
||||
sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtNamedSymbol, KtSymbolWithKind {
|
||||
|
||||
+4
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtPsiBasedSymbolP
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.idea.frontend.api.types.KtType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
internal class KtFirTypeParameterSymbol(
|
||||
fir: FirTypeParameter,
|
||||
@@ -34,6 +35,9 @@ internal class KtFirTypeParameterSymbol(
|
||||
fir.bounds.map { type -> builder.buildKtType(type) }
|
||||
}
|
||||
|
||||
override val variance: Variance get() = firRef.withFir { it.variance }
|
||||
override val isReified: Boolean get() = firRef.withFir { it.isReified }
|
||||
|
||||
override fun createPointer(): KtSymbolPointer<KtTypeParameterSymbol> {
|
||||
KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it }
|
||||
TODO("Creating symbols for library type parameters is not supported yet")
|
||||
|
||||
@@ -4,14 +4,18 @@ class A<T, R> {
|
||||
// SYMBOLS:
|
||||
/*
|
||||
KtFirTypeParameterSymbol:
|
||||
isReified: false
|
||||
name: T
|
||||
origin: SOURCE
|
||||
upperBounds: [kotlin/Any?]
|
||||
variance: INVARIANT
|
||||
|
||||
KtFirTypeParameterSymbol:
|
||||
isReified: false
|
||||
name: R
|
||||
origin: SOURCE
|
||||
upperBounds: [kotlin/Any?]
|
||||
variance: INVARIANT
|
||||
|
||||
KtFirClassOrObjectSymbol:
|
||||
annotations: []
|
||||
|
||||
@@ -3,9 +3,11 @@ fun <X> foo(x: X) {}
|
||||
// SYMBOLS:
|
||||
/*
|
||||
KtFirTypeParameterSymbol:
|
||||
isReified: false
|
||||
name: X
|
||||
origin: SOURCE
|
||||
upperBounds: [kotlin/Any?]
|
||||
variance: INVARIANT
|
||||
|
||||
KtFirFunctionValueParameterSymbol:
|
||||
annotatedType: [] X
|
||||
|
||||
Reference in New Issue
Block a user