Skip to content

Commit a5415c9

Browse files
committed
Kotlin: Fix array indexer extraction
1 parent afeea64 commit a5415c9

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ open class KotlinFileExtractor(
21852185
}
21862186
}
21872187
}
2188-
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "get") && c.origin == IrStatementOrigin.GET_ARRAY_ELEMENT -> {
2188+
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "get") && c.origin == IrStatementOrigin.GET_ARRAY_ELEMENT && c.dispatchReceiver != null -> {
21892189
val id = tw.getFreshIdLabel<DbArrayaccess>()
21902190
val type = useType(c.type)
21912191
tw.writeExprs_arrayaccess(id, type.javaResult.id, parent, idx)

java/ql/test/kotlin/library-tests/operator-overloads/PrintAst.expected

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ test.kt:
1818
# 3| 1: [ExprStmt] <Expr>;
1919
# 3| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
2020
# 3| 0: [TypeAccess] Unit
21-
# 3| 1: [ArrayAccess] ...[...]
21+
# 3| 1: [MethodAccess] get(...)
22+
# 3| -1: [TypeAccess] TestKt
23+
# 3| 0: [VarAccess] arr
2224
# 3| 1: [IntegerLiteral] 1
25+
# 3| 2: [IntegerLiteral] 2
2326
# 4| 2: [ExprStmt] <Expr>;
2427
# 4| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
2528
# 4| 0: [TypeAccess] Unit
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
| test.kt:3:5:3:13 | Dispatch receiver not found |
2-
| test.kt:3:5:3:13 | Extra arguments found |

0 commit comments

Comments
 (0)