Fix inner generic type extraction

- Don't attribute type parameters that belong to the outer class to the inner
- Don't extract constructor generic parameters as if they were parameters of the type being instantiated
This commit is contained in:
Chris Smowton
2022-01-07 14:22:27 +00:00
committed by Ian Lynagh
parent aa0ddeb29a
commit 67e3374a23
2 changed files with 20 additions and 3 deletions

View File

@@ -1264,7 +1264,12 @@ open class KotlinFileExtractor(
val typeAccessId = extractTypeAccess(typeAccessType, callable, id, -3, e, enclosingStmt)
if (e.typeArgumentsCount > 0) {
if (e is IrConstructorCall) {
// Only extract type arguments relating to the constructed type, not the constructor itself:
e.getClassTypeArguments().forEachIndexed({ argIdx, argType ->
extractTypeAccess(argType!!, callable, typeAccessId, argIdx, e, enclosingStmt, TypeContext.GENERIC_ARGUMENT)
})
} else {
extractTypeArguments(e, typeAccessId, callable, enclosingStmt)
}
}