mirror of
https://github.com/github/codeql.git
synced 2025-12-19 02:13:17 +01:00
Exclude enum constructor invocations from defaults handling
These seem to provide null arguments even though the constructor doesn't provide defaults, presumably for completion by a later compiler phase.
This commit is contained in:
@@ -2938,7 +2938,9 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
val locId = tw.getLocation(e)
|
||||
val valueArgs = (0 until e.valueArgumentsCount).map { e.getValueArgument(it) }
|
||||
val anyDefaultArgs = valueArgs.any { it == null }
|
||||
// For now, don't try to use default methods for enum constructor calls,
|
||||
// which have null arguments even though the parameters don't give default values.
|
||||
val anyDefaultArgs = e !is IrEnumConstructorCall && valueArgs.any { it == null }
|
||||
val id = if (anyDefaultArgs) {
|
||||
extractNewExpr(getDefaultsMethodLabel(e.symbol.owner).cast(), type, locId, parent, idx, callable, enclosingStmt).also {
|
||||
extractDefaultsCallArguments(it, e.symbol.owner, callable, enclosingStmt, valueArgs, null, null)
|
||||
|
||||
Reference in New Issue
Block a user