Kotlin: Fix array indexer extraction

This commit is contained in:
Tamas Vajk
2022-09-01 11:12:14 +02:00
parent afeea64078
commit a5415c9c8a
3 changed files with 5 additions and 4 deletions

View File

@@ -2185,7 +2185,7 @@ open class KotlinFileExtractor(
}
}
}
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "get") && c.origin == IrStatementOrigin.GET_ARRAY_ELEMENT -> {
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "get") && c.origin == IrStatementOrigin.GET_ARRAY_ELEMENT && c.dispatchReceiver != null -> {
val id = tw.getFreshIdLabel<DbArrayaccess>()
val type = useType(c.type)
tw.writeExprs_arrayaccess(id, type.javaResult.id, parent, idx)

View File

@@ -18,8 +18,11 @@ test.kt:
# 3| 1: [ExprStmt] <Expr>;
# 3| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
# 3| 0: [TypeAccess] Unit
# 3| 1: [ArrayAccess] ...[...]
# 3| 1: [MethodAccess] get(...)
# 3| -1: [TypeAccess] TestKt
# 3| 0: [VarAccess] arr
# 3| 1: [IntegerLiteral] 1
# 3| 2: [IntegerLiteral] 2
# 4| 2: [ExprStmt] <Expr>;
# 4| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
# 4| 0: [TypeAccess] Unit

View File

@@ -1,2 +0,0 @@
| test.kt:3:5:3:13 | Dispatch receiver not found |
| test.kt:3:5:3:13 | Extra arguments found |