@@ -5772,7 +5772,7 @@ static void set_def_complexity(CBMDefinition *def, TSNode body, const CBMLangSpe
57725772 * Walks to the parameter_declaration's `type` field, unwrapping pointer_type
57735773 * and generic_type, and returns the type_identifier text (e.g. "OrderService").
57745774 * Returns NULL if no type_identifier is found. */
5775- static char *go_receiver_type_name (CBMArena *a, TSNode recv, const char *source) {
5775+ char *cbm_go_receiver_type_name (CBMArena *a, TSNode recv, const char *source) {
57765776 uint32_t nc = ts_node_child_count(recv);
57775777 for (uint32_t i = 0; i < nc; i++) {
57785778 TSNode child = ts_node_child(recv, i);
@@ -7006,12 +7006,27 @@ static void extract_func_def(CBMExtractCtx *ctx, TSNode node, const CBMLangSpec
70067006 * (and downstream Go IMPLEMENTS/OVERRIDE) link the method to its owning
70077007 * struct/type node. The parent QN must match the type's node QN, which
70087008 * is computed the same way (cbm_fqn_compute on the type name). */
7009- char *recv_type = go_receiver_type_name (a, recv, ctx->source);
7009+ char *recv_type = cbm_go_receiver_type_name (a, recv, ctx->source);
70107010 if (recv_type && recv_type[0]) {
70117011 /* Must match the Go type node QN (directory-based module) so the
70127012 * DEFINES_METHOD edge links the method to its owning type. */
70137013 def.parent_class = cbm_fqn_compute_source_lang(a, ctx->project, ctx->rel_path,
70147014 recv_type, ctx->language);
7015+ /* Receiver-qualify the method QN (proj.pkg.Recv.method) — same
7016+ * shape as the C++ out-of-line path below and Go interface
7017+ * members. With the flat proj.pkg.method QN every same-name
7018+ * method in a package collided in the graph upsert: one body
7019+ * survived and the twins' call edges accreted onto it. The
7020+ * call-scope side (compute_func_qn in extract_unified.c) mirrors
7021+ * this formula, and go_lsp consumers read the def QN and
7022+ * parent_class (receiver_type) verbatim, so resolution joins
7023+ * stay exact. Go only: templ's Go-derived grammar reaches this
7024+ * branch too, but its call-scope QN (compute_func_qn) stays flat,
7025+ * and a def QN the calls do not share would orphan every call
7026+ * inside a templ method. */
7027+ if (ctx->language == CBM_LANG_GO && def.parent_class) {
7028+ def.qualified_name = cbm_arena_sprintf(a, "%s.%s", def.parent_class, name);
7029+ }
70157030 }
70167031 }
70177032
0 commit comments