Hannes Siebenhandl pushed to branch wip/fendor/has-field-hie at Glasgow Haskell Compiler / GHC
Commits:
-
f8122cfe
by fendor at 2026-11-30T16:04:49+01:00
11 changed files:
- changelog.d/record-dot-evidence
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Ext/Types.hs
- + testsuite/tests/hiefile/should_run/EvidenceInternalIds.hs
- + testsuite/tests/hiefile/should_run/EvidenceInternalIds.stdout
- testsuite/tests/hiefile/should_run/HasFieldQueries.hs
- testsuite/tests/hiefile/should_run/HasFieldQueries.stdout
- testsuite/tests/hiefile/should_run/NoFieldSelectorQueries.hs
- testsuite/tests/hiefile/should_run/NoFieldSelectorQueries.stdout
- testsuite/tests/hiefile/should_run/RecordDotTypes.stdout
- testsuite/tests/hiefile/should_run/all.T
Changes:
| 1 | 1 | section: compiler
|
| 2 | -synopsis: Record selector functions as evidence for `HasField` constraints during .hie file generation.
|
|
| 2 | +synopsis: Record selector functions as evidence for ``HasField`` constraints during .hie file generation.
|
|
| 3 | 3 | description: {
|
| 4 | - We record the record selector `foo` of an expression such as `f.foo` as evidence for
|
|
| 5 | - solving the constraint `HasField "foo" record ty`.
|
|
| 4 | + We record the record selector ``foo`` of an expression such as ``f.foo`` as evidence for
|
|
| 5 | + solving the constraint ``HasField "foo" record ty``.
|
|
| 6 | 6 | |
| 7 | - This allows us to point to the definition source location of the record selector `foo`, allowing
|
|
| 7 | + This allows us to point to the definition source location of the record selector ``foo``, allowing
|
|
| 8 | 8 | users to jump to definition using the evidence variables.
|
| 9 | -}
|
|
| 10 | 9 | |
| 10 | + As the field selector ``.foo`` of ``f.foo`` now has its own node in the .hie file, the type
|
|
| 11 | + reported at ``.foo`` is now the type of the selector function, e.g. ``Foo -> Int``, instead of
|
|
| 12 | + the type of the whole expression ``f.foo``.
|
|
| 13 | +}
|
|
| 11 | 14 | issues: #25418
|
| 12 | 15 | mrs: !16694 |
| ... | ... | @@ -23,6 +23,7 @@ import GHC.Core.DataCon ( dataConWrapperType ) |
| 23 | 23 | import GHC.Core.Type ( Type, ForAllTyFlag(..) )
|
| 24 | 24 | import GHC.Core.TyCon ( TyCon, tyConClass_maybe )
|
| 25 | 25 | import GHC.Core.InstEnv
|
| 26 | +import GHC.Core.Predicate ( isEvId )
|
|
| 26 | 27 | |
| 27 | 28 | import GHC.Hs
|
| 28 | 29 | import GHC.Hs.Syn.Type
|
| ... | ... | @@ -32,13 +33,13 @@ import GHC.Types.Basic |
| 32 | 33 | import GHC.Types.UnresolvedImport ( isGeneratedImport )
|
| 33 | 34 | import GHC.Types.FieldLabel
|
| 34 | 35 | import GHC.Types.Avail ( Avails )
|
| 35 | -import GHC.Types.Id ( isDataConId_maybe, isId, idDetails )
|
|
| 36 | +import GHC.Types.Id ( isDataConId_maybe, isId, isLocalId, idDetails )
|
|
| 36 | 37 | import GHC.Types.Id.Info ( IdDetails(..), recSelParentName )
|
| 37 | 38 | import GHC.Types.Name ( Name, nameSrcSpan, nameUnique, wiredInNameTyThing_maybe, getName )
|
| 38 | 39 | import GHC.Types.Name.Env ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv )
|
| 39 | 40 | import GHC.Types.Name.Reader ( RecFieldInfo(..), WithUserRdr(..) )
|
| 40 | 41 | import GHC.Types.SrcLoc
|
| 41 | -import GHC.Types.Var ( Id, Var, EvId, varName, varType, varUnique )
|
|
| 42 | +import GHC.Types.Var ( Id, Var, varName, varType, varUnique )
|
|
| 42 | 43 | import GHC.Types.Var.Env
|
| 43 | 44 | import GHC.Types.Var.FV
|
| 44 | 45 | |
| ... | ... | @@ -681,30 +682,29 @@ instance ToHie (Context (Located Name)) where |
| 681 | 682 | instance ToHie (Context (Located (WithUserRdr Name))) where
|
| 682 | 683 | toHie (C c (L l (WithUserRdr _ n))) = toHie $ C c (L l n)
|
| 683 | 684 | |
| 684 | -hieEvIdsOfTerm :: EvTerm -> [EvId]
|
|
| 685 | --- Returns only EvIds satisfying relevantEvId
|
|
| 686 | -hieEvIdsOfTerm = runFVSelectiveList isId . evTermFVs
|
|
| 685 | +-- | Find the free variables of the evidence term.
|
|
| 686 | +--
|
|
| 687 | +-- These need to be processed by 'mkEvBindDep_maybe' to filter
|
|
| 688 | +-- evidence variables irrelevant to the user and add better
|
|
| 689 | +-- evidence locations.
|
|
| 690 | +hieIdsOfTerm :: EvTerm -> [Id]
|
|
| 691 | +hieIdsOfTerm = runFVSelectiveList isId . evTermFVs
|
|
| 687 | 692 | |
| 688 | 693 | instance ToHie (EvBindContext (LocatedA TcEvBinds)) where
|
| 689 | 694 | toHie (EvBindContext sc sp (L span (EvBinds bs)))
|
| 690 | 695 | = concatMapM go $ bagToList bs
|
| 691 | 696 | where
|
| 692 | 697 | go evbind = do
|
| 693 | - let evDeps = hieEvIdsOfTerm $ eb_rhs evbind
|
|
| 694 | - depNames = EvBindDeps $ map classifyEvBindDep evDeps
|
|
| 698 | + let evDeps = mapMaybe (\v -> (,) v <$> mkEvBindDep_maybe v)
|
|
| 699 | + $ hieIdsOfTerm $ eb_rhs evbind
|
|
| 700 | + depNames = EvBindDeps $ map snd evDeps
|
|
| 695 | 701 | concatM $
|
| 696 | 702 | [ toHie (C (EvidenceVarBind (EvLetBind depNames) (combineScopes sc (mkScope span)) sp)
|
| 697 | 703 | (L span $ eb_lhs evbind))
|
| 698 | - , toHie $ map (C EvidenceVarUse . L span) $ evDeps
|
|
| 704 | + , toHie $ map (C EvidenceVarUse . L span . fst) evDeps
|
|
| 699 | 705 | ]
|
| 700 | 706 | toHie _ = pure []
|
| 701 | 707 | |
| 702 | -classifyEvBindDep :: EvId -> EvBindDep
|
|
| 703 | -classifyEvBindDep evId =
|
|
| 704 | - case idDetails evId of
|
|
| 705 | - RecSelId{sel_tycon} -> RecordField (varName evId) (recSelParentName sel_tycon)
|
|
| 706 | - _ -> EvidenceVar (varName evId)
|
|
| 707 | - |
|
| 708 | 708 | instance ToHie (LocatedA HsWrapper) where
|
| 709 | 709 | toHie (L osp wrap)
|
| 710 | 710 | = case wrap of
|
| ... | ... | @@ -717,7 +717,7 @@ instance ToHie (LocatedA HsWrapper) where |
| 717 | 717 | toHie $ C (EvidenceVarBind EvWrapperBind (mkScope osp) (getRealSpanA osp))
|
| 718 | 718 | $ L osp a
|
| 719 | 719 | (WpEvApp a) ->
|
| 720 | - concatMapM (toHie . C EvidenceVarUse . L osp) $ hieEvIdsOfTerm a
|
|
| 720 | + concatMapM (toHie . C EvidenceVarUse . L osp) $ hieIdsOfTerm a
|
|
| 721 | 721 | _ -> pure []
|
| 722 | 722 | |
| 723 | 723 | instance HiePass p => HasType (LocatedA (HsBind (GhcPass p))) where
|
| ... | ... | @@ -621,12 +621,7 @@ instance Outputable EvVarSource where |
| 621 | 621 | -- | Evidence binding dependency with additional details.
|
| 622 | 622 | data EvBindDep
|
| 623 | 623 | = EvidenceVar Name
|
| 624 | - -- ^ Evidence variable such as a type class constructor.
|
|
| 625 | - --
|
|
| 626 | - -- For example, @C:HasField@, @$dShow@ (dictionaries) or @$fCList@.
|
|
| 627 | - --
|
|
| 628 | - -- This is the default representation of a 'EvBindDep'.
|
|
| 629 | - | RecordField
|
|
| 624 | + | EvidenceRecordField
|
|
| 630 | 625 | -- ^ Evidence variable of a record selector.
|
| 631 | 626 | --
|
| 632 | 627 | -- This is for example generated with @-XOverloadedRecordDot@, where
|
| ... | ... | @@ -636,17 +631,26 @@ data EvBindDep |
| 636 | 631 | -- ^ 'Name' of the record selector
|
| 637 | 632 | Name
|
| 638 | 633 | -- ^ 'Name' of the parent type.
|
| 639 | - deriving (Eq, Ord)
|
|
| 640 | 634 | |
| 641 | 635 | instance Outputable EvBindDep where
|
| 642 | 636 | ppr = \ case
|
| 643 | 637 | EvidenceVar n -> ppr n
|
| 644 | - RecordField sel parent -> ppr sel <+> text "of Record" <+> ppr parent
|
|
| 638 | + EvidenceRecordField sel parent -> ppr sel <+> text "of record" <+> ppr parent
|
|
| 639 | + |
|
| 640 | +mkEvBindDep_maybe :: Id -> Maybe EvBindDep
|
|
| 641 | +mkEvBindDep_maybe v = case idDetails v of
|
|
| 642 | + RecSelId{sel_tycon} -> Just $ EvidenceRecordField n (recSelParentName sel_tycon)
|
|
| 643 | + DFunId{} -> Just $ EvidenceVar n
|
|
| 644 | + ClassOpId{} | isEvId v -> Just $ EvidenceVar n
|
|
| 645 | + _ | isLocalId v, isEvId v -> Just $ EvidenceVar n
|
|
| 646 | + _ -> Nothing
|
|
| 647 | + where
|
|
| 648 | + n = varName v
|
|
| 645 | 649 | |
| 646 | 650 | evBindDepName :: EvBindDep -> Name
|
| 647 | 651 | evBindDepName = \ case
|
| 648 | 652 | EvidenceVar n -> n
|
| 649 | - RecordField selector _record -> selector
|
|
| 653 | + EvidenceRecordField selector _record -> selector
|
|
| 650 | 654 | |
| 651 | 655 | evBindDepHieName :: EvBindDep -> HieName
|
| 652 | 656 | evBindDepHieName = toHieName . evBindDepName
|
| ... | ... | @@ -656,15 +660,15 @@ instance Binary EvBindDep where |
| 656 | 660 | EvidenceVar n -> do
|
| 657 | 661 | putByte bh 0
|
| 658 | 662 | put_ bh n
|
| 659 | - RecordField n sel -> do
|
|
| 663 | + EvidenceRecordField sel parent -> do
|
|
| 660 | 664 | putByte bh 1
|
| 661 | - put_ bh n
|
|
| 662 | 665 | put_ bh sel
|
| 666 | + put_ bh parent
|
|
| 663 | 667 | |
| 664 | 668 | get bh =
|
| 665 | 669 | getByte bh >>= \ case
|
| 666 | 670 | 0 -> EvidenceVar <$> get bh
|
| 667 | - 1 -> RecordField <$> get bh <*> get bh
|
|
| 671 | + 1 -> EvidenceRecordField <$> get bh <*> get bh
|
|
| 668 | 672 | t -> fail $ "EvBindDep: Unknown tag: " ++ show t
|
| 669 | 673 | |
| 670 | 674 | -- | Eq/Ord instances compare on the converted HieName,
|
| 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 "EvidenceInternalIds.hie"
|
|
| 26 | + let refmap = generateReferencesMap $ getAsts $ hie_asts hf
|
|
| 27 | + mapM_ (explainEv df hf refmap) points |
| 1 | +==========================
|
|
| 2 | +At point (13,10), we found:
|
|
| 3 | +==========================
|
|
| 4 | +┌
|
|
| 5 | +│ $dIP at EvidenceInternalIds.hs:13:1-15, of type: HasCallStack
|
|
| 6 | +│ is an evidence variable bound by a let, depending on: [$dIP]
|
|
| 7 | +│ with scope: LocalScope EvidenceInternalIds.hs:13:1-15
|
|
| 8 | +│ bound at: EvidenceInternalIds.hs:13:1-15
|
|
| 9 | +│ Defined at <no location info>
|
|
| 10 | +└
|
|
| 11 | +|
|
|
| 12 | +`- ┌
|
|
| 13 | + │ $dIP at EvidenceInternalIds.hs:13:1-15, of type: HasCallStack
|
|
| 14 | + │ is an evidence variable bound by a let, depending on: [$dIP]
|
|
| 15 | + │ with scope: LocalScope EvidenceInternalIds.hs:13:1-15
|
|
| 16 | + │ bound at: EvidenceInternalIds.hs:13:1-15
|
|
| 17 | + │ Defined at <no location info>
|
|
| 18 | + └
|
|
| 19 | + |
|
|
| 20 | + `- ┌
|
|
| 21 | + │ $dIP at EvidenceInternalIds.hs:13:1-15, of type: HasCallStack
|
|
| 22 | + │ is an evidence variable bound by a HsWrapper
|
|
| 23 | + │ with scope: LocalScope EvidenceInternalIds.hs:13:1-15
|
|
| 24 | + │ bound at: EvidenceInternalIds.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 EvidenceInternalIds.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 | + |
| ... | ... | @@ -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
|
| 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 of Record Thing]
|
|
| 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 of Record Thing]
|
|
| 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 of Record NestedThing]
|
|
| 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 of Record Thing]
|
|
| 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 of Record Thing]
|
|
| 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 of Record NestedThing]
|
|
| 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 of Record Thing]
|
|
| 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 |
| ... | ... | @@ -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 |
| ... | ... | @@ -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 of Record 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 of Record B]
|
|
| 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 of Record A]
|
|
| 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 of Record 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 of Record 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 of Record 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 of Record C]
|
|
| 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 of Record C]
|
|
| 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
|
| 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 |
| ... | ... | @@ -12,3 +12,4 @@ 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('EvidenceInternalIds', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) |