Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(lsp): emit lsp_kt_static for Kotlin object/companion member calls
Martin Vogel5f1e702239d4
diff --git a/internal/cbm/lsp/kotlin_lsp.c b/internal/cbm/lsp/kotlin_lsp.cindex 03fd701dd..16382ac41 100644--- a/internal/cbm/lsp/kotlin_lsp.c+++ b/internal/cbm/lsp/kotlin_lsp.c@@ -1421,6 +1421,7 @@ static void kt_process_object_decl(KotlinLSPContext *ctx, TSNode node, bool is_c}}+ rt.is_object = true; /* object / companion object → static-like member calls */cbm_registry_add_type((CBMTypeRegistry *)ctx->registry, rt);/* Recurse into body */@@ -2435,8 +2436,15 @@ static const CBMType *kt_eval_navigation_expression_type(KotlinLSPContext *ctx,size_t recv_len = strlen(recv_qn);bool is_member = (strncmp(rf->qualified_name, recv_qn, recv_len) == 0 &&rf->qualified_name[recv_len] == '.');- kt_emit_resolved(ctx, rf->qualified_name,- is_member ? "lsp_kt_method" : "lsp_kt_extension", KT_CONF_METHOD);+ const char *strat = "lsp_kt_extension";+ if (is_member) {+ /* A member call on an `object`/`companion object` singleton is a+ * static dispatch; on a regular class instance it is a method. */+ const CBMRegisteredType *recv_rt =+ cbm_registry_lookup_type(ctx->registry, recv_qn);+ strat = (recv_rt && recv_rt->is_object) ? "lsp_kt_static" : "lsp_kt_method";+ }+ kt_emit_resolved(ctx, rf->qualified_name, strat, KT_CONF_METHOD);if (rf->signature && rf->signature->kind == CBM_TYPE_FUNC &&rf->signature->data.func.return_types && rf->signature->data.func.return_types[0]) {return rf->signature->data.func.return_types[0];diff --git a/internal/cbm/lsp/type_registry.h b/internal/cbm/lsp/type_registry.hindex 71e050b41..bf723ed8d 100644--- a/internal/cbm/lsp/type_registry.h+++ b/internal/cbm/lsp/type_registry.h@@ -43,6 +43,7 @@ typedef struct {const char *alias_of; // QN of aliased type (type Foo = Bar), NULL if not aliasconst char **type_param_names; // NULL-terminated, e.g., ["T", "K", NULL] for template classesbool is_interface;+ bool is_object; // Kotlin `object`/`companion object` singleton (member calls are static)// --- TS-specific fields (NULL/empty for non-TS types — backward compatible) ---// TS interfaces / object types may be callable: `interface F { (x:number): string }`.