Add correct type parameter information to synthetic declarations
Needed by kapt due to https://github.com/Kotlin/kotlinx.serialization/issues/76
This commit is contained in:
committed by
Leonid Startsev
parent
adc3e61742
commit
666553e413
+8
-6
@@ -50,13 +50,15 @@ class SyntheticClassOrObjectDescriptor(
|
||||
val syntheticDeclaration: KtPureClassOrObject = SyntheticDeclaration(parentClassOrObject, name.asString())
|
||||
|
||||
private val thisDescriptor: SyntheticClassOrObjectDescriptor get() = this // code readability
|
||||
var typeParameters: List<TypeParameterDescriptor> = emptyList()
|
||||
|
||||
private val typeConstructor = SyntheticTypeConstructor(c.storageManager)
|
||||
private val resolutionScopesSupport = ClassResolutionScopesSupport(thisDescriptor, c.storageManager, c.languageVersionSettings, { outerScope })
|
||||
private val syntheticSupertypes =
|
||||
mutableListOf<KotlinType>().apply { c.syntheticResolveExtension.addSyntheticSupertypes(thisDescriptor, this) }
|
||||
private val unsubstitutedMemberScope =
|
||||
LazyClassMemberScope(c, SyntheticClassMemberDeclarationProvider(syntheticDeclaration), this, c.trace)
|
||||
private val unsubstitutedPrimaryConstructor = createUnsubstitutedPrimaryConstructor(constructorVisibility)
|
||||
private val _unsubstitutedPrimaryConstructor by lazy { createUnsubstitutedPrimaryConstructor(constructorVisibility) }
|
||||
|
||||
override val annotations: Annotations get() = Annotations.EMPTY
|
||||
|
||||
@@ -70,11 +72,11 @@ class SyntheticClassOrObjectDescriptor(
|
||||
override fun isExpect() = false
|
||||
override fun isActual() = false
|
||||
|
||||
override fun getCompanionObjectDescriptor() = null
|
||||
override fun getCompanionObjectDescriptor(): ClassDescriptorWithResolutionScopes? = null
|
||||
override fun getTypeConstructor(): TypeConstructor = typeConstructor
|
||||
override fun getUnsubstitutedPrimaryConstructor() = unsubstitutedPrimaryConstructor
|
||||
override fun getConstructors() = listOf(unsubstitutedPrimaryConstructor)
|
||||
override fun getDeclaredTypeParameters() = emptyList<TypeParameterDescriptor>()
|
||||
override fun getUnsubstitutedPrimaryConstructor() = _unsubstitutedPrimaryConstructor
|
||||
override fun getConstructors() = listOf(_unsubstitutedPrimaryConstructor)
|
||||
override fun getDeclaredTypeParameters() = typeParameters
|
||||
override fun getStaticScope() = MemberScope.Empty
|
||||
override fun getUnsubstitutedMemberScope() = unsubstitutedMemberScope
|
||||
override fun getSealedSubclasses() = emptyList<ClassDescriptor>()
|
||||
@@ -110,7 +112,7 @@ class SyntheticClassOrObjectDescriptor(
|
||||
}
|
||||
|
||||
private inner class SyntheticTypeConstructor(storageManager: StorageManager) : AbstractClassTypeConstructor(storageManager) {
|
||||
override fun getParameters(): List<TypeParameterDescriptor> = emptyList()
|
||||
override fun getParameters(): List<TypeParameterDescriptor> = typeParameters
|
||||
override fun isDenotable(): Boolean = true
|
||||
override fun getDeclarationDescriptor(): ClassDescriptor = thisDescriptor
|
||||
override fun computeSupertypes(): Collection<KotlinType> = syntheticSupertypes
|
||||
|
||||
Reference in New Issue
Block a user