Accept and amend check for anonymous types with type parameters

This commit is contained in:
Chris Smowton
2022-03-17 18:54:44 +00:00
committed by Ian Lynagh
parent c0f3988aaa
commit 96908d153d
9 changed files with 119 additions and 14 deletions

View File

@@ -1126,17 +1126,6 @@ open class KotlinFileExtractor(
extractNewExprForLocalFunction(ids, id, locId, enclosingCallable, enclosingStmt)
} else {
// Returns true if type is C<T1, T2, ...> where C is declared `class C<T1, T2, ...> { ... }`
fun isUnspecialised(type: IrSimpleType) =
type.classifier.owner is IrClass &&
(type.classifier.owner as IrClass).typeParameters.zip(type.arguments).all { paramAndArg ->
(paramAndArg.second as? IrTypeProjection)?.let {
// Type arg refers to the class' own type parameter?
it.variance == Variance.INVARIANT &&
it.type.classifierOrNull?.owner === paramAndArg.first
} ?: false
}
val methodId =
if (drType != null && extractClassTypeArguments && drType is IrSimpleType && !isUnspecialised(drType)) {
if (isBigArityFunctionInvoke) {