mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Kotlin: Fix array set operator extraction
This commit is contained in:
@@ -2208,7 +2208,7 @@ open class KotlinFileExtractor(
|
||||
tw.writeExprsKotlinType(id, type.kotlinResult.id)
|
||||
binopDisp(id)
|
||||
}
|
||||
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "set") && c.origin == IrStatementOrigin.EQ -> {
|
||||
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "set") && c.origin == IrStatementOrigin.EQ && c.dispatchReceiver != null -> {
|
||||
val array = c.dispatchReceiver
|
||||
val arrayIdx = c.getValueArgument(0)
|
||||
val assignedValue = c.getValueArgument(1)
|
||||
|
||||
@@ -33,9 +33,21 @@ test.kt:
|
||||
# 6| 3: [ExprStmt] <Expr>;
|
||||
# 6| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
|
||||
# 6| 0: [TypeAccess] Unit
|
||||
# 6| 1: [MethodAccess] set(...)
|
||||
# 6| -1: [TypeAccess] TestKt
|
||||
# 6| 0: [VarAccess] arr
|
||||
# 6| 1: [IntegerLiteral] 1
|
||||
# 6| 2: [IntegerLiteral] 2
|
||||
# 6| 3: [IntegerLiteral] 3
|
||||
# 7| 4: [ExprStmt] <Expr>;
|
||||
# 7| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
|
||||
# 7| 0: [TypeAccess] Unit
|
||||
# 7| 1: [MethodAccess] set(...)
|
||||
# 7| -1: [TypeAccess] TestKt
|
||||
# 7| 0: [VarAccess] arr
|
||||
# 7| 1: [IntegerLiteral] 1
|
||||
# 7| 2: [ClassInstanceExpr] new C(...)
|
||||
# 7| -3: [TypeAccess] C
|
||||
# 10| 2: [ExtensionMethod] get
|
||||
# 10| 3: [TypeAccess] String
|
||||
#-----| 4: (Parameters)
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
| test.kt:6:5:6:13 | Unexpected Array.set function signature |
|
||||
| test.kt:7:5:7:10 | Unexpected Array.set function signature |
|
||||
|
||||
Reference in New Issue
Block a user