Skip to content

Commit bec9486

Browse files
committed
Fix calls to static methods defined in association with local functions
These are a bit weird since they involve static calls to unnamed synthetic class members, but while unwriteable as Java they ought to work as a database description.
1 parent b79d273 commit bec9486

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ open class KotlinFileExtractor(
17261726
val id = extractMethodAccessWithoutArgs(callsite.type, locId, enclosingCallable, callsiteParent, childIdx, enclosingStmt, defaultMethodLabel)
17271727

17281728
if (callTarget.isLocalFunction()) {
1729-
extractNewExprForLocalFunction(getLocallyVisibleFunctionLabels(callTarget), id, locId, enclosingCallable, enclosingStmt)
1729+
extractTypeAccess(getLocallyVisibleFunctionLabels(callTarget).type, locId, id, -1, enclosingCallable, enclosingStmt)
17301730
} else {
17311731
extractStaticTypeAccessQualifierUnchecked(callTarget.parent, id, locId, enclosingCallable, enclosingStmt)
17321732
}

java/ql/test/kotlin/library-tests/parameter-defaults/PrintAst.expected

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,17 +568,15 @@ test.kt:
568568
# 90| 5: [BlockStmt] { ... }
569569
# 91| 0: [ExprStmt] <Expr>;
570570
# 91| 0: [MethodAccess] f$default(...)
571-
# 91| -1: [ClassInstanceExpr] new (...)
572-
# 91| -3: [TypeAccess] Object
571+
# 91| -1: [TypeAccess]
573572
# 91| 0: [StringLiteral] local sunk
574573
# 1| 1: [NullLiteral] null
575574
# 1| 2: [NullLiteral] null
576575
# 1| 3: [IntegerLiteral] 1
577576
# 1| 4: [NullLiteral] null
578577
# 92| 1: [ExprStmt] <Expr>;
579578
# 92| 0: [MethodAccess] f$default(...)
580-
# 92| -1: [ClassInstanceExpr] new (...)
581-
# 92| -3: [TypeAccess] Object
579+
# 92| -1: [TypeAccess]
582580
# 92| 0: [StringLiteral] local sunk fp
583581
# 92| 1: [StringLiteral] local sunk 2
584582
# 1| 2: [NullLiteral] null

0 commit comments

Comments
 (0)