Skip to content

Commit 8782ce7

Browse files
committed
fix(identity): give same-file overloads their own node in Java, Kotlin and Swift
A callable QN carries no signature and must be unique, so the overloads of one class collapsed into one node with the last overload's span. That node collected the callers of every overload; the others had no callers. Definitions: once a Java, Kotlin or Swift file's def list is final, each group of Function/Method defs that share a QN and a label is split. The first overload by start line keeps the base QN. Each later overload whose signature no earlier one has takes base QN + the upstream callable_sig suffix (TYPED; Swift LABELED_TYPED), with qn_sig_off set. Two defs with one signature (Swift #if twins) keep one QN. A QN that no other callable of the file shares never changes. Every member carries its parameter shape as the `overload_params` node property. Members 2..n are registered by QN only, so every resolver strategy and candidate count stays as before. Calls: the call site records its argument shape (count, Swift labels, Kotlin named arguments, trailing closures/lambdas). When a resolved target belongs to an overload group, both resolvers bind the call to the members whose parameter shape accepts it, honouring defaults and varargs. When the shape cannot decide, the call binds to every candidate with strategy `overload_ambiguous` and confidence at most 0.3, never to one silently. Argument types are not compared. The cross-file LSP keeps base QNs for its defs (sig carried separately). Outgoing calls inside overloads 2..n stay attributed to the base node, as before. No schema change and no index format bump: an existing index gets split overloads on its next full index. Tests: new suite `overloads` (made-up fixtures): matcher cases, extraction QNs, and Java/Kotlin/Swift callers bound per overload on both resolvers, plus an ambiguous call bound to both candidates. Signed-off-by: chidev <[email protected]>
1 parent cf70a88 commit 8782ce7

18 files changed

Lines changed: 1476 additions & 14 deletions

‎Makefile.cbm‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ EXTRACTION_SRCS = \
380380
$(CBM_DIR)/cbm.c \
381381
$(CBM_DIR)/extract_defs.c \
382382
$(CBM_DIR)/callable_sig.c \
383+
$(CBM_DIR)/callable_overload.c \
383384
$(CBM_DIR)/extract_calls.c \
384385
$(CBM_DIR)/extract_imports.c \
385386
$(CBM_DIR)/extract_usages.c \
@@ -525,6 +526,7 @@ PIPELINE_SRCS = \
525526
src/pipeline/pass_parallel.c \
526527
src/pipeline/pass_definitions.c \
527528
src/pipeline/pass_calls.c \
529+
src/pipeline/call_overloads.c \
528530
src/pipeline/pass_spawns.c \
529531
src/pipeline/pass_lsp_cross.c \
530532
src/pipeline/pass_usages.c \
@@ -904,7 +906,7 @@ TEST_JAVA_LSP_SRCS = tests/test_java_lsp.c tests/test_java_lsp_coverage.c
904906
TEST_KOTLIN_LSP_SRCS = tests/test_kotlin_lsp.c tests/test_kotlin_typed_calls.c
905907
TEST_RUST_LSP_SRCS = tests/test_rust_lsp.c
906908

907-
TEST_INTEGRATION_SRCS = tests/test_integration.c tests/test_incremental.c tests/test_lang_contract.c tests/test_edge_imports.c tests/test_edge_structural.c tests/test_lsp_resolution_probe.c tests/test_node_creation_probe.c tests/test_edge_types_probe.c tests/test_convergence_probe.c tests/test_matrix_known_classes.c tests/test_matrix_new_constructs.c tests/test_grammar_probe_a.c tests/test_grammar_probe_b.c tests/test_grammar_probe_c.c tests/test_grammar_probe_d.c tests/test_grammar_probe_e.c tests/test_grammar_probe_f.c tests/test_grammar_probe_g.c tests/test_conditional_variants.c tests/test_spawns.c
909+
TEST_INTEGRATION_SRCS = tests/test_integration.c tests/test_incremental.c tests/test_lang_contract.c tests/test_edge_imports.c tests/test_edge_structural.c tests/test_lsp_resolution_probe.c tests/test_node_creation_probe.c tests/test_edge_types_probe.c tests/test_convergence_probe.c tests/test_matrix_known_classes.c tests/test_matrix_new_constructs.c tests/test_grammar_probe_a.c tests/test_grammar_probe_b.c tests/test_grammar_probe_c.c tests/test_grammar_probe_d.c tests/test_grammar_probe_e.c tests/test_grammar_probe_f.c tests/test_grammar_probe_g.c tests/test_conditional_variants.c tests/test_overloads.c tests/test_spawns.c
908910

909911
TEST_TRACES_SRCS = tests/test_traces.c
910912

0 commit comments

Comments
 (0)