[Git][ghc/ghc][wip/fendor/has-field-hie] Deleted 1 commit: Typeable test
Hannes Siebenhandl pushed to branch wip/fendor/has-field-hie at Glasgow Haskell Compiler / GHC WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below. Deleted commits: 6a08787c by fendor at 2026-09-17T11:55:40+02:00 Typeable test - - - - - 4 changed files: - compiler/GHC/Iface/Ext/Types.hs - + testsuite/tests/hiefile/should_run/HieTypeable.hs - + testsuite/tests/hiefile/should_run/HieTypeable.stdout - testsuite/tests/hiefile/should_run/all.T Changes: ===================================== compiler/GHC/Iface/Ext/Types.hs ===================================== @@ -616,17 +616,23 @@ data EvBindDep -- ^ 'Name' of the record selector Name -- ^ 'Name' of the parent type. + | TypeableEvidence + -- ^ Evidence of a @Typeable@ constraint. + Name + -- ^ Name of the type the evidence was generated for. deriving (Eq, Ord) instance Outputable EvBindDep where ppr = \ case EvidenceVar n -> ppr n RecordField sel parent -> ppr sel <+> text "of Record" <+> ppr parent + TypeableEvidence n -> ppr n <+> text "bound by Typeable" evBindDepName :: EvBindDep -> Name evBindDepName = \ case EvidenceVar n -> n RecordField selector _record -> selector + TypeableEvidence n -> n evBindDepHieName :: EvBindDep -> HieName evBindDepHieName = toHieName . evBindDepName @@ -640,11 +646,15 @@ instance Binary EvBindDep where putByte bh 1 put_ bh n put_ bh sel + TypeableEvidence n -> do + putByte bh 2 + put_ bh n get bh = getByte bh >>= \ case 0 -> EvidenceVar <$> get bh 1 -> RecordField <$> get bh <*> get bh + 2 -> TypeableEvidence <$> get bh t -> fail $ "EvBindDep: Unknown tag: " ++ show t -- | Eq/Ord instances compare on the converted HieName, ===================================== testsuite/tests/hiefile/should_run/HieTypeable.hs ===================================== @@ -0,0 +1,28 @@ +module Main where + +import Data.Dynamic +import Data.Typeable +import TestUtils + +data Thing = Thing {field1 :: Char, field2 :: Bool} + deriving (Show, Eq) + +castFromDynamic :: Dynamic -> Maybe Thing +castFromDynamic d = fromDynamic d + -- ^ this is the point + +rep :: Thing -> TypeRep +rep d = typeOf d + -- ^ this is the point + +points = + [ (11,21) + , (15,10) + ] + +main = do + (df, hf) <- readTestHie "HieTypeable.hie" + let refmap = generateReferencesMap $ getAsts $ hie_asts hf + + traverse (explainEv df hf refmap) points + return () ===================================== testsuite/tests/hiefile/should_run/HieTypeable.stdout ===================================== @@ -0,0 +1,30 @@ +========================== +At point (11,21), we found: +========================== +┌ +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing +│ is an evidence variable bound by a let, depending on: [$dTypeable] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ +| +`- ┌ + │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing + │ is an evidence variable bound by a let, depending on: [] + │ with scope: ModuleScope + │ + │ Defined at <no location info> + └ + +========================== +At point (15,10), we found: +========================== +┌ +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing +│ is an evidence variable bound by a let, depending on: [] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ + ===================================== testsuite/tests/hiefile/should_run/all.T ===================================== @@ -12,3 +12,4 @@ test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files([ test('T25709', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('HasFieldQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('NoFieldSelectorQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) +test('HieTypeable', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6a08787cb2b231e77018dbf962e37e7b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6a08787cb2b231e77018dbf962e37e7b... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Hannes Siebenhandl (@fendor)