@@ -9456,6 +9456,78 @@ TEST(registry_confidence_suffix_match) {
94569456 PASS();
94579457}
94589458
9459+ /* Issue #1893: a call on a library type bound to a same-named project member.
9460+ * URLSession is Foundation's, not this project's, so PickedFile.data is the
9461+ * wrong target — and with one candidate it won the top name-only confidence. */
9462+ TEST(registry_receiver_chain_refuses_library_unique_name_issue1893) {
9463+ cbm_registry_t *reg = cbm_registry_new();
9464+ cbm_registry_add(reg, "data", "HomeboxUI.PickedFile.data", "Variable");
9465+
9466+ cbm_resolution_t r =
9467+ cbm_registry_resolve(reg, "URLSession.shared.data", "HomeboxUI.Net", NULL, NULL, 0);
9468+ ASSERT_NULL(r.qualified_name);
9469+
9470+ cbm_registry_free(reg);
9471+ PASS();
9472+ }
9473+
9474+ /* The same refusal on the other name-only exit, where several candidates share
9475+ * the final name and import distance picks the winner. */
9476+ TEST(registry_receiver_chain_refuses_library_suffix_match_issue1893) {
9477+ cbm_registry_t *reg = cbm_registry_new();
9478+ cbm_registry_add(reg, "data", "HomeboxUI.PickedFile.data", "Variable");
9479+ cbm_registry_add(reg, "data", "HomeboxUI.Payload.data", "Variable");
9480+
9481+ cbm_resolution_t r =
9482+ cbm_registry_resolve(reg, "URLSession.shared.data", "HomeboxUI.Net", NULL, NULL, 0);
9483+ ASSERT_NULL(r.qualified_name);
9484+
9485+ cbm_registry_free(reg);
9486+ PASS();
9487+ }
9488+
9489+ /* The true positive the gate must not eat: the project extends Calendar itself,
9490+ * so Calendar really is in the receiver chain. */
9491+ TEST(registry_receiver_chain_keeps_project_extension_issue1893) {
9492+ cbm_registry_t *reg = cbm_registry_new();
9493+ cbm_registry_add(reg, "startOfDayUTC", "AuthDTOs.Calendar.startOfDayUTC", "Method");
9494+
9495+ cbm_resolution_t r = cbm_registry_resolve(reg, "Calendar.utcGregorian.startOfDayUTC",
9496+ "HomeboxUI.Stats", NULL, NULL, 0);
9497+ ASSERT_STR_EQ(r.qualified_name, "AuthDTOs.Calendar.startOfDayUTC");
9498+ ASSERT_STR_EQ(r.strategy, "unique_name");
9499+
9500+ cbm_registry_free(reg);
9501+ PASS();
9502+ }
9503+
9504+ /* A lower-case root names a value, whose type the chain does not show. The gate
9505+ * must not look at it, or every ordinary vm.load style call would be refused. */
9506+ TEST(registry_receiver_chain_ignores_lowercase_root_issue1893) {
9507+ cbm_registry_t *reg = cbm_registry_new();
9508+ cbm_registry_add(reg, "load", "HomeboxUI.EntityListViewModel.load", "Method");
9509+
9510+ cbm_resolution_t r = cbm_registry_resolve(reg, "vm.load", "HomeboxUI.Views", NULL, NULL, 0);
9511+ ASSERT_STR_EQ(r.qualified_name, "HomeboxUI.EntityListViewModel.load");
9512+ ASSERT_STR_EQ(r.strategy, "unique_name");
9513+
9514+ cbm_registry_free(reg);
9515+ PASS();
9516+ }
9517+
9518+ /* An unqualified callee has no chain at all and must pass through unchanged. */
9519+ TEST(registry_receiver_chain_ignores_bare_name_issue1893) {
9520+ cbm_registry_t *reg = cbm_registry_new();
9521+ cbm_registry_add(reg, "helper", "proj.pkg.helper", "Function");
9522+
9523+ cbm_resolution_t r = cbm_registry_resolve(reg, "helper", "proj.other", NULL, NULL, 0);
9524+ ASSERT_STR_EQ(r.qualified_name, "proj.pkg.helper");
9525+ ASSERT_STR_EQ(r.strategy, "unique_name");
9526+
9527+ cbm_registry_free(reg);
9528+ PASS();
9529+ }
9530+
94599531TEST(registry_fuzzy_confidence_single) {
94609532 cbm_registry_t *reg = cbm_registry_new();
94619533 cbm_registry_add(reg, "Handler", "proj.svc.Handler", "Function");
@@ -13491,6 +13563,11 @@ SUITE(pipeline) {
1349113563 RUN_TEST(registry_confidence_same_module);
1349213564 RUN_TEST(registry_confidence_unique_name);
1349313565 RUN_TEST(registry_confidence_suffix_match);
13566+ RUN_TEST(registry_receiver_chain_refuses_library_unique_name_issue1893);
13567+ RUN_TEST(registry_receiver_chain_refuses_library_suffix_match_issue1893);
13568+ RUN_TEST(registry_receiver_chain_keeps_project_extension_issue1893);
13569+ RUN_TEST(registry_receiver_chain_ignores_lowercase_root_issue1893);
13570+ RUN_TEST(registry_receiver_chain_ignores_bare_name_issue1893);
1349413571 RUN_TEST(registry_fuzzy_confidence_single);
1349513572 RUN_TEST(registry_fuzzy_confidence_distance);
1349613573 RUN_TEST(registry_negative_import_rejects);
0 commit comments