@@ -352,9 +352,11 @@ TEST(doc_mentions_jvm_java_scope_blob) {
352352 ASSERT (jt_has_line (s , "M\t7\tv\t\t0\tMAX\t\t-\t\t=\t1\t" ));
353353 ASSERT (jt_has_line (s , "M\t8\tv\t\t0\tsize\t\t-\t\tWidget.size#field\t1\t" ));
354354 ASSERT (jt_has_line (s , "M\t8\tv\t\t0\tother\t\t-\t\t-\t0\t" ));
355- /* constructors, overloads of one name: one node, owned by the last */
356- ASSERT (jt_has_line (s , "M\t9\tc\tK\t0\tWidget\t\t\t\t=\t0\t" ));
357- ASSERT (jt_has_line (s , "M\t10\tc\tK\t0\tWidget\t\tint\t\t=\t1\t" ));
355+ /* constructors, overloads of one name: a node each. The first keeps the
356+ * plain qualified name, a later one gets its signature as a suffix
357+ * (cbm_split_overloads); the slot follows the extractor */
358+ ASSERT (jt_has_line (s , "M\t9\tc\tK\t0\tWidget\t\t\t\t=\t1\t" ));
359+ ASSERT (jt_has_line (s , "M\t10\tc\tK\t0\tWidget\t\tint\t\tWidget.Widget(int)\t1\t" ));
358360 /* a signature: simple names, no type arguments, an ellipsis is an array */
359361 ASSERT (jt_has_line (s , "M\t11\tc\t\t0\tsize\tV:Number\tV|List|int[]\t\t=\t1\t" ));
360362 ASSERT (jt_has_line (s , "T\t13\t15\tc\tWidget.Inner\t\t\t=\t1\t" ));
@@ -375,7 +377,7 @@ TEST(doc_mentions_jvm_java_scope_blob) {
375377 char * portable = cbm_doclink_portable_scope (s );
376378 ASSERT_NOT_NULL (portable );
377379 ASSERT (jt_has_line (portable , "T\t0\t0\tc\tWidget\tT,U:Comparable\tBase|Runnable\t=\t1\t" ));
378- ASSERT (jt_has_line (portable , "M\t0\tc\tK\t0\tWidget\t\tint\t\t= \t1\t" ));
380+ ASSERT (jt_has_line (portable , "M\t0\tc\tK\t0\tWidget\t\tint\t\tWidget.Widget(int) \t1\t" ));
379381 ASSERT (jt_has_line (portable , "I\ts\tHelper\tcom.acme.util.Helper" ));
380382 cbm_free (CBM_MEM_CLASS_OTHER , portable );
381383 cbm_free_result (r );
@@ -428,8 +430,9 @@ TEST(doc_mentions_jvm_kotlin_scope_blob) {
428430 ASSERT (jt_has_line (s , "M\t5\tv\tp\t0\tdelegate\t\t-\t\t-\t0\t" ));
429431 /* a class-body property: its node is named below the FILE's module */
430432 ASSERT (jt_has_line (s , "M\t6\tv\t\t0\tbodyProp\t\t-\t\tbodyProp\t1\t" ));
431- ASSERT (jt_has_line (s , "M\t7\tc\t\t0\tmember\t\tInt\t\t=\t0\tparam" ));
432- ASSERT (jt_has_line (s , "M\t10\tc\t\t0\tmember\t\tString\t\t=\t1\tparam" ));
433+ /* overloads: a node each, the later one's named with its signature */
434+ ASSERT (jt_has_line (s , "M\t7\tc\t\t0\tmember\t\tInt\t\t=\t1\tparam" ));
435+ ASSERT (jt_has_line (s , "M\t10\tc\t\t0\tmember\t\tString\t\tAlias.member(String)\t1\tparam" ));
433436 /* a nested type's node is flat: named below the file's module */
434437 ASSERT (jt_has_line (s , "T\t13\t13\tc\tAlias.Nested\t\t\tNested\t1\t" ));
435438 /* an unnamed companion and its members: declared, no definitions */
@@ -449,7 +452,7 @@ TEST(doc_mentions_jvm_kotlin_scope_blob) {
449452 char * portable = cbm_doclink_portable_scope (s );
450453 ASSERT_NOT_NULL (portable );
451454 ASSERT (jt_has_line (portable , "T\t0\t0\tc\tAlias\tT\tBase|Marker\t=\t1\t" ));
452- ASSERT (jt_has_line (portable , "M\t0\tc\t\t0\tmember\t\tString\t\t= \t1\t" ));
455+ ASSERT (jt_has_line (portable , "M\t0\tc\t\t0\tmember\t\tString\t\tAlias.member(String) \t1\t" ));
453456 cbm_free (CBM_MEM_CLASS_OTHER , portable );
454457 cbm_free_result (r );
455458 PASS ();
@@ -594,9 +597,10 @@ TEST(doc_mentions_jvm_java_families_and_reasons) {
594597 ASSERT_NOT_NULL (strstr (jt_props , "\"syntax\":\"link\"" ));
595598 ASSERT_NOT_NULL (strstr (jt_props , "\"tier\":\"unique\"" ));
596599 ASSERT_NOT_NULL (strstr (jt_props , "\"line\":8" ));
597- /* linkplain, with a signature that selects one overload (overloads of a
598- * type share a node) */
599- ASSERT_EQ (jt_edge (db , "a.Widget" , "a.Gadget.spin" ), 1 );
600+ /* linkplain, with a signature that selects one overload: the second
601+ * overload has its own node, named with its signature (the first keeps
602+ * a.Gadget.spin) */
603+ ASSERT_EQ (jt_edge (db , "a.Widget" , "a.Gadget.spin(int)" ), 1 );
600604 ASSERT_NOT_NULL (strstr (jt_props , "\"syntax\":\"linkplain\"" ));
601605 /* ... and nothing is relaxed: another parameter count, another parameter
602606 * type, a nested type named as a member and a method named as a value
@@ -2645,7 +2649,8 @@ TEST(doc_mentions_jvm_scope_delta_rules) {
26452649 JT_DJ_HEAD "import static acme.S.*;\n" JT_DJ_TYPES , global , NULL },
26462650 {"java static import of the supertype's name" , java , JT_DJ_BASE ,
26472651 JT_DJ_HEAD "import static acme.S.Base;\n" JT_DJ_TYPES , global , NULL },
2648- /* a removed member is reported by name */
2652+ /* a removed member is reported by name; so is the overload whose node
2653+ * moved (run(String) takes the plain name run(int) left), once */
26492654 {"java overload removed" , java , JT_DJ_BASE ,
26502655 JT_DJ_HEAD JT_DJ_OPEN JT_DJ_RUN_STR JT_DJ_SIZE JT_DJ_CLOSE , local , "run" },
26512656 {"java field removed" , java , JT_DJ_BASE ,
@@ -2657,10 +2662,10 @@ TEST(doc_mentions_jvm_scope_delta_rules) {
26572662 "package n;\npublic class C {\n public void m() {}\n}\n" , local , "C" },
26582663 {"java enum constant removed" , java , "package n;\npublic enum Color { RED, GREEN }\n" ,
26592664 "package n;\npublic enum Color { RED }\n" , local , "GREEN" },
2660- /* ... unless the overloads' one node was its own: the node moves to
2661- * the declaration that stays */
2662- {"java node owner removed" , java , JT_DJ_BASE ,
2663- JT_DJ_HEAD JT_DJ_OPEN JT_DJ_RUN_INT JT_DJ_SIZE JT_DJ_CLOSE , global , NULL },
2665+ /* the later overload had a node of its own (overloads no longer share
2666+ * one, cbm_split_overloads): removing it moves no other node */
2667+ {"java later overload removed" , java , JT_DJ_BASE ,
2668+ JT_DJ_HEAD JT_DJ_OPEN JT_DJ_RUN_INT JT_DJ_SIZE JT_DJ_CLOSE , local , "run" },
26642669 /* everything else can re-route references of files with no edge here */
26652670 {"java member added" , java , JT_DJ_BASE ,
26662671 JT_DJ_HEAD JT_DJ_OPEN JT_DJ_BODY " public int more;\n" JT_DJ_CLOSE , global , NULL },
@@ -2725,6 +2730,7 @@ TEST(doc_mentions_jvm_scope_delta_rules) {
27252730 {"kotlin receiver's import changed" , kotlin ,
27262731 "package n\n\nimport acme.local.Recv\n\nfun Recv.ext() {}\n" ,
27272732 "package n\n\nimport acme.other.Recv\n\nfun Recv.ext() {}\n" , global , NULL },
2733+ /* the removed overload, and the one whose node moved: one name */
27282734 {"kotlin overload removed" , kotlin , JT_DK_BASE ,
27292735 JT_DK_HEAD JT_DK_OPEN JT_DK_RUN_STR JT_DK_SIZE JT_DK_CLOSE , local , "run" },
27302736 {"kotlin property removed" , kotlin , JT_DK_BASE ,
@@ -2803,7 +2809,7 @@ static const char JT_I_TARGET_RENAMED[] = "package lib;\n"
28032809 " public static final int LIMIT = 20;\n"
28042810 " public void go(int n) {}\n"
28052811 "}\n" ;
2806- /* one node for both overloads; it belongs to the later declaration */
2812+ /* a node per overload: lib.Ov.run, then lib.Ov.run(String) */
28072813static const char JT_I_OV [] = "package lib;\n"
28082814 "public class Ov {\n"
28092815 " public void run(int n) {}\n"
@@ -2956,7 +2962,7 @@ TEST(doc_mentions_jvm_incremental_equals_full) {
29562962 /* a doc-comment edit re-extracts the file alone */
29572963 jt_write (& r , main_java , JT_I_MAIN_EDITED );
29582964 ASSERT_EQ (dm_step (r .repo , db , full_db , "doc edit" , repair ), 0 );
2959- ASSERT_EQ (jt_edge (db , "app.Main" , "lib.Ov.run" ), 1 );
2965+ ASSERT_EQ (jt_edge (db , "app.Main" , "lib.Ov.run(String) " ), 1 ); /* the second overload */
29602966
29612967 /* a body edit in a TARGET file: its scope is unchanged, and the edges
29622968 * into it stand */
0 commit comments