Kotlin: Fix isUnspecialised to handle generic classes inside generic methods

This commit is contained in:
Tamas Vajk
2022-09-09 11:13:48 +02:00
parent 3267d7c96e
commit b8b0fd8a74
8 changed files with 21 additions and 22 deletions

View File

@@ -220,7 +220,7 @@ open class KotlinUsesExtractor(
val extractedTypeArgs = when {
extractClass.symbol.isKFunction() && typeArgs != null && typeArgs.isNotEmpty() -> listOf(typeArgs.last())
extractClass.fqNameWhenAvailable == FqName("kotlin.jvm.functions.FunctionN") && typeArgs != null && typeArgs.isNotEmpty() -> listOf(typeArgs.last())
typeArgs != null && isUnspecialised(c, typeArgs) -> listOf()
typeArgs != null && isUnspecialised(c, typeArgs, logger) -> listOf()
else -> typeArgs
}
@@ -479,7 +479,7 @@ open class KotlinUsesExtractor(
fun useSimpleTypeClass(c: IrClass, args: List<IrTypeArgument>?, hasQuestionMark: Boolean): TypeResults {
if (c.isAnonymousObject) {
args?.let {
if (it.isNotEmpty() && !isUnspecialised(c, it)) {
if (it.isNotEmpty() && !isUnspecialised(c, it, logger)) {
logger.error("Unexpected specialised instance of generic anonymous class")
}
}