@@ -367,6 +367,25 @@ TEST(resolve_import_map_bare_function) {
367367 PASS ();
368368}
369369
370+ /* Aliased bare import (`from m import f as g`, called as g()). The import-map
371+ * value is the full symbol QN (IMPORTS edge targets the function node), and
372+ * the callee at the site is the alias g — NOT f. Resolution must return the
373+ * symbol directly instead of appending the alias (which yields m.f.g → miss).
374+ * Regression for #875. */
375+ TEST (resolve_import_map_bare_alias ) {
376+ cbm_registry_t * r = cbm_registry_new ();
377+ cbm_registry_add (r , "scan_bash" , "proj.security_scan.scan_bash" , "Function" );
378+ /* Import map: alias "_scan_bash" → FULL SYMBOL QN (not the module). */
379+ const char * keys [] = {"_scan_bash" };
380+ const char * vals [] = {"proj.security_scan.scan_bash" };
381+ cbm_resolution_t res =
382+ cbm_registry_resolve (r , "_scan_bash" , "proj.hooks.pre_tool" , keys , vals , 1 );
383+ ASSERT_STR_EQ (res .qualified_name , "proj.security_scan.scan_bash" );
384+ ASSERT_STR_EQ (res .strategy , "import_map" );
385+ cbm_registry_free (r );
386+ PASS ();
387+ }
388+
370389TEST (resolve_unique_name ) {
371390 cbm_registry_t * r = cbm_registry_new ();
372391 cbm_registry_add (r , "UniqueFunc" , "proj.deep.path.UniqueFunc" , "Function" );
@@ -818,6 +837,7 @@ SUITE(registry) {
818837 RUN_TEST (resolve_qualified_ambiguous_tail_falls_through );
819838 RUN_TEST (resolve_import_map );
820839 RUN_TEST (resolve_import_map_bare_function );
840+ RUN_TEST (resolve_import_map_bare_alias );
821841 RUN_TEST (resolve_unique_name );
822842 RUN_TEST (resolve_unresolved );
823843 RUN_TEST (resolve_many_nodes );
0 commit comments