mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Kotlin: Fix vararg extraction outside of method call
This commit is contained in:
@@ -3056,7 +3056,13 @@ open class KotlinFileExtractor(
|
||||
extractTypeOperatorCall(e, callable, exprParent.parent, exprParent.idx, exprParent.enclosingStmt)
|
||||
}
|
||||
is IrVararg -> {
|
||||
logger.errorElement("Unexpected IrVararg", e)
|
||||
if (e.elements.size != 1 || e.elements[0] !is IrSpreadElement) {
|
||||
logger.errorElement("Unexpected IrVararg", e)
|
||||
return
|
||||
}
|
||||
// There are lowered IR cases when the vararg expression is not within a call, such as
|
||||
// val temp0 = [*expr]
|
||||
extractExpression((e.elements[0] as IrSpreadElement).expression, callable, parent)
|
||||
}
|
||||
is IrGetObjectValue -> {
|
||||
// For `object MyObject { ... }`, the .class has an
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
diag
|
||||
| test.kt:55:15:55:35 | Unexpected IrVararg |
|
||||
varargsParams
|
||||
| test.kt:8:15:8:28 | xs | file://:0:0:0:0 | int[] |
|
||||
| test.kt:12:26:12:39 | xs | file://:0:0:0:0 | int[] |
|
||||
@@ -84,3 +83,4 @@ implicitVarargsArguments
|
||||
| test.kt:45:5:45:39 | new HasVarargConstructor(...) | 1 | test.kt:45:34:45:38 | array |
|
||||
| test.kt:55:13:55:43 | new X(...) | 0 | test.kt:55:42:55:42 | 1 |
|
||||
| test.kt:55:13:55:43 | new X(...) | 1 | test.kt:55:15:55:35 | tmp0_s |
|
||||
| test.kt:55:22:55:35 | toTypedArray(...) | 0 | test.kt:55:19:55:20 | sl |
|
||||
|
||||
Reference in New Issue
Block a user