Skip to content

fix(kotlin): read a function's signature positionally (#1495) - #1807

Merged
colbymchenry merged 1 commit into
mainfrom
forge/fix-1495-kotlin-signature
Sep 9, 2026
Merged

fix(kotlin): read a function's signature positionally (#1495)#1807
colbymchenry merged 1 commit into
mainfrom
forge/fix-1495-kotlin-signature

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Fixes #1495.

Summary

Lands upstream #1687 (danusha2345:fix/1495-kotlin-signature) onto current main as a Forge PR authored by Colby McHenry. Prefer landing over reinventing.

Problem

tree-sitter-kotlin exposes no field names, so getSignature's getChildByField(node, 'function_value_parameters') / 'type' reads always missed and every Kotlin function/method was indexed with signature: undefined.

Fix

Find the parameter list and return type positionally (same approach as extractKotlinReturnType) in both:

  • src/extraction/languages/kotlin.ts (wasm)
  • codegraph-kernel/src/kotlin.rs (signature_of, lockstep)

Only Forge delta vs #1687 tip: Rust doc-comment placement so signature_of / return_type_of keep their own docs.

Linux verify (fail → pass)

Repro fixture (class method + top-level fun):

Symbol Before After (wasm + kernel)
greet undefined (name: String): String
noReturn undefined (x: Int)
topLevel undefined (a: Int, b: Int): Int

Undefined signatures: 3 → 0. Wasm/kernel parity PASS. Focused tests: 31 passed (Kotlin extraction + kernel-kotlin-parity + kernel-scaffold) with CODEGRAPH_KERNEL_EXPECT=1.

Credits

Thanks @danusha2345 for #1687. This PR supersedes it once merged (agency pattern: do not merge that fork tip directly).

Land upstream PR #1687 by danusha2345 (fix commit 6e9bbb2), using the
PR tip implementation with only a Rust doc-comment placement cleanup.

Read parameter lists and return types positionally in the wasm extractor
and native kernel in lockstep, preserving verbatim signature text.

Verified on Linux x64 with Node 22.19.0: reproduced three undefined
signatures in both backends before the fix, then confirmed all three
expected signatures and exact wasm/kernel parity after rebuilding
TypeScript and the linux-x64 kernel. All 31 focused tests pass: 15 Kotlin
extraction, 6 Kotlin parity, and 10 kernel scaffold checks, with
CODEGRAPH_KERNEL_EXPECT=1 for the native suites.

Add the upstream #1495 changelog bullet while preserving all other
Unreleased entries. Keep EXTRACTION_VERSION unchanged for this bug fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Kotlin] getSignature returns undefined due to getChildByField on fieldless grammar

1 participant