JVM IR: fix exception on star projection in type parameter upper bound
#KT-41761 Fixed
This commit is contained in:
@@ -151,7 +151,8 @@ private fun TypeSystemCommonBackendContext.doesTypeContainTypeParametersWithRecu
|
||||
used.remove(typeParameter)
|
||||
} else {
|
||||
for (i in 0 until type.argumentsCount()) {
|
||||
if (!doesTypeContainTypeParametersWithRecursiveBounds(type.getArgument(i).getType(), used)) return false
|
||||
val argument = type.getArgument(i)
|
||||
if (!argument.isStarProjection() && !doesTypeContainTypeParametersWithRecursiveBounds(argument.getType(), used)) return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
Generated
+5
@@ -27599,6 +27599,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/simplePropertyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionInUpperBound.kt")
|
||||
public void testStarProjectionInUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/starProjectionInUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFlags.kt")
|
||||
public void testTypeParameterFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/typeParameterFlags.kt");
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// WITH_REFLECT
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
import kotlin.reflect.KType
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
class C<T : Comparable<*>> {
|
||||
fun setOfT(): KType = typeOf<Set<T>>()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val s = C<Int>().setOfT()
|
||||
return if (s.toString().endsWith("Set<T>")) "OK" else "Fail: $s"
|
||||
}
|
||||
+5
@@ -29195,6 +29195,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/simplePropertyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionInUpperBound.kt")
|
||||
public void testStarProjectionInUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/starProjectionInUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFlags.kt")
|
||||
public void testTypeParameterFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/typeParameterFlags.kt");
|
||||
|
||||
+5
@@ -26829,6 +26829,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/simplePropertyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionInUpperBound.kt")
|
||||
public void testStarProjectionInUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/starProjectionInUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFlags.kt")
|
||||
public void testTypeParameterFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/typeParameterFlags.kt");
|
||||
|
||||
+5
@@ -27599,6 +27599,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/simplePropertyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionInUpperBound.kt")
|
||||
public void testStarProjectionInUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/starProjectionInUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFlags.kt")
|
||||
public void testTypeParameterFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/typeParameterFlags.kt");
|
||||
|
||||
Generated
+5
@@ -22655,6 +22655,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/simplePropertyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionInUpperBound.kt")
|
||||
public void testStarProjectionInUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/starProjectionInUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFlags.kt")
|
||||
public void testTypeParameterFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/typeParameterFlags.kt");
|
||||
|
||||
Generated
+5
@@ -22655,6 +22655,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/simplePropertyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionInUpperBound.kt")
|
||||
public void testStarProjectionInUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/starProjectionInUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFlags.kt")
|
||||
public void testTypeParameterFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/typeParameterFlags.kt");
|
||||
|
||||
+5
@@ -22670,6 +22670,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/simplePropertyParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjectionInUpperBound.kt")
|
||||
public void testStarProjectionInUpperBound() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/starProjectionInUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFlags.kt")
|
||||
public void testTypeParameterFlags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/typeOf/nonReifiedTypeParameters/typeParameterFlags.kt");
|
||||
|
||||
Reference in New Issue
Block a user