Skip to content

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

Closed

Description

@hiyizhiyu

Bug Description

tree-sitter-kotlin does not use field names, but getSignature
calls getChildByField(node, 'function_value_parameters'),
which causes the signature of Kotlin methods to always resolve
to undefined.

Fix

The fix is consistent with extractKotlinReturnType:
replace getChildByField with iteration over namedChildren,
matching the target node by its type property.

Activity

  1. colbymchenry commented on Sep 9, 2026

    @colbymchenry
    Owner

    Fixed in #1807 (57d9132c), landing upstream #1687 (@danusha2345) onto current main as a Forge PR.

    Root cause

    tree-sitter-kotlin has no field names, so getSignature via getChildByField('function_value_parameters' / 'type') always missed → every Kotlin function/method had signature: undefined.

    Fix

    Positional namedChildren read (same pattern as extractKotlinReturnType) in wasm kotlin.ts + kernel signature_of lockstep.

    Linux verify (fail → pass)

    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 (kernel-kotlin-parity + Kotlin extraction + kernel-scaffold) with CODEGRAPH_KERNEL_EXPECT=1.

    Closing as completed. Upstream #1687 will be closed as superseded by #1807.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions