fix(lsp): emit lsp_kt_lambda_it for calls through the lambda it

A call on the implicit lambda parameter (e.g. `x.let { it.m() }`) resolved
through the regular method path and was tagged lsp_kt_method, because the
LSP already binds `it` to the receiver type. Detect an `it` receiver at the
method-resolution site and emit lsp_kt_lambda_it (lambda-scoped dispatch).

kt LSP strategy reproductions 21->22.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel committed 2026-06-28 00:34:48 +02:00
1 parent 15e541bc50
commit 6c1dfc92e9
1 file changed
+9
+9
View File
@@ -2444,6 +2444,15 @@ static const CBMType *kt_eval_navigation_expression_type(KotlinLSPContext *ctx,
cbm_registry_lookup_type(ctx->registry, recv_qn);
strat = (recv_rt && recv_rt->is_object) ? "lsp_kt_static" : "lsp_kt_method";
}
/* A call through the lambda implicit parameter `it` (e.g. inside
* `x.let { it.m() }`) is lambda-scoped dispatch, not a plain method. */
if (kt_node_is(receiver_node, "identifier") ||
kt_node_is(receiver_node, "simple_identifier")) {
char *rtext = kt_node_text(ctx, receiver_node);
if (rtext && strcmp(rtext, "it") == 0) {
strat = "lsp_kt_lambda_it";
}
}
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]) {