[KAPT] KT-64389 Fix stub generation with generic type constraints

This commit is contained in:
strangepleasures
2023-12-19 09:01:06 +01:00
committed by Space Team
parent 4783822fbc
commit b32f408767
6 changed files with 96 additions and 1 deletions
@@ -0,0 +1,9 @@
interface I1
interface I2
interface I3
interface I4
class C<T1, T2> where T1 : I1, T1 : I2, T2: I3, T2: I4
@@ -0,0 +1,68 @@
/**
* public final class C<T#0 (* T1 *) : I1 & I2, T#1 (* T2 *) : I3 & I4> : kotlin/Any {
*
* // signature: <init>()V
* public constructor()
*
* // module name: main
* }
*/
@kotlin.Metadata()
public final class C<T1 extends I1 & I2, T2 extends I3 & I4> {
public C() {
super();
}
}
////////////////////
/**
* public abstract interface I1 : kotlin/Any {
*
* // module name: main
* }
*/
@kotlin.Metadata()
public abstract interface I1 {
}
////////////////////
/**
* public abstract interface I2 : kotlin/Any {
*
* // module name: main
* }
*/
@kotlin.Metadata()
public abstract interface I2 {
}
////////////////////
/**
* public abstract interface I3 : kotlin/Any {
*
* // module name: main
* }
*/
@kotlin.Metadata()
public abstract interface I3 {
}
////////////////////
/**
* public abstract interface I4 : kotlin/Any {
*
* // module name: main
* }
*/
@kotlin.Metadata()
public abstract interface I4 {
}
@@ -571,6 +571,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
runTest("plugins/kapt3/kapt3-compiler/testData/converter/multifileClassDefaultPackage.kt");
}
@Test
@TestMetadata("multipleTypeConstraints.kt")
public void testMultipleTypeConstraints() throws Exception {
runTest("plugins/kapt3/kapt3-compiler/testData/converter/multipleTypeConstraints.kt");
}
@Test
@TestMetadata("nestedClasses.kt")
public void testNestedClasses() throws Exception {
@@ -571,6 +571,12 @@ public class IrClassFileToSourceStubConverterTestGenerated extends AbstractIrCla
runTest("plugins/kapt3/kapt3-compiler/testData/converter/multifileClassDefaultPackage.kt");
}
@Test
@TestMetadata("multipleTypeConstraints.kt")
public void testMultipleTypeConstraints() throws Exception {
runTest("plugins/kapt3/kapt3-compiler/testData/converter/multipleTypeConstraints.kt");
}
@Test
@TestMetadata("nestedClasses.kt")
public void testNestedClasses() throws Exception {
@@ -437,7 +437,7 @@ private class StubGenerator(
printWithNoIndent(param.name, " extends ")
if (param.extendsListTypes.isNotEmpty()) {
param.extendsListTypes.forEachIndexed { i, t ->
if (i > 0) printWithNoIndent(", ")
if (i > 0) printWithNoIndent(" & ")
printType(t)
}
} else {
@@ -571,6 +571,12 @@ public class KotlinKapt4ContextTestGenerated extends AbstractKotlinKapt4ContextT
runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/multifileClassDefaultPackage.kt");
}
@Test
@TestMetadata("multipleTypeConstraints.kt")
public void testMultipleTypeConstraints() throws Exception {
runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/multipleTypeConstraints.kt");
}
@Test
@TestMetadata("nestedClasses.kt")
public void testNestedClasses() throws Exception {