Hannes Siebenhandl pushed to branch wip/fendor/has-field-hie at Glasgow Haskell Compiler / GHC

Commits:

13 changed files:

Changes:

  • compiler/GHC/Iface/Ext/Ast.hs
    ... ... @@ -21,7 +21,7 @@ import GHC.Core.Class ( className, classSCSelIds )
    21 21
     import GHC.Core.ConLike           ( conLikeName )
    
    22 22
     import GHC.Core.DataCon           ( dataConWrapperType )
    
    23 23
     import GHC.Core.Type              ( Type, ForAllTyFlag(..) )
    
    24
    -import GHC.Core.TyCon             ( TyCon, tyConClass_maybe )
    
    24
    +import GHC.Core.TyCon             ( TyCon, tyConClass_maybe, tyConName )
    
    25 25
     import GHC.Core.InstEnv
    
    26 26
     
    
    27 27
     import GHC.Hs
    
    ... ... @@ -37,7 +37,7 @@ import GHC.Types.Name ( Name, nameSrcSpan, nameUnique, wiredInNameTy
    37 37
     import GHC.Types.Name.Env         ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv )
    
    38 38
     import GHC.Types.Name.Reader      ( RecFieldInfo(..), WithUserRdr(..) )
    
    39 39
     import GHC.Types.SrcLoc
    
    40
    -import GHC.Types.Var              ( Id, Var, EvId, varName, varType, varUnique )
    
    40
    +import GHC.Types.Var              ( Id, Var, varName, varType, varUnique )
    
    41 41
     import GHC.Types.Var.Env
    
    42 42
     import GHC.Types.Var.FV
    
    43 43
     
    
    ... ... @@ -680,21 +680,32 @@ instance ToHie (Context (Located Name)) where
    680 680
     instance ToHie (Context (Located (WithUserRdr Name))) where
    
    681 681
       toHie (C c (L l (WithUserRdr _ n))) = toHie $ C c (L l n)
    
    682 682
     
    
    683
    -hieEvIdsOfTerm :: EvTerm -> [EvId]
    
    684
    --- Returns only EvIds satisfying relevantEvId
    
    685
    -hieEvIdsOfTerm = runFVSelectiveList isId . evTermFVs
    
    683
    +-- | Find the free variables of the evidence term.
    
    684
    +--
    
    685
    +-- These need to be processed by 'mkEvBindDep_maybe' to filter
    
    686
    +-- evidence variables irrelevant to the user and add better
    
    687
    +-- evidence locations.
    
    688
    +hieIdsOfTerm :: EvTerm -> [Id]
    
    689
    +hieIdsOfTerm = runFVSelectiveList isId . evTermFVs
    
    690
    +
    
    691
    +-- | 'EvTerm' have a special case @Typeable@ evidence.
    
    692
    +--
    
    693
    +-- Use it to provide better source locations.
    
    694
    +builtinEvBindDeps :: EvTerm -> [EvBindDep]
    
    695
    +builtinEvBindDeps (EvTypeable _ (EvTypeableTyCon tc _)) = [EvidenceTypeable (tyConName tc)]
    
    696
    +builtinEvBindDeps _                                     = []
    
    686 697
     
    
    687 698
     instance ToHie (EvBindContext (LocatedA TcEvBinds)) where
    
    688 699
       toHie (EvBindContext sc sp (L span (EvBinds bs)))
    
    689 700
         = concatMapM go $ bagToList bs
    
    690 701
         where
    
    691 702
           go evbind = do
    
    692
    -          let evDeps = hieEvIdsOfTerm $ eb_rhs evbind
    
    693
    -              depNames = EvBindDeps $ map varName evDeps
    
    703
    +          let evDeps = mapMaybe (\v -> (v,) <$> mkEvBindDep_maybe v) $ hieIdsOfTerm (eb_rhs evbind)
    
    704
    +              depNames = EvBindDeps (map snd evDeps ++ builtinEvBindDeps (eb_rhs evbind))
    
    694 705
               concatM $
    
    695 706
                 [ toHie (C (EvidenceVarBind (EvLetBind depNames) (combineScopes sc (mkScope span)) sp)
    
    696 707
                                             (L span $ eb_lhs evbind))
    
    697
    -            , toHie $ map (C EvidenceVarUse . L span) $ evDeps
    
    708
    +            , toHie $ map (C EvidenceVarUse . L span . fst) evDeps
    
    698 709
                 ]
    
    699 710
       toHie _ = pure []
    
    700 711
     
    
    ... ... @@ -710,7 +721,7 @@ instance ToHie (LocatedA HsWrapper) where
    710 721
               toHie $ C (EvidenceVarBind EvWrapperBind (mkScope osp) (getRealSpanA osp))
    
    711 722
                     $ L osp a
    
    712 723
             (WpEvApp a) ->
    
    713
    -          concatMapM (toHie . C EvidenceVarUse . L osp) $ hieEvIdsOfTerm a
    
    724
    +          concatMapM (toHie . C EvidenceVarUse . L osp) $ filter (isJust . mkEvBindDep_maybe) $ hieIdsOfTerm a
    
    714 725
             _               -> pure []
    
    715 726
     
    
    716 727
     instance HiePass p => HasType (LocatedA (HsBind (GhcPass p))) where
    

  • compiler/GHC/Iface/Ext/Types.hs
    ... ... @@ -11,37 +11,42 @@ module GHC.Iface.Ext.Types where
    11 11
     
    
    12 12
     import GHC.Prelude
    
    13 13
     
    
    14
    -import GHC.Settings.Config
    
    15
    -import GHC.Utils.Binary
    
    16 14
     import GHC.Data.FastString
    
    15
    +
    
    16
    +import GHC.Core.ConLike (ConLike (..))
    
    17
    +import GHC.Core.Predicate (isEvId)
    
    18
    +import GHC.Core.TyCo.Rep (Type (..))
    
    19
    +import GHC.Core.TyCon (isClassTyCon, isFamilyTyCon, isTypeSynonymTyCon)
    
    20
    +import GHC.Core.Type (Var (..), coreFullView, isFunTy)
    
    17 21
     import GHC.Iface.Type
    
    18
    -import GHC.Unit.Module            ( Module )
    
    22
    +import GHC.Settings.Config
    
    23
    +import GHC.Types.Avail
    
    24
    +import GHC.Types.Id (Id, idDetails, isClassOpId, isLocalId, isRecordSelector)
    
    25
    +import GHC.Types.Id.Info (IdDetails (..), recSelParentName)
    
    19 26
     import GHC.Types.Name
    
    20
    -import GHC.Utils.Outputable hiding ( (<>) )
    
    21 27
     import GHC.Types.SrcLoc
    
    22
    -import GHC.Types.Avail
    
    23
    -import qualified GHC.Utils.Outputable as O ( (<>) )
    
    28
    +import GHC.Types.TyThing (TyThing (..))
    
    29
    +import GHC.Types.Var (cmpForAllTyFlagExactly, isFUNArg, isTyVar)
    
    30
    +import qualified GHC.Types.Var as Var
    
    31
    +import GHC.Unit.Module (Module)
    
    32
    +import GHC.Utils.Binary
    
    33
    +import GHC.Utils.Outputable hiding ((<>))
    
    34
    +import qualified GHC.Utils.Outputable as O ((<>))
    
    24 35
     import GHC.Utils.Panic
    
    25
    -import GHC.Core.ConLike           ( ConLike(..) )
    
    26
    -import GHC.Core.TyCo.Rep          ( Type(..) )
    
    27
    -import GHC.Core.Type              ( coreFullView, isFunTy, Var (..) )
    
    28
    -import GHC.Core.TyCon             ( isTypeSynonymTyCon, isClassTyCon, isFamilyTyCon )
    
    29
    -import GHC.Types.Id               ( Id, isRecordSelector, isClassOpId )
    
    30
    -import GHC.Types.TyThing          ( TyThing (..) )
    
    31
    -import GHC.Types.Var              ( isTyVar, isFUNArg, cmpForAllTyFlagExactly )
    
    32 36
     
    
    37
    +import Language.Haskell.Syntax.Module.Name
    
    38
    +
    
    39
    +import Control.Applicative ((<|>))
    
    33 40
     import qualified Data.Array as A
    
    41
    +import Data.ByteString (ByteString)
    
    42
    +import Data.Coerce (coerce)
    
    43
    +import Data.Data (Data)
    
    44
    +import Data.Function (on)
    
    34 45
     import qualified Data.Map as M
    
    35
    -import qualified Data.Set as S
    
    36
    -import Data.ByteString            ( ByteString )
    
    37
    -import Data.Data                  ( Data )
    
    38
    -import Data.Semigroup             ( Semigroup(..) )
    
    39
    -import Data.Word                  ( Word8 )
    
    40
    -import Control.Applicative        ( (<|>) )
    
    41
    -import Data.Coerce                ( coerce  )
    
    42
    -import Data.Function              ( on )
    
    46
    +import Data.Semigroup (Semigroup (..))
    
    43 47
     import qualified Data.Semigroup as S
    
    44
    -import Language.Haskell.Syntax.Module.Name
    
    48
    +import qualified Data.Set as S
    
    49
    +import Data.Word (Word8)
    
    45 50
     
    
    46 51
     type Span = RealSrcSpan
    
    47 52
     
    
    ... ... @@ -618,17 +623,94 @@ instance Outputable EvVarSource where
    618 623
       ppr (EvInstBind True cls) = text "bound due to a superclass of " <+> ppr cls
    
    619 624
       ppr (EvLetBind deps) = text "bound by a let, depending on:" <+> ppr deps
    
    620 625
     
    
    626
    +-- | Evidence binding dependency with additional details.
    
    627
    +data EvBindDep
    
    628
    +  = EvidenceVar Name
    
    629
    +    -- ^ Generic evidence bind dependency.
    
    630
    +  | EvidenceRecordField
    
    631
    +    -- ^ Evidence dependency on a record selector.
    
    632
    +    --
    
    633
    +    -- This is for example generated with @-XOverloadedRecordDot@, where
    
    634
    +    -- the evidence includes a reference to which record selector is used
    
    635
    +    -- to implement @getField@.
    
    636
    +      Name
    
    637
    +      -- ^ 'Name' of the record selector
    
    638
    +      Name
    
    639
    +      -- ^ 'Name' of the parent type.
    
    640
    +  | EvidenceTypeable
    
    641
    +    -- ^ Typeable evidence dependency
    
    642
    +      Name
    
    643
    +      -- ^ Name of the type of 'Typeable' dependency.
    
    644
    +
    
    645
    +instance Outputable EvBindDep where
    
    646
    +  ppr = \ case
    
    647
    +    EvidenceVar n -> ppr n
    
    648
    +    EvidenceRecordField sel parent -> ppr sel <+> text "of record" <+> ppr parent
    
    649
    +    EvidenceTypeable ty -> text "Typeable" <+> ppr ty
    
    650
    +
    
    651
    +-- | Generate an 'EvBindDep' from an 'Id'.
    
    652
    +--
    
    653
    +-- Only certain 'Id's are usable evidence binding dependencies.
    
    654
    +-- The following 'Id's, we can do something useful with:
    
    655
    +--
    
    656
    +-- * any 'isEvId': by definition, a usable evidence.
    
    657
    +--   * Non-local ids are usually generated without any usable source spans.
    
    658
    +-- * 'RecSelId': used for record dot syntax.
    
    659
    +-- * 'DFunId': Dictionary function such as @$fShowList@
    
    660
    +-- * 'ClassOpId': if used as superclass selectors such as @$dEq = $p1Ord \@a $dOrd@
    
    661
    +mkEvBindDep_maybe :: Id -> Maybe EvBindDep
    
    662
    +mkEvBindDep_maybe v = case idDetails v of
    
    663
    +  RecSelId{sel_tycon}       -> Just $ EvidenceRecordField n (recSelParentName sel_tycon)
    
    664
    +  DFunId{}                  -> Just $ EvidenceVar n
    
    665
    +  ClassOpId{} | isEvId v    -> Just $ EvidenceVar n
    
    666
    +  _ | isLocalId v, isEvId v -> Just $ EvidenceVar n
    
    667
    +  _                         -> Nothing
    
    668
    +  where
    
    669
    +    n = Var.varName v
    
    670
    +
    
    671
    +evBindDepName :: EvBindDep -> Name
    
    672
    +evBindDepName = \ case
    
    673
    +  EvidenceVar n -> n
    
    674
    +  EvidenceRecordField selector _record -> selector
    
    675
    +  EvidenceTypeable ty -> ty
    
    676
    +
    
    677
    +evBindDepHieName :: EvBindDep -> HieName
    
    678
    +evBindDepHieName = toHieName . evBindDepName
    
    679
    +
    
    680
    +instance Binary EvBindDep where
    
    681
    +  put_ bh = \ case
    
    682
    +    EvidenceVar n -> do
    
    683
    +      putByte bh 0
    
    684
    +      put_ bh n
    
    685
    +    EvidenceRecordField sel parent -> do
    
    686
    +      putByte bh 1
    
    687
    +      put_ bh sel
    
    688
    +      put_ bh parent
    
    689
    +    EvidenceTypeable ty -> do
    
    690
    +      putByte bh 2
    
    691
    +      put_ bh ty
    
    692
    +
    
    693
    +  get bh =
    
    694
    +    getByte bh >>= \ case
    
    695
    +      0 -> EvidenceVar <$> get bh
    
    696
    +      1 -> EvidenceRecordField <$> get bh <*> get bh
    
    697
    +      2 -> EvidenceTypeable <$> get bh
    
    698
    +      t -> fail $ "EvBindDep: Unknown tag: " ++ show t
    
    699
    +
    
    621 700
     -- | Eq/Ord instances compare on the converted HieName,
    
    622 701
     -- as non-exported names may have different uniques after
    
    623 702
     -- a roundtrip
    
    624
    -newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [Name] }
    
    703
    +newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [EvBindDep] }
    
    625 704
       deriving Outputable
    
    626 705
     
    
    706
    +evBindDepsNames :: EvBindDeps -> [Name]
    
    707
    +evBindDepsNames = map evBindDepName . getEvBindDeps
    
    708
    +
    
    627 709
     instance Eq EvBindDeps where
    
    628
    -  (==) = coerce ((==) `on` map toHieName)
    
    710
    +  (==) = coerce ((==) `on` map evBindDepHieName)
    
    629 711
     
    
    630 712
     instance Ord EvBindDeps where
    
    631
    -  compare = coerce (compare `on` map toHieName)
    
    713
    +  compare = coerce (compare `on` map evBindDepHieName)
    
    632 714
     
    
    633 715
     instance Binary EvBindDeps where
    
    634 716
       put_ bh (EvBindDeps xs) = put_ bh xs
    

  • compiler/GHC/Iface/Ext/Utils.hs
    ... ... @@ -145,7 +145,7 @@ getEvidenceTree refmap var = go emptyNameSet var
    145 145
                      det <- S.toList $ identInfo dets
    
    146 146
                      case det of
    
    147 147
                        EvidenceVarBind src@(EvLetBind (getEvBindDeps -> xs)) scp spn ->
    
    148
    -                     pure $ Just ((src,scp,spn),mapMaybe (go $ extendNameSet seen var) xs)
    
    148
    +                     pure $ Just ((src,scp,spn),mapMaybe (go (extendNameSet seen var) . evBindDepName) xs)
    
    149 149
                        EvidenceVarBind src scp spn -> pure $ Just ((src,scp,spn),[])
    
    150 150
                        _ -> pure Nothing
    
    151 151
                   pure $ Tree.Node (EvidenceInfo var sp typ (Just evdet)) children
    
    ... ... @@ -390,7 +390,7 @@ definedInAsts asts n = case nameSrcSpan n of
    390 390
     
    
    391 391
     getEvidenceBindDeps :: ContextInfo -> [Name]
    
    392 392
     getEvidenceBindDeps (EvidenceVarBind (EvLetBind xs) _ _) =
    
    393
    -  getEvBindDeps xs
    
    393
    +  evBindDepsNames xs
    
    394 394
     getEvidenceBindDeps _ = []
    
    395 395
     
    
    396 396
     isEvidenceBind :: ContextInfo -> Bool
    

  • testsuite/tests/hiefile/should_run/HasCallStackIds.hs
    1
    +{-# LANGUAGE DataKinds #-}
    
    2
    +module Main where
    
    3
    +
    
    4
    +import TestUtils
    
    5
    +import GHC.Stack
    
    6
    +import GHC.TypeLits
    
    7
    +import Data.Proxy
    
    8
    +
    
    9
    +callee :: HasCallStack => Int
    
    10
    +callee = length (prettyCallStack callStack)
    
    11
    +
    
    12
    +caller :: HasCallStack => Int
    
    13
    +caller = callee
    
    14
    +--       ^
    
    15
    +
    
    16
    +sym :: String
    
    17
    +sym = symbolVal (Proxy :: Proxy "hello")
    
    18
    +--    ^
    
    19
    +
    
    20
    +points :: [(Int, Int)]
    
    21
    +points = [(13,10), (17,7)]
    
    22
    +
    
    23
    +main :: IO ()
    
    24
    +main = do
    
    25
    +  (df, hf) <- readTestHie "HasCallStackIds.hie"
    
    26
    +  let refmap = generateReferencesMap $ getAsts $ hie_asts hf
    
    27
    +  mapM_ (explainEv df hf refmap) points

  • testsuite/tests/hiefile/should_run/HasCallStackIds.stdout
    1
    +==========================
    
    2
    +At point (13,10), we found:
    
    3
    +==========================
    
    4
    +┌
    
    5
    +│ $dIP at HasCallStackIds.hs:13:1-15, of type: HasCallStack
    
    6
    +│     is an evidence variable bound by a let, depending on: [$dIP]
    
    7
    +│           with scope: LocalScope HasCallStackIds.hs:13:1-15
    
    8
    +│           bound at: HasCallStackIds.hs:13:1-15
    
    9
    +│     Defined at <no location info>
    
    10
    +└
    
    11
    +|
    
    12
    +`- ┌
    
    13
    +   │ $dIP at HasCallStackIds.hs:13:1-15, of type: HasCallStack
    
    14
    +   │     is an evidence variable bound by a let, depending on: [$dIP]
    
    15
    +   │           with scope: LocalScope HasCallStackIds.hs:13:1-15
    
    16
    +   │           bound at: HasCallStackIds.hs:13:1-15
    
    17
    +   │     Defined at <no location info>
    
    18
    +   └
    
    19
    +   |
    
    20
    +   `- ┌
    
    21
    +      │ $dIP at HasCallStackIds.hs:13:1-15, of type: HasCallStack
    
    22
    +      │     is an evidence variable bound by a HsWrapper
    
    23
    +      │           with scope: LocalScope HasCallStackIds.hs:13:1-15
    
    24
    +      │           bound at: HasCallStackIds.hs:13:1-15
    
    25
    +      │     Defined at <no location info>
    
    26
    +      └
    
    27
    +
    
    28
    +==========================
    
    29
    +At point (17,7), we found:
    
    30
    +==========================
    
    31
    +┌
    
    32
    +│ $dKnownSymbol at HasCallStackIds.hs:1:1, of type: KnownSymbol "hello"
    
    33
    +│     is an evidence variable bound by a let, depending on: []
    
    34
    +│           with scope: ModuleScope
    
    35
    +│           
    
    36
    +│     Defined at <no location info>
    
    37
    +└
    
    38
    +

  • testsuite/tests/hiefile/should_run/HasFieldQueries.hs
    ... ... @@ -3,8 +3,6 @@ module Main where
    3 3
     
    
    4 4
     import TestUtils
    
    5 5
     import GHC.Records
    
    6
    -import GHC.TypeLits
    
    7
    -import Data.Tree
    
    8 6
     
    
    9 7
     data Thing = Thing {field1 :: Char, field2 :: Bool}
    
    10 8
       deriving (Show, Eq)
    
    ... ... @@ -44,17 +42,17 @@ prefixNested x = (.nested1.field1) x
    44 42
     
    
    45 43
     
    
    46 44
     points =
    
    47
    -  [ (13,17)
    
    48
    -  , (16,25)
    
    49
    -  , (16,27)
    
    50
    -  , (23,17)
    
    51
    -  , (23,25)
    
    52
    -  , (27,20)
    
    53
    -  , (27,28)
    
    54
    -  , (33,22)
    
    55
    -  , (37,14)
    
    56
    -  , (41,21)
    
    57
    -  , (41,30)
    
    45
    +  [ (11,17)
    
    46
    +  , (14,25)
    
    47
    +  , (14,27)
    
    48
    +  , (21,17)
    
    49
    +  , (21,25)
    
    50
    +  , (25,20)
    
    51
    +  , (25,28)
    
    52
    +  , (31,22)
    
    53
    +  , (35,14)
    
    54
    +  , (39,21)
    
    55
    +  , (39,30)
    
    58 56
       ]
    
    59 57
     
    
    60 58
     main = do
    

  • testsuite/tests/hiefile/should_run/HasFieldQueries.stdout
    1 1
     ==========================
    
    2
    -At point (13,17), we found:
    
    2
    +At point (11,17), we found:
    
    3 3
     ==========================
    
    4 4
     ┌
    
    5 5
     │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
    
    6
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    7
    -│                                                            field1]
    
    6
    +│     is an evidence variable bound by a let, depending on: [field1 of record Thing]
    
    8 7
     │           with scope: ModuleScope
    
    9 8
     │           
    
    10 9
     │     Defined at <no location info>
    
    11 10
     └
    
    12 11
     |
    
    13
    -+- ┌
    
    14
    -|  │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    15
    -|  │     is a usage of an external evidence variable
    
    16
    -|  │     Defined in `GHC.Internal.Records'
    
    17
    -|  └
    
    18
    -|
    
    19 12
     `- ┌
    
    20 13
        │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
    
    21 14
        │     is a usage of an external evidence variable
    
    22
    -   │     Defined at HasFieldQueries.hs:9:21
    
    15
    +   │     Defined at HasFieldQueries.hs:7:21
    
    23 16
        └
    
    24 17
     
    
    25 18
     ==========================
    
    26
    -At point (16,25), we found:
    
    19
    +At point (14,25), we found:
    
    27 20
     ==========================
    
    28 21
     ==========================
    
    29
    -At point (16,27), we found:
    
    22
    +At point (14,27), we found:
    
    30 23
     ==========================
    
    31 24
     ┌
    
    32
    -│ $dHasField at HasFieldQueries.hs:16:1-32, of type: HasField "field1" Thing Char
    
    33
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    34
    -│                                                            field1]
    
    35
    -│           with scope: LocalScope HasFieldQueries.hs:16:1-32
    
    36
    -│           bound at: HasFieldQueries.hs:16:1-32
    
    25
    +│ $dHasField at HasFieldQueries.hs:14:1-32, of type: HasField "field1" Thing Char
    
    26
    +│     is an evidence variable bound by a let, depending on: [field1 of record Thing]
    
    27
    +│           with scope: LocalScope HasFieldQueries.hs:14:1-32
    
    28
    +│           bound at: HasFieldQueries.hs:14:1-32
    
    37 29
     │     Defined at <no location info>
    
    38 30
     └
    
    39 31
     |
    
    40
    -+- ┌
    
    41
    -|  │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    42
    -|  │     is a usage of an external evidence variable
    
    43
    -|  │     Defined in `GHC.Internal.Records'
    
    44
    -|  └
    
    45
    -|
    
    46 32
     `- ┌
    
    47 33
        │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
    
    48 34
        │     is a usage of an external evidence variable
    
    49
    -   │     Defined at HasFieldQueries.hs:9:21
    
    35
    +   │     Defined at HasFieldQueries.hs:7:21
    
    50 36
        └
    
    51 37
     
    
    52 38
     ==========================
    
    53
    -At point (23,17), we found:
    
    39
    +At point (21,17), we found:
    
    54 40
     ==========================
    
    55 41
     ┌
    
    56 42
     │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing
    
    57
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    58
    -│                                                            nested1]
    
    43
    +│     is an evidence variable bound by a let, depending on: [nested1 of record NestedThing]
    
    59 44
     │           with scope: ModuleScope
    
    60 45
     │           
    
    61 46
     │     Defined at <no location info>
    
    62 47
     └
    
    63 48
     |
    
    64
    -+- ┌
    
    65
    -|  │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    66
    -|  │     is a usage of an external evidence variable
    
    67
    -|  │     Defined in `GHC.Internal.Records'
    
    68
    -|  └
    
    69
    -|
    
    70 49
     `- ┌
    
    71 50
        │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing
    
    72 51
        │     is a usage of an external evidence variable
    
    73
    -   │     Defined at HasFieldQueries.hs:20:34
    
    52
    +   │     Defined at HasFieldQueries.hs:18:34
    
    74 53
        └
    
    75 54
     
    
    76 55
     ==========================
    
    77
    -At point (23,25), we found:
    
    56
    +At point (21,25), we found:
    
    78 57
     ==========================
    
    79 58
     ┌
    
    80 59
     │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
    
    ... ... @@ -86,84 +65,77 @@ At point (23,25), we found:
    86 65
     |
    
    87 66
     `- ┌
    
    88 67
        │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
    
    89
    -   │     is an evidence variable bound by a let, depending on: [C:HasField,
    
    90
    -   │                                                            field1]
    
    68
    +   │     is an evidence variable bound by a let, depending on: [field1 of record Thing]
    
    91 69
        │           with scope: ModuleScope
    
    92 70
        │           
    
    93 71
        │     Defined at <no location info>
    
    94 72
        └
    
    95 73
        |
    
    96
    -   +- ┌
    
    97
    -   |  │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    98
    -   |  │     is a usage of an external evidence variable
    
    99
    -   |  │     Defined in `GHC.Internal.Records'
    
    100
    -   |  └
    
    101
    -   |
    
    102 74
        `- ┌
    
    103 75
           │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
    
    104 76
           │     is a usage of an external evidence variable
    
    105
    -      │     Defined at HasFieldQueries.hs:9:21
    
    77
    +      │     Defined at HasFieldQueries.hs:7:21
    
    106 78
           └
    
    107 79
     
    
    108 80
     ==========================
    
    109
    -At point (27,20), we found:
    
    81
    +At point (25,20), we found:
    
    110 82
     ==========================
    
    111 83
     ┌
    
    112
    -│ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "nested1" r r
    
    84
    +│ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "nested1" r r
    
    113 85
     │     is an evidence variable bound by a let, depending on: [$dHasField]
    
    114
    -│           with scope: LocalScope HasFieldQueries.hs:27:1-40
    
    115
    -│           bound at: HasFieldQueries.hs:27:1-40
    
    86
    +│           with scope: LocalScope HasFieldQueries.hs:25:1-40
    
    87
    +│           bound at: HasFieldQueries.hs:25:1-40
    
    116 88
     │     Defined at <no location info>
    
    117 89
     └
    
    118 90
     |
    
    119 91
     `- ┌
    
    120
    -   │ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "nested1" r r
    
    92
    +   │ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "nested1" r r
    
    121 93
        │     is an evidence variable bound by a type signature
    
    122
    -   │           with scope: LocalScope HasFieldQueries.hs:27:1-40
    
    123
    -   │           bound at: HasFieldQueries.hs:27:1-40
    
    94
    +   │           with scope: LocalScope HasFieldQueries.hs:25:1-40
    
    95
    +   │           bound at: HasFieldQueries.hs:25:1-40
    
    124 96
        │     Defined at <no location info>
    
    125 97
        └
    
    126 98
     
    
    127 99
     ==========================
    
    128
    -At point (27,28), we found:
    
    100
    +At point (25,28), we found:
    
    129 101
     ==========================
    
    130 102
     ┌
    
    131
    -│ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "field2" r Bool
    
    103
    +│ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "field2" r Bool
    
    132 104
     │     is an evidence variable bound by a let, depending on: [$dHasField]
    
    133
    -│           with scope: LocalScope HasFieldQueries.hs:27:1-40
    
    134
    -│           bound at: HasFieldQueries.hs:27:1-40
    
    105
    +│           with scope: LocalScope HasFieldQueries.hs:25:1-40
    
    106
    +│           bound at: HasFieldQueries.hs:25:1-40
    
    135 107
     │     Defined at <no location info>
    
    136 108
     └
    
    137 109
     |
    
    138 110
     `- ┌
    
    139
    -   │ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "field2" r Bool
    
    111
    +   │ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "field2" r Bool
    
    140 112
        │     is an evidence variable bound by a type signature
    
    141
    -   │           with scope: LocalScope HasFieldQueries.hs:27:1-40
    
    142
    -   │           bound at: HasFieldQueries.hs:27:1-40
    
    113
    +   │           with scope: LocalScope HasFieldQueries.hs:25:1-40
    
    114
    +   │           bound at: HasFieldQueries.hs:25:1-40
    
    143 115
        │     Defined at <no location info>
    
    144 116
        └
    
    145 117
     
    
    146 118
     ==========================
    
    147
    -At point (33,22), we found:
    
    119
    +At point (31,22), we found:
    
    148 120
     ==========================
    
    149 121
     ┌
    
    150
    -│ $dHasField at HasFieldQueries.hs:33:1-27, of type: HasField "field1" x Char
    
    122
    +│ $dHasField at HasFieldQueries.hs:31:1-27, of type: HasField "field1" x Char
    
    151 123
     │     is an evidence variable bound by a let, depending on: [$dHasField]
    
    152
    -│           with scope: LocalScope HasFieldQueries.hs:33:1-27
    
    153
    -│           bound at: HasFieldQueries.hs:33:1-27
    
    124
    +│           with scope: LocalScope HasFieldQueries.hs:31:1-27
    
    125
    +│           bound at: HasFieldQueries.hs:31:1-27
    
    154 126
     │     Defined at <no location info>
    
    155 127
     └
    
    156 128
     |
    
    157 129
     `- ┌
    
    158
    -   │ $dHasField at HasFieldQueries.hs:33:1-27, of type: HasField "field1" x Char
    
    130
    +   │ $dHasField at HasFieldQueries.hs:31:1-27, of type: HasField "field1" x Char
    
    159 131
        │     is an evidence variable bound by a HsWrapper
    
    160
    -   │           with scope: LocalScope HasFieldQueries.hs:33:1-27
    
    161
    -   │           bound at: HasFieldQueries.hs:33:1-27
    
    132
    +   │           with scope: LocalScope HasFieldQueries.hs:31:1-27
    
    133
    +   │           bound at: HasFieldQueries.hs:31:1-27
    
    162 134
        │     Defined at <no location info>
    
    163 135
        └
    
    164 136
     
    
    165 137
     ==========================
    
    166
    -At point (37,14), we found:
    
    138
    +At point (35,14), we found:
    
    167 139
     ==========================
    
    168 140
     ┌
    
    169 141
     │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
    
    ... ... @@ -175,70 +147,49 @@ At point (37,14), we found:
    175 147
     |
    
    176 148
     `- ┌
    
    177 149
        │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
    
    178
    -   │     is an evidence variable bound by a let, depending on: [C:HasField,
    
    179
    -   │                                                            field1]
    
    150
    +   │     is an evidence variable bound by a let, depending on: [field1 of record Thing]
    
    180 151
        │           with scope: ModuleScope
    
    181 152
        │           
    
    182 153
        │     Defined at <no location info>
    
    183 154
        └
    
    184 155
        |
    
    185
    -   +- ┌
    
    186
    -   |  │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    187
    -   |  │     is a usage of an external evidence variable
    
    188
    -   |  │     Defined in `GHC.Internal.Records'
    
    189
    -   |  └
    
    190
    -   |
    
    191 156
        `- ┌
    
    192 157
           │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
    
    193 158
           │     is a usage of an external evidence variable
    
    194
    -      │     Defined at HasFieldQueries.hs:9:21
    
    159
    +      │     Defined at HasFieldQueries.hs:7:21
    
    195 160
           └
    
    196 161
     
    
    197 162
     ==========================
    
    198
    -At point (41,21), we found:
    
    163
    +At point (39,21), we found:
    
    199 164
     ==========================
    
    200 165
     ┌
    
    201 166
     │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing
    
    202
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    203
    -│                                                            nested1]
    
    167
    +│     is an evidence variable bound by a let, depending on: [nested1 of record NestedThing]
    
    204 168
     │           with scope: ModuleScope
    
    205 169
     │           
    
    206 170
     │     Defined at <no location info>
    
    207 171
     └
    
    208 172
     |
    
    209
    -+- ┌
    
    210
    -|  │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    211
    -|  │     is a usage of an external evidence variable
    
    212
    -|  │     Defined in `GHC.Internal.Records'
    
    213
    -|  └
    
    214
    -|
    
    215 173
     `- ┌
    
    216 174
        │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing
    
    217 175
        │     is a usage of an external evidence variable
    
    218
    -   │     Defined at HasFieldQueries.hs:20:34
    
    176
    +   │     Defined at HasFieldQueries.hs:18:34
    
    219 177
        └
    
    220 178
     
    
    221 179
     ==========================
    
    222
    -At point (41,30), we found:
    
    180
    +At point (39,30), we found:
    
    223 181
     ==========================
    
    224 182
     ┌
    
    225 183
     │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
    
    226
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    227
    -│                                                            field1]
    
    184
    +│     is an evidence variable bound by a let, depending on: [field1 of record Thing]
    
    228 185
     │           with scope: ModuleScope
    
    229 186
     │           
    
    230 187
     │     Defined at <no location info>
    
    231 188
     └
    
    232 189
     |
    
    233
    -+- ┌
    
    234
    -|  │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    235
    -|  │     is a usage of an external evidence variable
    
    236
    -|  │     Defined in `GHC.Internal.Records'
    
    237
    -|  └
    
    238
    -|
    
    239 190
     `- ┌
    
    240 191
        │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
    
    241 192
        │     is a usage of an external evidence variable
    
    242
    -   │     Defined at HasFieldQueries.hs:9:21
    
    193
    +   │     Defined at HasFieldQueries.hs:7:21
    
    243 194
        └
    
    244 195
     

  • testsuite/tests/hiefile/should_run/HieTypeable.hs
    1
    +module Main where
    
    2
    +
    
    3
    +import Data.Typeable
    
    4
    +import TestUtils
    
    5
    +
    
    6
    +data Thing = Thing Char Bool
    
    7
    +
    
    8
    +repCon :: Thing -> TypeRep
    
    9
    +repCon t = typeOf t
    
    10
    +--         ^
    
    11
    +
    
    12
    +repApp :: Maybe Thing -> TypeRep
    
    13
    +repApp m = typeOf m
    
    14
    +--         ^
    
    15
    +
    
    16
    +repFun :: (Thing -> Bool) -> TypeRep
    
    17
    +repFun f = typeOf f
    
    18
    +--         ^
    
    19
    +
    
    20
    +repGiven :: Typeable a => a -> TypeRep
    
    21
    +repGiven x = typeOf (Just x)
    
    22
    +--           ^
    
    23
    +
    
    24
    +points :: [(Int, Int)]
    
    25
    +points =
    
    26
    +  [ (9,12)
    
    27
    +  , (13,12)
    
    28
    +  , (17,12)
    
    29
    +  , (21,14)
    
    30
    +  ]
    
    31
    +
    
    32
    +main :: IO ()
    
    33
    +main = do
    
    34
    +  (df, hf) <- readTestHie "HieTypeable.hie"
    
    35
    +  let refmap = generateReferencesMap $ getAsts $ hie_asts hf
    
    36
    +  mapM_ (explainEv df hf refmap) points

  • testsuite/tests/hiefile/should_run/HieTypeable.stdout
    1
    +==========================
    
    2
    +At point (9,12), we found:
    
    3
    +==========================
    
    4
    +┌
    
    5
    +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing
    
    6
    +│     is an evidence variable bound by a let, depending on: [$dTypeable]
    
    7
    +│           with scope: ModuleScope
    
    8
    +│           
    
    9
    +│     Defined at <no location info>
    
    10
    +└
    
    11
    +|
    
    12
    +`- ┌
    
    13
    +   │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing
    
    14
    +   │     is an evidence variable bound by a let, depending on: [Typeable Thing]
    
    15
    +   │           with scope: ModuleScope
    
    16
    +   │           
    
    17
    +   │     Defined at <no location info>
    
    18
    +   └
    
    19
    +
    
    20
    +==========================
    
    21
    +At point (13,12), we found:
    
    22
    +==========================
    
    23
    +┌
    
    24
    +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable (Maybe Thing)
    
    25
    +│     is an evidence variable bound by a let, depending on: [$dTypeable,
    
    26
    +│                                                            $dTypeable]
    
    27
    +│           with scope: ModuleScope
    
    28
    +│           
    
    29
    +│     Defined at <no location info>
    
    30
    +└
    
    31
    +|
    
    32
    ++- ┌
    
    33
    +|  │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Maybe
    
    34
    +|  │     is an evidence variable bound by a let, depending on: [Typeable Maybe]
    
    35
    +|  │           with scope: ModuleScope
    
    36
    +|  │           
    
    37
    +|  │     Defined at <no location info>
    
    38
    +|  └
    
    39
    +|
    
    40
    +`- ┌
    
    41
    +   │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing
    
    42
    +   │     is an evidence variable bound by a let, depending on: [Typeable Thing]
    
    43
    +   │           with scope: ModuleScope
    
    44
    +   │           
    
    45
    +   │     Defined at <no location info>
    
    46
    +   └
    
    47
    +
    
    48
    +==========================
    
    49
    +At point (17,12), we found:
    
    50
    +==========================
    
    51
    +┌
    
    52
    +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable (Thing -> Bool)
    
    53
    +│     is an evidence variable bound by a let, depending on: [$dTypeable,
    
    54
    +│                                                            $dTypeable, $dTypeable]
    
    55
    +│           with scope: ModuleScope
    
    56
    +│           
    
    57
    +│     Defined at <no location info>
    
    58
    +└
    
    59
    +|
    
    60
    ++- ┌
    
    61
    +|  │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable 'Many
    
    62
    +|  │     is an evidence variable bound by a let, depending on: [Typeable Many]
    
    63
    +|  │           with scope: ModuleScope
    
    64
    +|  │           
    
    65
    +|  │     Defined at <no location info>
    
    66
    +|  └
    
    67
    +|
    
    68
    ++- ┌
    
    69
    +|  │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing
    
    70
    +|  │     is an evidence variable bound by a let, depending on: [Typeable Thing]
    
    71
    +|  │           with scope: ModuleScope
    
    72
    +|  │           
    
    73
    +|  │     Defined at <no location info>
    
    74
    +|  └
    
    75
    +|
    
    76
    +`- ┌
    
    77
    +   │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Bool
    
    78
    +   │     is an evidence variable bound by a let, depending on: [Typeable Bool]
    
    79
    +   │           with scope: ModuleScope
    
    80
    +   │           
    
    81
    +   │     Defined at <no location info>
    
    82
    +   └
    
    83
    +
    
    84
    +==========================
    
    85
    +At point (21,14), we found:
    
    86
    +==========================
    
    87
    +┌
    
    88
    +│ $dTypeable at HieTypeable.hs:21:1-28, of type: Typeable (Maybe a)
    
    89
    +│     is an evidence variable bound by a let, depending on: [$dTypeable,
    
    90
    +│                                                            $dTypeable]
    
    91
    +│           with scope: LocalScope HieTypeable.hs:21:1-28
    
    92
    +│           bound at: HieTypeable.hs:21:1-28
    
    93
    +│     Defined at <no location info>
    
    94
    +└
    
    95
    +|
    
    96
    ++- ┌
    
    97
    +|  │ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Maybe
    
    98
    +|  │     is an evidence variable bound by a let, depending on: [Typeable Maybe]
    
    99
    +|  │           with scope: ModuleScope
    
    100
    +|  │           
    
    101
    +|  │     Defined at <no location info>
    
    102
    +|  └
    
    103
    +|
    
    104
    +`- ┌
    
    105
    +   │ $dTypeable at HieTypeable.hs:21:1-28, of type: Typeable a
    
    106
    +   │     is an evidence variable bound by a let, depending on: [$dTypeable]
    
    107
    +   │           with scope: LocalScope HieTypeable.hs:21:1-28
    
    108
    +   │           bound at: HieTypeable.hs:21:1-28
    
    109
    +   │     Defined at <no location info>
    
    110
    +   └
    
    111
    +   |
    
    112
    +   `- ┌
    
    113
    +      │ $dTypeable at HieTypeable.hs:21:1-28, of type: Typeable a
    
    114
    +      │     is an evidence variable bound by a HsWrapper
    
    115
    +      │           with scope: LocalScope HieTypeable.hs:21:1-28
    
    116
    +      │           bound at: HieTypeable.hs:21:1-28
    
    117
    +      │     Defined at <no location info>
    
    118
    +      └
    
    119
    +

  • testsuite/tests/hiefile/should_run/NoFieldSelectorQueries.hs
    ... ... @@ -37,13 +37,13 @@ multi1b = valD.c
    37 37
     --             ^
    
    38 38
     --             6
    
    39 39
     multi1c :: C -> Float
    
    40
    -multi1c someC = someC.c -- Where does this point to?
    
    40
    +multi1c someC = someC.c
    
    41 41
     --                    ^
    
    42 42
     --                    7
    
    43 43
     multi3 = valE.e
    
    44 44
     --            ^
    
    45 45
     --            8
    
    46
    -multi4 = valD.e -- This is a run-time error, but where does it point to?
    
    46
    +multi4 = valD.e
    
    47 47
     --            ^
    
    48 48
     --            9
    
    49 49
     
    

  • testsuite/tests/hiefile/should_run/NoFieldSelectorQueries.stdout
    ... ... @@ -3,19 +3,12 @@ At point (23,16), we found:
    3 3
     ==========================
    
    4 4
     ┌
    
    5 5
     │ $dHasField at NoFieldSelectorQueries.hs:1:1, of type: HasField "a" A Int
    
    6
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    7
    -│                                                            a]
    
    6
    +│     is an evidence variable bound by a let, depending on: [a of record A]
    
    8 7
     │           with scope: ModuleScope
    
    9 8
     │           
    
    10 9
     │     Defined at <no location info>
    
    11 10
     └
    
    12 11
     |
    
    13
    -+- ┌
    
    14
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    15
    -|  │     is a usage of an external evidence variable
    
    16
    -|  │     Defined in `GHC.Internal.Records'
    
    17
    -|  └
    
    18
    -|
    
    19 12
     `- ┌
    
    20 13
        │ a at NoFieldSelectorQueries.hs:1:1, of type: A -> Int
    
    21 14
        │     is a usage of an external evidence variable
    
    ... ... @@ -46,19 +39,12 @@ At point (30,15), we found:
    46 39
     ==========================
    
    47 40
     ┌
    
    48 41
     │ $dHasField at NoFieldSelectorQueries.hs:30:1-17, of type: HasField "n" B A
    
    49
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    50
    -│                                                            n]
    
    42
    +│     is an evidence variable bound by a let, depending on: [n of record B]
    
    51 43
     │           with scope: LocalScope NoFieldSelectorQueries.hs:30:1-17
    
    52 44
     │           bound at: NoFieldSelectorQueries.hs:30:1-17
    
    53 45
     │     Defined at <no location info>
    
    54 46
     └
    
    55 47
     |
    
    56
    -+- ┌
    
    57
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    58
    -|  │     is a usage of an external evidence variable
    
    59
    -|  │     Defined in `GHC.Internal.Records'
    
    60
    -|  └
    
    61
    -|
    
    62 48
     `- ┌
    
    63 49
        │ n at NoFieldSelectorQueries.hs:30:1-17, of type: B -> A
    
    64 50
        │     is a usage of an external evidence variable
    
    ... ... @@ -70,19 +56,12 @@ At point (30,17), we found:
    70 56
     ==========================
    
    71 57
     ┌
    
    72 58
     │ $dHasField at NoFieldSelectorQueries.hs:30:1-17, of type: HasField "b" A Char
    
    73
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    74
    -│                                                            b]
    
    59
    +│     is an evidence variable bound by a let, depending on: [b of record A]
    
    75 60
     │           with scope: LocalScope NoFieldSelectorQueries.hs:30:1-17
    
    76 61
     │           bound at: NoFieldSelectorQueries.hs:30:1-17
    
    77 62
     │     Defined at <no location info>
    
    78 63
     └
    
    79 64
     |
    
    80
    -+- ┌
    
    81
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    82
    -|  │     is a usage of an external evidence variable
    
    83
    -|  │     Defined in `GHC.Internal.Records'
    
    84
    -|  └
    
    85
    -|
    
    86 65
     `- ┌
    
    87 66
        │ b at NoFieldSelectorQueries.hs:30:1-17, of type: A -> Char
    
    88 67
        │     is a usage of an external evidence variable
    
    ... ... @@ -94,19 +73,12 @@ At point (33,16), we found:
    94 73
     ==========================
    
    95 74
     ┌
    
    96 75
     │ $dHasField at NoFieldSelectorQueries.hs:33:1-16, of type: HasField "c" C Float
    
    97
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    98
    -│                                                            c]
    
    76
    +│     is an evidence variable bound by a let, depending on: [c of record C]
    
    99 77
     │           with scope: LocalScope NoFieldSelectorQueries.hs:33:1-16
    
    100 78
     │           bound at: NoFieldSelectorQueries.hs:33:1-16
    
    101 79
     │     Defined at <no location info>
    
    102 80
     └
    
    103 81
     |
    
    104
    -+- ┌
    
    105
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    106
    -|  │     is a usage of an external evidence variable
    
    107
    -|  │     Defined in `GHC.Internal.Records'
    
    108
    -|  └
    
    109
    -|
    
    110 82
     `- ┌
    
    111 83
        │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float
    
    112 84
        │     is a usage of an external evidence variable
    
    ... ... @@ -118,19 +90,12 @@ At point (36,16), we found:
    118 90
     ==========================
    
    119 91
     ┌
    
    120 92
     │ $dHasField at NoFieldSelectorQueries.hs:36:1-16, of type: HasField "c" C Float
    
    121
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    122
    -│                                                            c]
    
    93
    +│     is an evidence variable bound by a let, depending on: [c of record C]
    
    123 94
     │           with scope: LocalScope NoFieldSelectorQueries.hs:36:1-16
    
    124 95
     │           bound at: NoFieldSelectorQueries.hs:36:1-16
    
    125 96
     │     Defined at <no location info>
    
    126 97
     └
    
    127 98
     |
    
    128
    -+- ┌
    
    129
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    130
    -|  │     is a usage of an external evidence variable
    
    131
    -|  │     Defined in `GHC.Internal.Records'
    
    132
    -|  └
    
    133
    -|
    
    134 99
     `- ┌
    
    135 100
        │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float
    
    136 101
        │     is a usage of an external evidence variable
    
    ... ... @@ -142,19 +107,12 @@ At point (40,23), we found:
    142 107
     ==========================
    
    143 108
     ┌
    
    144 109
     │ $dHasField at NoFieldSelectorQueries.hs:1:1, of type: HasField "c" C Float
    
    145
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    146
    -│                                                            c]
    
    110
    +│     is an evidence variable bound by a let, depending on: [c of record C]
    
    147 111
     │           with scope: ModuleScope
    
    148 112
     │           
    
    149 113
     │     Defined at <no location info>
    
    150 114
     └
    
    151 115
     |
    
    152
    -+- ┌
    
    153
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    154
    -|  │     is a usage of an external evidence variable
    
    155
    -|  │     Defined in `GHC.Internal.Records'
    
    156
    -|  └
    
    157
    -|
    
    158 116
     `- ┌
    
    159 117
        │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float
    
    160 118
        │     is a usage of an external evidence variable
    
    ... ... @@ -166,19 +124,12 @@ At point (43,15), we found:
    166 124
     ==========================
    
    167 125
     ┌
    
    168 126
     │ $dHasField at NoFieldSelectorQueries.hs:43:1-15, of type: HasField "e" C Int
    
    169
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    170
    -│                                                            e]
    
    127
    +│     is an evidence variable bound by a let, depending on: [e of record C]
    
    171 128
     │           with scope: LocalScope NoFieldSelectorQueries.hs:43:1-15
    
    172 129
     │           bound at: NoFieldSelectorQueries.hs:43:1-15
    
    173 130
     │     Defined at <no location info>
    
    174 131
     └
    
    175 132
     |
    
    176
    -+- ┌
    
    177
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    178
    -|  │     is a usage of an external evidence variable
    
    179
    -|  │     Defined in `GHC.Internal.Records'
    
    180
    -|  └
    
    181
    -|
    
    182 133
     `- ┌
    
    183 134
        │ e at NoFieldSelectorQueries.hs:43:1-15, of type: C -> Int
    
    184 135
        │     is a usage of an external evidence variable
    
    ... ... @@ -190,19 +141,12 @@ At point (46,15), we found:
    190 141
     ==========================
    
    191 142
     ┌
    
    192 143
     │ $dHasField at NoFieldSelectorQueries.hs:46:1-15, of type: HasField "e" C Int
    
    193
    -│     is an evidence variable bound by a let, depending on: [C:HasField,
    
    194
    -│                                                            e]
    
    144
    +│     is an evidence variable bound by a let, depending on: [e of record C]
    
    195 145
     │           with scope: LocalScope NoFieldSelectorQueries.hs:46:1-15
    
    196 146
     │           bound at: NoFieldSelectorQueries.hs:46:1-15
    
    197 147
     │     Defined at <no location info>
    
    198 148
     └
    
    199 149
     |
    
    200
    -+- ┌
    
    201
    -|  │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
    
    202
    -|  │     is a usage of an external evidence variable
    
    203
    -|  │     Defined in `GHC.Internal.Records'
    
    204
    -|  └
    
    205
    -|
    
    206 150
     `- ┌
    
    207 151
        │ e at NoFieldSelectorQueries.hs:43:1-15, of type: C -> Int
    
    208 152
        │     is a usage of an external evidence variable
    

  • testsuite/tests/hiefile/should_run/RecordDotTypes.stdout
    1 1
     At (22,6), got type: MyRecord
    
    2 2
     At (22,20), got type: MyRecord -> Integer
    
    3 3
     At (22,25), got type: MyRecord
    
    4
    -At (22,28), got type: MyChild -> [Char]
    
    5
    -At (22,29), got type: MyChild -> [Char]
    
    6
    -At (22,6) - (22,8), got type: [Char]
    
    4
    +At (22,28), got type: MyChild -> String
    
    5
    +At (22,29), got type: MyChild -> String
    
    6
    +At (22,6) - (22,8), got type: String
    
    7 7
     At (22,17) - (22,20), got type: Integer
    
    8 8
     At (22,25) - (22,27), got type: MyChild
    
    9
    -At (22,25) - (22,29), got type: [Char]
    9
    +At (22,25) - (22,29), got type: String

  • testsuite/tests/hiefile/should_run/all.T
    ... ... @@ -12,3 +12,5 @@ test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files([
    12 12
     test('T25709', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    13 13
     test('HasFieldQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    14 14
     test('NoFieldSelectorQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    15
    +test('HasCallStackIds', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    16
    +test('HieTypeable', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])