IR: fix IrClassSymbol.starProjectedType
This commit is contained in:
Generated
+5
@@ -1477,6 +1477,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt12416.kt")
|
||||
public void testKt12416() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/kt12416.kt");
|
||||
|
||||
@@ -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 })
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
class Outer<OP> {
|
||||
inner class Inner<IP>
|
||||
|
||||
fun <T> withInner(block: Inner<T>.() -> String) = Inner<T>().block()
|
||||
}
|
||||
|
||||
fun <TT> withOuter(block: Outer<TT>.() -> String) = Outer<TT>().block()
|
||||
|
||||
fun box() = withOuter<Int> {
|
||||
withInner<Boolean> {
|
||||
"OK"
|
||||
}
|
||||
}
|
||||
+5
@@ -1497,6 +1497,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt12416.kt")
|
||||
public void testKt12416() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/kt12416.kt");
|
||||
|
||||
+5
@@ -1497,6 +1497,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt12416.kt")
|
||||
public void testKt12416() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/kt12416.kt");
|
||||
|
||||
+5
@@ -1477,6 +1477,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt12416.kt")
|
||||
public void testKt12416() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/kt12416.kt");
|
||||
|
||||
Generated
+5
@@ -1082,6 +1082,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jsName.kt")
|
||||
public void testJsName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/jsName.kt");
|
||||
|
||||
Generated
+5
@@ -1082,6 +1082,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jsName.kt")
|
||||
public void testJsName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/jsName.kt");
|
||||
|
||||
+5
@@ -1082,6 +1082,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jsName.kt")
|
||||
public void testJsName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/jsName.kt");
|
||||
|
||||
Generated
+5
@@ -937,6 +937,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/bridges/genericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeParameters.kt")
|
||||
public void testInnerClassTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt12416.kt")
|
||||
public void testKt12416() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/bridges/kt12416.kt");
|
||||
|
||||
Reference in New Issue
Block a user