Kapt: Substitute type parameters from the actual type, not from the anonymous one (KT-19700)

This commit is contained in:
Yan Zhulanow
2017-08-17 18:32:54 +03:00
committed by Yan Zhulanow
parent 4e4291c586
commit 4d9a612a64
4 changed files with 40 additions and 3 deletions
@@ -63,12 +63,12 @@ class AnonymousTypeHandler(private val converter: ClassFileToSourceStubConverter
val actualType = when {
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
TypeProjectionImpl(typeArg.projectionKind, convertPossiblyAnonymousType(typeArg.type))
}
@@ -192,6 +192,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
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")
public void testMapEntry() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/kapt3/testData/converter/mapEntry.kt");
+11
View File
@@ -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
View File
@@ -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();
}
}