diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs
index 0bdb14f307664c2305ad12cf23c234c0a178bba7..18fab379095a04a7e4978695348dca673d7abffa 100644
--- a/compiler/GHC/Rename/Names.hs
+++ b/compiler/GHC/Rename/Names.hs
@@ -1303,8 +1303,13 @@ filterImports hsc_env iface decl_spec (Just (want_hiding, L l import_items))
                    , export_depr_warns )
 
         IEThingAll _ (L l tc) -> do
-            ImpOccItem gre child_gres _ <- lookup_parent ie $ ieWrappedName tc
+            ImpOccItem { imp_item      = gre
+                       , imp_bundled   = bundled_gres
+                       , imp_is_parent = is_par
+                       }
+              <- lookup_parent ie $ ieWrappedName tc
             let name = greName gre
+                child_gres = if is_par then bundled_gres else []
                 imp_list_warn
 
                   | null child_gres
@@ -1445,18 +1450,23 @@ data ImpOccItem
 mkImportOccEnv :: HscEnv -> ImpDeclSpec -> [IfaceExport] -> OccEnv (NameEnv ImpOccItem)
 mkImportOccEnv hsc_env decl_spec all_avails =
   mkOccEnv_C (plusNameEnv_C combine)
-    [ (occ, mkNameEnv [(nm, ImpOccItem g bundled is_parent)])
+    [ (occ, mkNameEnv [(nm, item)])
     | avail <- all_avails
-    , let gs = gresFromAvail hsc_env (Just hiding_spec) avail
-    , g <- gs
-    , let nm = greName g
-          occ = greOccName g
+    , let gres = gresFromAvail hsc_env (Just hiding_spec) avail
+    , gre <- gres
+    , let nm = greName gre
+          occ = greOccName gre
           (is_parent, bundled) = case avail of
             AvailTC c _
-              -> if c == nm -- (Recall the AvailTC invariant)
-                 then ( True, case gs of { g0 : gs' | greName g0 == nm -> gs'; _ -> gs } )
-                 else ( False, gs )
+              | c == nm -- (Recall the AvailTC invariant from GHC.Types.AvailInfo)
+              -> ( True, drop 1 gres ) -- "drop 1": don't include the parent itself.
+              | otherwise
+              -> ( False, gres )
             _ -> ( False, [] )
+          item = ImpOccItem
+               { imp_item      = gre
+               , imp_bundled   = bundled
+               , imp_is_parent = is_parent }
     ]
   where
 
diff --git a/testsuite/tests/rename/should_fail/T23570.hs b/testsuite/tests/rename/should_fail/T23570.hs
new file mode 100644
index 0000000000000000000000000000000000000000..1b8680e264a4fd25b45a8433dba43cc82c011384
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T23570.hs
@@ -0,0 +1,6 @@
+module T23570 where
+
+import T23570_aux (T(..))
+
+f :: C a => a -> T a ()
+f = meth
diff --git a/testsuite/tests/rename/should_fail/T23570.stderr b/testsuite/tests/rename/should_fail/T23570.stderr
new file mode 100644
index 0000000000000000000000000000000000000000..00f938292072b6c96d145a87ad8251c7f2444cba
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T23570.stderr
@@ -0,0 +1,6 @@
+
+T23570.hs:5:6: error: [GHC-76037]
+    Not in scope: type constructor or class ‘C’
+    Suggested fix:
+      Add ‘C’ to the import list in the import of ‘T23570_aux’
+      (at T23570.hs:3:1-25).
diff --git a/testsuite/tests/rename/should_fail/T23570_aux.hs b/testsuite/tests/rename/should_fail/T23570_aux.hs
new file mode 100644
index 0000000000000000000000000000000000000000..fda0a4a45295ef417bc847602ab8cbd818539572
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T23570_aux.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module T23570_aux where
+
+class C a where
+  type T a
+  meth :: a -> T a
diff --git a/testsuite/tests/rename/should_fail/T23570b.hs b/testsuite/tests/rename/should_fail/T23570b.hs
new file mode 100644
index 0000000000000000000000000000000000000000..bc605cd177c2b1367ecc34ce256594d08b2e16a6
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T23570b.hs
@@ -0,0 +1,5 @@
+{-# OPTIONS_GHC -Wdodgy-imports #-}
+
+module T23570b where
+
+import T23570_aux (T(..))
diff --git a/testsuite/tests/rename/should_fail/T23570b.stderr b/testsuite/tests/rename/should_fail/T23570b.stderr
new file mode 100644
index 0000000000000000000000000000000000000000..186f8ab399a9ae5e884717de0a8b4d593a33f7a9
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T23570b.stderr
@@ -0,0 +1,5 @@
+
+T23570b.hs:5:20: warning: [GHC-99623] [-Wdodgy-imports (in -Wextra)]
+    The import item ‘T23570_aux.T(..)’ suggests that
+    ‘T23570_aux.T’ has (in-scope) constructors or record fields,
+                       but it has none
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 20cc26b9b72b99f579a6e39d3463150951470e69..2c68cfb484f4c62cc3ebc9eee951bb2625a92f15 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -210,3 +210,5 @@ test('T22478b', normal, compile_fail, [''])
 test('T22478d', normal, compile_fail, [''])
 test('T22478e', normal, compile_fail, [''])
 test('T22478f', normal, compile_fail, [''])
+test('T23570', [extra_files(['T23570_aux.hs'])], multimod_compile_fail, ['T23570', '-v0'])
+test('T23570b', [extra_files(['T23570_aux.hs'])], multimod_compile, ['T23570b', '-v0'])
\ No newline at end of file