IR: fix IrClassSymbol.starProjectedType
This commit is contained in:
@@ -635,13 +635,7 @@ open class IrBasedClassDescriptor(owner: IrClass) : ClassDescriptor, IrBasedDecl
|
||||
}
|
||||
|
||||
private fun collectTypeParameters(): List<TypeParameterDescriptor> =
|
||||
generateSequence(owner as IrTypeParametersContainer,
|
||||
{ current ->
|
||||
val parent = current.parent as? IrTypeParametersContainer
|
||||
if (parent is IrClass && current is IrClass && !current.isInner) null
|
||||
else parent
|
||||
})
|
||||
.flatMap { it.typeParameters }
|
||||
owner.typeConstructorParameters
|
||||
.map { it.toIrBasedDescriptor() }
|
||||
.toList()
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrFail
|
||||
import org.jetbrains.kotlin.ir.types.toKotlinType
|
||||
import org.jetbrains.kotlin.ir.types.typeConstructorParameters
|
||||
import org.jetbrains.kotlin.ir.util.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
@@ -612,13 +613,7 @@ open class WrappedClassDescriptor : ClassDescriptor, WrappedDeclarationDescripto
|
||||
}
|
||||
|
||||
private fun collectTypeParameters(): List<TypeParameterDescriptor> =
|
||||
generateSequence(owner as IrTypeParametersContainer,
|
||||
{ current ->
|
||||
val parent = current.parent as? IrTypeParametersContainer
|
||||
if (parent is IrClass && current is IrClass && !current.isInner) null
|
||||
else parent
|
||||
})
|
||||
.flatMap { it.typeParameters }
|
||||
owner.typeConstructorParameters
|
||||
.map { it.descriptor }
|
||||
.toList()
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||
@@ -149,10 +150,19 @@ val IrClassSymbol.starProjectedType: IrSimpleType
|
||||
get() = IrSimpleTypeImpl(
|
||||
this,
|
||||
hasQuestionMark = false,
|
||||
arguments = owner.typeParameters.map { IrStarProjectionImpl },
|
||||
arguments = owner.typeConstructorParameters.map { IrStarProjectionImpl }.toList(),
|
||||
annotations = emptyList()
|
||||
)
|
||||
|
||||
val IrClass.typeConstructorParameters: Sequence<IrTypeParameter>
|
||||
get() = generateSequence(this as IrTypeParametersContainer,
|
||||
{ current ->
|
||||
val parent = current.parent as? IrTypeParametersContainer
|
||||
if (parent is IrClass && current is IrClass && !current.isInner) null
|
||||
else parent
|
||||
})
|
||||
.flatMap { it.typeParameters }
|
||||
|
||||
fun IrClassifierSymbol.typeWithParameters(parameters: List<IrTypeParameter>): IrSimpleType =
|
||||
typeWith(parameters.map { it.defaultType })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user