
Vladislav Zavialov pushed to branch wip/int-index/enforce-namespaces at Glasgow Haskell Compiler / GHC Commits: b911a6f1 by Vladislav Zavialov at 2025-04-26T02:18:54+02:00 WIP: Take subordinate 'type' specifiers into account - - - - - 29 changed files: - compiler/GHC/Rename/Names.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Types/Error/Codes.hs - docs/users_guide/9.14.1-notes.rst - docs/users_guide/exts/explicit_namespaces.rst - testsuite/tests/driver/RecompExports/RecompExports1.stderr - testsuite/tests/driver/RecompExports/RecompExports4.stderr - testsuite/tests/module/T21826.stderr - testsuite/tests/module/mod81.stderr - testsuite/tests/module/mod91.stderr - + testsuite/tests/rename/should_compile/T22581c.hs - + testsuite/tests/rename/should_compile/T22581c_helper.hs - + testsuite/tests/rename/should_compile/T22581d.script - + testsuite/tests/rename/should_compile/T22581d.stdout - + testsuite/tests/rename/should_compile/T25991a.hs - + testsuite/tests/rename/should_compile/T25991a_helper.hs - testsuite/tests/rename/should_compile/all.T - + testsuite/tests/rename/should_fail/T22581a.hs - + testsuite/tests/rename/should_fail/T22581a.stderr - + testsuite/tests/rename/should_fail/T22581a_helper.hs - + testsuite/tests/rename/should_fail/T22581b.hs - + testsuite/tests/rename/should_fail/T22581b.stderr - + testsuite/tests/rename/should_fail/T22581b_helper.hs - + testsuite/tests/rename/should_fail/T25991b1.hs - + testsuite/tests/rename/should_fail/T25991b2.hs - + testsuite/tests/rename/should_fail/T25991b_helper.hs - testsuite/tests/rename/should_fail/T9006.stderr - testsuite/tests/rename/should_fail/all.T Changes: ===================================== compiler/GHC/Rename/Names.hs ===================================== @@ -1256,7 +1256,7 @@ filterImports hsc_env iface decl_spec (Just (want_hiding, L l import_items)) -- 'BadImportW' is only constructed below in 'handle_bad_import', in -- the 'EverythingBut' case, so that's what we pass to -- 'badImportItemErr'. - reason <- badImportItemErr iface decl_spec ie IsNotSubordinate all_avails + (reason : _) <- badImportItemErr iface decl_spec ie IsNotSubordinate all_avails pure (TcRnDodgyImports (DodgyImportsHiding reason)) warning_msg (DeprecatedExport n w) = pure $ TcRnPragmaWarning @@ -1268,15 +1268,15 @@ filterImports hsc_env iface decl_spec (Just (want_hiding, L l import_items)) run_lookup :: IELookupM a -> TcRn (Maybe a) run_lookup m = case m of Failed err -> do - msg <- lookup_err_msg err - addErr (TcRnImportLookup msg) + msgs <- lookup_err_msgs err + mapM_ addErr [TcRnImportLookup msg | msg <- msgs] return Nothing Succeeded a -> return (Just a) - lookup_err_msg err = case err of + lookup_err_msgs err = case err of BadImport ie sub -> badImportItemErr iface decl_spec ie sub all_avails - IllegalImport -> pure ImportLookupIllegal - QualImportError rdr -> pure (ImportLookupQualified rdr) + IllegalImport -> pure [ImportLookupIllegal] + QualImportError rdr -> pure [ImportLookupQualified rdr] -- For each import item, we convert its RdrNames to Names, -- and at the same time compute all the GlobalRdrElt corresponding @@ -1362,13 +1362,24 @@ filterImports hsc_env iface decl_spec (Just (want_hiding, L l import_items)) -- See Note [Importing DuplicateRecordFields] case lookupChildren subnames rdr_ns of - Failed rdrs -> failLookupWith $ - BadImport (IEThingWith (deprecation, ann) ltc wc rdrs noDocstring) - (IsSubordinate { subordinate_parent = gre}) + Failed errs -> failLookupWith $ BadImport ie subordinate_err -- We are trying to import T( a,b,c,d ), and failed -- to find 'b' and 'd'. So we make up an import item -- to report as failing, namely T( b, d ). - -- c.f. #15412 + -- c.f. #15413 + where + items = map lce_wrapped_name errs + ie = IEThingWith (deprecation, ann) ltc wc items noDocstring + subordinate_err = + assertPpr (length unavailable + length nontype == length items) + (ppr items) $ + IsSubordinateError { subordinate_err_parent = gre + , subordinate_err_unavailable = unavailable + , subordinate_err_nontype = nontype } + unavailable = + [ (occNameFS . rdrNameOcc . ieWrappedName) wname + | LookupChildNotFound (L _ wname) <- errs ] + nontype = [ g | LookupChildNonType _ g <- errs ] Succeeded childnames -> return ([ (IEThingWith (Nothing, ann) (L l name') wc childnames' noDocstring @@ -1414,13 +1425,15 @@ data IELookupWarning | DeprecatedExport Name (WarningTxt GhcRn) -- | Is this import/export item a subordinate or not? -data IsSubordinate - = IsSubordinate { subordinate_parent :: GlobalRdrElt } +data IsSubordinateError + = IsSubordinateError { subordinate_err_parent :: !GlobalRdrElt + , subordinate_err_unavailable :: [FastString] + , subordinate_err_nontype :: [GlobalRdrElt] } | IsNotSubordinate data IELookupError = QualImportError RdrName - | BadImport (IE GhcPs) IsSubordinate + | BadImport (IE GhcPs) IsSubordinateError | IllegalImport failLookupWith :: IELookupError -> IELookupM a @@ -1603,9 +1616,14 @@ mkChildEnv gres = foldr add emptyNameEnv gres findChildren :: NameEnv [a] -> Name -> [a] findChildren env n = lookupNameEnv env n `orElse` [] +data LookupChildError + = LookupChildNotFound { lce_wrapped_name :: !(LIEWrappedName GhcPs) } + | LookupChildNonType { lce_wrapped_name :: !(LIEWrappedName GhcPs) + , _lce_nontype_item :: !GlobalRdrElt } + lookupChildren :: [GlobalRdrElt] -> [LIEWrappedName GhcPs] - -> MaybeErr [LIEWrappedName GhcPs] -- The ones for which the lookup failed + -> MaybeErr [LookupChildError] -- The ones for which the lookup failed [LocatedA GlobalRdrElt] -- (lookupChildren all_kids rdr_items) maps each rdr_item to its -- corresponding Name all_kids, if the former exists @@ -1623,21 +1641,25 @@ lookupChildren all_kids rdr_items = Failed fails where mb_xs = map doOne rdr_items - fails = [ bad_rdr | Failed bad_rdr <- mb_xs ] - oks = [ ok | Succeeded ok <- mb_xs ] + fails = [ err | Failed err <- mb_xs ] + oks = [ ok | Succeeded ok <- mb_xs ] oks :: [[LocatedA GlobalRdrElt]] - doOne item@(L l r) - = case (lookupFsEnv kid_env . occNameFS . rdrNameOcc . ieWrappedName) r of - Just [g] - | not $ isRecFldGRE g - -> Succeeded [L l g] - Just gs - | all isRecFldGRE gs - -> Succeeded $ map (L l) gs - _ -> Failed item + doOne :: LIEWrappedName GhcPs -> MaybeErr LookupChildError [LocatedA GlobalRdrElt] + doOne item@(L l r) = + case r of + IEName{} | notNull val_gs -> Succeeded [L l g | g <- val_gs] + IEName{} | notNull typ_gs -> Succeeded [L l g | g <- typ_gs] + IEType{} | notNull typ_gs -> Succeeded [L l g | g <- typ_gs] + IEType{} | (g:_) <- val_gs -> Failed $ LookupChildNonType item g + _ -> Failed $ LookupChildNotFound item + where + fs = (occNameFS . rdrNameOcc . ieWrappedName) r + gs = fromMaybe [] (lookupFsEnv kid_env fs) + (val_gs, typ_gs) = partition (isValNameSpace . greNameSpace) gs -- See Note [Children for duplicate record fields] + kid_env :: FastStringEnv [GlobalRdrElt] kid_env = extendFsEnvList_C (++) emptyFsEnv [(occNameFS (occName x), [x]) | x <- all_kids] @@ -2297,9 +2319,10 @@ DRFPatSynExport for a test of this. -} badImportItemErr - :: ModIface -> ImpDeclSpec -> IE GhcPs -> IsSubordinate + :: ModIface -> ImpDeclSpec -> IE GhcPs + -> IsSubordinateError -> [AvailInfo] - -> TcRn ImportLookupReason + -> TcRn [ImportLookupReason] -- non-empty badImportItemErr iface decl_spec ie sub avails = do patsyns_enabled <- xoptM LangExt.PatternSynonyms expl_ns_enabled <- xoptM LangExt.ExplicitNamespaces @@ -2307,20 +2330,24 @@ badImportItemErr iface decl_spec ie sub avails = do hsc_env <- getTopEnv let rdr_env = mkGlobalRdrEnv $ gresFromAvails hsc_env (Just imp_spec) all_avails - pure (ImportLookupBad (importErrorKind dflags rdr_env expl_ns_enabled) iface decl_spec ie patsyns_enabled) + pure [ImportLookupBad k iface decl_spec ie patsyns_enabled | k <- importErrorKind dflags rdr_env expl_ns_enabled ] where importErrorKind dflags rdr_env expl_ns_enabled | any checkIfTyCon avails = case sub of - IsNotSubordinate -> BadImportAvailTyCon expl_ns_enabled - IsSubordinate {} -> BadImportNotExportedSubordinates unavailableChildren - | any checkIfVarName avails = BadImportAvailVar - | Just con <- find checkIfDataCon avails = BadImportAvailDataCon (availOccName con) - | otherwise = BadImportNotExported suggs + IsNotSubordinate -> [BadImportAvailTyCon expl_ns_enabled] + IsSubordinateError { subordinate_err_parent = gre + , subordinate_err_unavailable = unavailable + , subordinate_err_nontype = nontype } + -> [BadImportNotExportedSubordinates gre unavailable | notNull unavailable] ++ + [BadImportNonTypeSubordinates gre nontype | notNull nontype ] + | any checkIfVarName avails = [BadImportAvailVar] + | Just con <- find checkIfDataCon avails = [BadImportAvailDataCon (availOccName con)] + | otherwise = [BadImportNotExported suggs] where suggs = similar_suggs ++ fieldSelectorSuggestions rdr_env rdr what_look = case sub of - IsNotSubordinate -> WL_TyCon_or_TermVar - IsSubordinate gre -> + IsNotSubordinate -> WL_TyCon_or_TermVar + IsSubordinateError { subordinate_err_parent = gre } -> case greInfo gre of IAmTyCon ClassFlavour -> WL_TyCon_or_TermVar @@ -2359,9 +2386,6 @@ badImportItemErr iface decl_spec ie sub avails = do importedFS = occNameFS $ rdrNameOcc rdr imp_spec = ImpSpec { is_decl = decl_spec, is_item = ImpAll } all_avails = mi_exports iface - unavailableChildren = case ie of - IEThingWith _ _ _ ns _ -> map (rdrNameOcc . ieWrappedName . unLoc) ns - _ -> panic "importedChildren failed pattern match: no children" addDupDeclErr :: NonEmpty GlobalRdrElt -> TcRn () addDupDeclErr gres@(gre :| _) ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -3305,6 +3305,7 @@ instance Diagnostic TcRnMessage where ++ [ImportSuggestion occ $ CouldAddTypeKeyword mod_name] BadImportAvailDataCon par -> [ImportSuggestion occ $ ImportDataCon (Just (mod_name, patsyns_enabled)) par] BadImportNotExportedSubordinates{} -> noHints + BadImportNonTypeSubordinates{} -> noHints TcRnImportLookup{} -> noHints TcRnUnusedImport{} @@ -5889,15 +5890,30 @@ pprImportLookup = \case where tycon_occ = rdrNameOcc $ ieName ie tycon = parenSymOcc tycon_occ (ppr tycon_occ) - BadImportNotExportedSubordinates ns -> + BadImportNotExportedSubordinates gre unavailable -> withContext - [ text "an item called" <+> quotes sub <+> text "is exported, but it does not export any children" - , text "(constructors, class methods or field names) called" - <+> pprWithCommas (quotes . ppr) ns <> dot + [ what <+> text "called" <+> parent_name <+> text "is exported, but it does not export" + , text "any" <+> what_children <+> text "called" <+> unavailable_names <> dot ] where - sub_occ = rdrNameOcc $ ieName ie - sub = parenSymOcc sub_occ (ppr sub_occ) + parent_name = (quotes . pprPrefixOcc . nameOccName . gre_name) gre + unavailable_names = pprWithCommas (quotes . ppr) unavailable + (what, what_children) = case greInfo gre of + IAmTyCon ClassFlavour -> (text "a class", text "class methods or associated types") + IAmTyCon _ -> (text "a data type", text "constructors or record fields") + _ -> (text "an item", text "children") + BadImportNonTypeSubordinates gre nontype -> + withContext + [ what <+> text "called" <+> parent_name <+> text "is exported," + , sep [ text "but its subordinate" <+> "item" <> plural nontype <+> nontype_names + , isOrAre nontype <+> "not in the type namespace." ] ] + where + parent_name = (quotes . pprPrefixOcc . nameOccName . gre_name) gre + nontype_names = pprWithCommas (quotes . pprPrefixOcc . nameOccName . gre_name) nontype + what = case greInfo gre of + IAmTyCon ClassFlavour -> text "a class" + IAmTyCon _ -> text "a data type" + _ -> text "an item" BadImportAvailDataCon dataType_occ -> withContext [ text "an item called" <+> quotes datacon ===================================== compiler/GHC/Tc/Errors/Types.hs ===================================== @@ -5846,7 +5846,9 @@ data BadImportKind -- @import Data.Maybe (Just)@ instead of @import Data.Maybe (Maybe(Just))@ | BadImportAvailDataCon OccName -- | The parent does not export the given children. - | BadImportNotExportedSubordinates [OccName] + | BadImportNotExportedSubordinates !GlobalRdrElt [FastString] + -- | Incorrect @type@ keyword when importing subordinates that aren't types. + | BadImportNonTypeSubordinates !GlobalRdrElt [GlobalRdrElt] -- | Incorrect @type@ keyword when importing something which isn't a type. | BadImportAvailVar deriving Generic ===================================== compiler/GHC/Types/Error/Codes.hs ===================================== @@ -756,6 +756,7 @@ type family GhcDiagnosticCode c = n | n -> c where GhcDiagnosticCode "BadImportNotExported" = 61689 GhcDiagnosticCode "BadImportAvailDataCon" = 35373 GhcDiagnosticCode "BadImportNotExportedSubordinates" = 10237 + GhcDiagnosticCode "BadImportNonTypeSubordinates" = 51433 GhcDiagnosticCode "BadImportAvailTyCon" = 56449 GhcDiagnosticCode "BadImportAvailVar" = 12112 ===================================== docs/users_guide/9.14.1-notes.rst ===================================== @@ -82,6 +82,9 @@ Compiler :ghc-ticket:`20875`, :ghc-ticket:`21172`, :ghc-ticket:`22257`, :ghc-ticket:`25238`, :ghc-ticket:`25834`. +- The compiler no longer accepts invalid ``type`` namespace specifiers in + subordinate import lists (:ghc-ticket:`22581`). + - A new flag, :ghc-flag:`-Wuseless-specialisations`, controls warnings emitted when GHC determines that a SPECIALISE pragma would have no effect. ===================================== docs/users_guide/exts/explicit_namespaces.rst ===================================== @@ -34,6 +34,20 @@ disambiguate this case, thus: :: module N( f, type (++) ) where data family a ++ b = L a | R b +It is also possible to use the ``type`` namespace specifier in subordinate +import and export lists: +:: + + module N (C(type (#))) where + class C a b where + type a # b + (#) :: a -> b -> (a # b) + module M where + import N as T (C(type (#))) + import N as D (C((#))) + -- (T.#) is the associated type + -- (D.#) is the class method + The extension :extension:`ExplicitNamespaces` is implied by :extension:`TypeOperators` and (for some reason) by :extension:`TypeFamilies`. ===================================== testsuite/tests/driver/RecompExports/RecompExports1.stderr ===================================== @@ -3,6 +3,6 @@ RecompExports1_N.hs:3:25: error: [GHC-61689] RecompExports1_N.hs:3:30: error: [GHC-10237] In the import of ‘RecompExports1_M’: - an item called ‘T’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘Foo’. + a data type called ‘T’ is exported, but it does not export + any constructors or record fields called ‘Foo’. ===================================== testsuite/tests/driver/RecompExports/RecompExports4.stderr ===================================== @@ -1,10 +1,10 @@ RecompExports4_N.hs:3:26: error: [GHC-10237] In the import of ‘RecompExports4_M’: - an item called ‘T’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘fld’. + a data type called ‘T’ is exported, but it does not export + any constructors or record fields called ‘fld’. RecompExports4_N.hs:3:39: error: [GHC-10237] In the import of ‘RecompExports4_M’: - an item called ‘C’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘meth’. + a class called ‘C’ is exported, but it does not export + any class methods or associated types called ‘meth’. ===================================== testsuite/tests/module/T21826.stderr ===================================== @@ -1,4 +1,3 @@ - T21826.hs:3:29: error: [GHC-56449] In the import of ‘Data.Type.Equality’: an item called ‘(~)’ is exported, but it is a type. @@ -24,13 +23,13 @@ T21826.hs:5:21: error: [GHC-61689] T21826.hs:6:21: error: [GHC-10237] In the import of ‘Data.Maybe’: - an item called ‘Maybe’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘Some’. + a data type called ‘Maybe’ is exported, but it does not export + any constructors or record fields called ‘Some’. T21826.hs:7:21: error: [GHC-10237] In the import of ‘Data.Maybe’: - an item called ‘Maybe’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘Some’, ‘Mk’. + a data type called ‘Maybe’ is exported, but it does not export + any constructors or record fields called ‘Some’, ‘Mk’. T21826.hs:8:20: error: [GHC-12112] In the import of ‘Data.List’: @@ -55,3 +54,4 @@ T21826.hs:13:21: error: [GHC-56449] Suggested fix: Add the ‘type’ keyword to the import statement: import Data.Maybe ( type Maybe ) + ===================================== testsuite/tests/module/mod81.stderr ===================================== @@ -1,5 +1,5 @@ - mod81.hs:3:16: error: [GHC-10237] In the import of ‘Prelude’: - an item called ‘Either’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘Foo’. + a data type called ‘Either’ is exported, but it does not export + any constructors or record fields called ‘Foo’. + ===================================== testsuite/tests/module/mod91.stderr ===================================== @@ -1,5 +1,5 @@ - mod91.hs:3:16: error: [GHC-10237] In the import of ‘Prelude’: - an item called ‘Eq’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘eq’. + a class called ‘Eq’ is exported, but it does not export + any class methods or associated types called ‘eq’. + ===================================== testsuite/tests/rename/should_compile/T22581c.hs ===================================== @@ -0,0 +1,13 @@ +{-# LANGUAGE ExplicitNamespaces #-} + +module T22581c where + +import T22581c_helper (K(type T), C(type (#), type Tf, type Df)) + +type T' :: K +type T' = T + +type C' a = C a +type (#.) a b = a # b +type Tf' a = Tf a +type Df' a = Df a \ No newline at end of file ===================================== testsuite/tests/rename/should_compile/T22581c_helper.hs ===================================== @@ -0,0 +1,10 @@ +{-# LANGUAGE TypeData, TypeFamilies #-} + +module T22581c_helper (K(T), C((#), Tf, Df)) where + +type data K = T + +class C a where + type a # b + type Tf a + data Df a \ No newline at end of file ===================================== testsuite/tests/rename/should_compile/T22581d.script ===================================== @@ -0,0 +1,2 @@ +:set -XExplicitNamespaces +import Data.Functor.Product (Product(type Pair)) ===================================== testsuite/tests/rename/should_compile/T22581d.stdout ===================================== @@ -0,0 +1,5 @@ +<interactive>:2:30: error: [GHC-51433] + In the import of ‘Data.Functor.Product’: + a data type called ‘Product’ is exported, + but its subordinate item ‘Pair’ is not in the type namespace. + ===================================== testsuite/tests/rename/should_compile/T25991a.hs ===================================== @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeFamilies, DataKinds #-} + +module T25991a where + +import T25991a_helper as T (C(type (#))) +import T25991a_helper as D (C((#))) + +type S a b = a T.# b +f a b = a D.# b \ No newline at end of file ===================================== testsuite/tests/rename/should_compile/T25991a_helper.hs ===================================== @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} + +module T25991a_helper (C(..)) where + +class C a b where + type a # b + (#) :: a -> b -> () ===================================== testsuite/tests/rename/should_compile/all.T ===================================== @@ -229,4 +229,7 @@ test('T14032d', normal, compile, ['']) test('T24621_normal', normal, compile, ['']) test('T24621_th', req_th, compile, ['']) test('T24732', normal, compile_and_run, ['-package "base(Prelude, Text.Printf as P\')"']) -test('T25182', [extra_files(['ReExportTuples.hs'])], multimod_compile, ['T25182', '-v0']) \ No newline at end of file +test('T25182', [extra_files(['ReExportTuples.hs'])], multimod_compile, ['T25182', '-v0']) +test('T22581c', [extra_files(['T22581c_helper.hs'])], multimod_compile, ['T22581c', '-v0']) +test('T22581d', combined_output, ghci_script, ['T22581d.script']) +test('T25991a', [extra_files(['T25991a_helper.hs'])], multimod_compile, ['T25991a', '-v0']) ===================================== testsuite/tests/rename/should_fail/T22581a.hs ===================================== @@ -0,0 +1,8 @@ +{-# LANGUAGE ExplicitNamespaces #-} + +module T22581a where + +import T22581a_helper (T(type MkT)) + +t :: T +t = MkT ===================================== testsuite/tests/rename/should_fail/T22581a.stderr ===================================== @@ -0,0 +1,5 @@ +T22581a.hs:5:24: error: [GHC-51433] + In the import of ‘T22581a_helper’: + a data type called ‘T’ is exported, + but its subordinate item ‘MkT’ is not in the type namespace. + ===================================== testsuite/tests/rename/should_fail/T22581a_helper.hs ===================================== @@ -0,0 +1,3 @@ +module T22581a_helper (T(MkT)) where + +data T = MkT ===================================== testsuite/tests/rename/should_fail/T22581b.hs ===================================== @@ -0,0 +1,6 @@ +{-# LANGUAGE ExplicitNamespaces #-} + +module T22581b where + +import T22581b_helper (T(type MkT1, MkT2, MkT3, unT)) + ===================================== testsuite/tests/rename/should_fail/T22581b.stderr ===================================== @@ -0,0 +1,10 @@ +T22581b.hs:5:24: error: [GHC-51433] + In the import of ‘T22581b_helper’: + a data type called ‘T’ is exported, + but its subordinate item ‘MkT1’ is not in the type namespace. + +T22581b.hs:5:24: error: [GHC-10237] + In the import of ‘T22581b_helper’: + a data type called ‘T’ is exported, but it does not export + any constructors or record fields called ‘MkT3’, ‘unT’. + ===================================== testsuite/tests/rename/should_fail/T22581b_helper.hs ===================================== @@ -0,0 +1,3 @@ +module T22581b_helper (T(MkT1, MkT2)) where + +data T = MkT1 | MkT2 ===================================== testsuite/tests/rename/should_fail/T25991b1.hs ===================================== @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies, DataKinds #-} + +module T25991b1 where + +import T25991b_helper (C((#))) + +type S a b = a # b \ No newline at end of file ===================================== testsuite/tests/rename/should_fail/T25991b2.hs ===================================== @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies, DataKinds #-} + +module T25991b2 where + +import T25991b_helper (C(type (#))) + +f a b = a # b \ No newline at end of file ===================================== testsuite/tests/rename/should_fail/T25991b_helper.hs ===================================== @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} + +module T25991b_helper (C(..)) where + +class C a b where + type a # b + (#) :: a -> b -> () ===================================== testsuite/tests/rename/should_fail/T9006.stderr ===================================== @@ -1,5 +1,5 @@ - T9006.hs:3:16: error: [GHC-10237] In the import of ‘T9006a’: - an item called ‘T’ is exported, but it does not export any children - (constructors, class methods or field names) called ‘T’. + a data type called ‘T’ is exported, but it does not export + any constructors or record fields called ‘T’. + ===================================== testsuite/tests/rename/should_fail/all.T ===================================== @@ -237,3 +237,7 @@ test('T25877', [extra_files(['T25877_aux.hs'])], multimod_compile_fail, ['T25877 test('T23501_fail', normal, compile_fail, ['']) test('T23501_fail_ext', normal, compile_fail, ['']) test('T25437', normal, compile_fail, ['']) +test('T22581a', [extra_files(['T22581a_helper.hs'])], multimod_compile_fail, ['T22581a', '-v0']) +test('T22581b', [extra_files(['T22581b_helper.hs'])], multimod_compile_fail, ['T22581b', '-v0']) +test('T25991b1', [extra_files(['T25991b_helper.hs'])], multimod_compile_fail, ['T25991b1', '-v0']) +test('T25991b2', [extra_files(['T25991b_helper.hs'])], multimod_compile_fail, ['T25991b2', '-v0']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b911a6f11acbafe2bd7b0c79cbdb9c51... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b911a6f11acbafe2bd7b0c79cbdb9c51... You're receiving this email because of your account on gitlab.haskell.org.