Kapt: Substitute type parameters from the actual type, not from the anonymous one (KT-19700)
This commit is contained in:
committed by
Yan Zhulanow
parent
4e4291c586
commit
4d9a612a64
@@ -63,12 +63,12 @@ class AnonymousTypeHandler(private val converter: ClassFileToSourceStubConverter
|
|||||||
|
|
||||||
val actualType = when {
|
val actualType = when {
|
||||||
isAnonymousObject(declaration) -> findMostSuitableParentForAnonymousType(declaration)
|
isAnonymousObject(declaration) -> findMostSuitableParentForAnonymousType(declaration)
|
||||||
else -> declaration.defaultType
|
else -> type
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.arguments.isEmpty()) return actualType
|
if (actualType.arguments.isEmpty()) return actualType
|
||||||
|
|
||||||
val arguments = type.arguments.map { typeArg ->
|
val arguments = actualType.arguments.map { typeArg ->
|
||||||
if (typeArg.isStarProjection) return@map typeArg
|
if (typeArg.isStarProjection) return@map typeArg
|
||||||
TypeProjectionImpl(typeArg.projectionKind, convertPossiblyAnonymousType(typeArg.type))
|
TypeProjectionImpl(typeArg.projectionKind, convertPossiblyAnonymousType(typeArg.type))
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -192,6 +192,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt19700.kt")
|
||||||
|
public void testKt19700() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/kt19700.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mapEntry.kt")
|
@TestMetadata("mapEntry.kt")
|
||||||
public void testMapEntry() throws Exception {
|
public void testMapEntry() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/mapEntry.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/mapEntry.kt");
|
||||||
|
|||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class Test<T : CharSequence, N : Number> {
|
||||||
|
private val x = object : ListUpdateCallback {
|
||||||
|
override fun onInserted(position: Int, count: Int) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ListUpdateCallback {
|
||||||
|
fun onInserted(position: Int, count: Int)
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
@kotlin.Metadata()
|
||||||
|
public abstract interface ListUpdateCallback {
|
||||||
|
|
||||||
|
public abstract void onInserted(int position, int count);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
|
||||||
|
package test;
|
||||||
|
|
||||||
|
@kotlin.Metadata()
|
||||||
|
public final class Test<T extends java.lang.CharSequence, N extends java.lang.Number> {
|
||||||
|
private final test.ListUpdateCallback x = null;
|
||||||
|
|
||||||
|
public Test() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user