Skip to content

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

Closed
danusha2345 wants to merge 16 commits into
colbymchenry:mainfrom
danusha2345:fix/1495-kotlin-signature
Closed

fix(kotlin): read a function's signature positionally#1687
danusha2345 wants to merge 16 commits into
colbymchenry:mainfrom
danusha2345:fix/1495-kotlin-signature

Conversation

@danusha2345

Copy link
Copy Markdown
Contributor

Fixes #1495.

Problem

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

Change

Find the parameter list and the return type positionally, the way extractKotlinReturnType already does: the function_value_parameters child, then the user_type / nullable_type / function_type that follows it before the body. The kernel (kotlin.rs) gets the same signature_of, so both arms emit (params): ReturnType verbatim and parity pins it.

Verification

  • kernel-kotlin-parity, kernel-scaffold, extraction: 638 passed with the rebuilt kernel.
  • Full suite: 236 files, 4229 passed, 11 skipped.

Re-index Kotlin projects after upgrading.

🤖 Generated with Claude Code

danusha2345 added 3 commits September 4, 2026 12:06
)

tree-sitter-kotlin exposes no field names, so getSignature's
getChildByField reads always missed and every Kotlin function and method
was indexed without a signature. Find the parameter list and the return
type by position, the way extractKotlinReturnType already does — in the
wasm extractor and the kernel together.
@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (3adf067, post-#1770) into this branch: head 35692c4. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (43271f3) into this branch: head 408445d. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (85550eb) into this branch: head 1141b44. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8733c28) into this branch: head 79fb9ec. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (8c04734) into this branch: head 4142573. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (ee83636) into this branch: head aa4c946. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (e720f6c) into this branch: head fc12df3. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (de5adba) into this branch: head eb9d911. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (cece072) into this branch: head a0df701. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (040ba38) into this branch: head b9d8207. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (374b3b4) into this branch: head efd417b. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (71d049c) into this branch: head 996e7cb. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (9181dd1) into this branch: head 7692909. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@danusha2345

Copy link
Copy Markdown
Contributor Author

Merged current main (64bd45c) into this branch: head 1a70e75. The only conflict was the CHANGELOG entry; no source conflict. tsc clean, the branch's tests pass.

@colbymchenry

Copy link
Copy Markdown
Owner

Thanks @danusha2345 — this fix is landed via Forge PR #1807 (commit 57d9132c), which cherry-picks/checkouts your tip implementation onto current main (plus a small Rust doc-comment placement cleanup). Closing this PR as superseded by #1807 per the agency land pattern.

colbymchenry added a commit that referenced this pull request Sep 9, 2026
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.

Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
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

2 participants