mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
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:
committed by
Ian Lynagh
parent
aa0ddeb29a
commit
67e3374a23
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user