Hannes Siebenhandl pushed to branch wip/fendor/has-field-hie at Glasgow Haskell Compiler / GHC
Commits:
-
ca321a62
by fendor at 2026-09-17T11:49:20+02:00
-
e99b2061
by fendor at 2026-09-17T11:49:32+02:00
-
edb461ac
by fendor at 2026-09-17T11:49:36+02:00
10 changed files:
- + changelog.d/record-dot-evidence
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Ext/Types.hs
- compiler/GHC/Iface/Ext/Utils.hs
- testsuite/tests/hiefile/should_run/HasFieldQueries.stdout
- + testsuite/tests/hiefile/should_run/HieTypeable.hs
- + testsuite/tests/hiefile/should_run/HieTypeable.stdout
- testsuite/tests/hiefile/should_run/NoFieldSelectorQueries.stdout
- testsuite/tests/hiefile/should_run/RecordDotTypes.stdout
- testsuite/tests/hiefile/should_run/all.T
Changes:
| 1 | +section: compiler
|
|
| 2 | +synopsis: Record selector functions as evidence for `HasField` constraints during .hie file generation.
|
|
| 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`.
|
|
| 6 | + |
|
| 7 | + This allows us to point to the definition source location of the record selector `foo`, allowing
|
|
| 8 | + users to jump to definition using the evidence variables.
|
|
| 9 | +}
|
|
| 10 | + |
|
| 11 | +issues: #25418
|
|
| 12 | +mrs: !16694 |
| ... | ... | @@ -23,7 +23,6 @@ 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 )
|
|
| 27 | 26 | |
| 28 | 27 | import GHC.Hs
|
| 29 | 28 | import GHC.Hs.Syn.Type
|
| ... | ... | @@ -33,7 +32,7 @@ import GHC.Types.Basic |
| 33 | 32 | import GHC.Types.UnresolvedImport ( isGeneratedImport )
|
| 34 | 33 | import GHC.Types.FieldLabel
|
| 35 | 34 | import GHC.Types.Avail ( Avails )
|
| 36 | -import GHC.Types.Id ( isDataConId_maybe )
|
|
| 35 | +import GHC.Types.Id ( isDataConId_maybe, isId, idDetails )
|
|
| 37 | 36 | import GHC.Types.Name ( Name, nameSrcSpan, nameUnique, wiredInNameTyThing_maybe, getName )
|
| 38 | 37 | import GHC.Types.Name.Env ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv )
|
| 39 | 38 | import GHC.Types.Name.Reader ( RecFieldInfo(..), WithUserRdr(..) )
|
| ... | ... | @@ -682,7 +681,7 @@ instance ToHie (Context (Located (WithUserRdr Name))) where |
| 682 | 681 | |
| 683 | 682 | hieEvIdsOfTerm :: EvTerm -> [EvId]
|
| 684 | 683 | -- Returns only EvIds satisfying relevantEvId
|
| 685 | -hieEvIdsOfTerm = runFVSelectiveList isEvId . evTermFVs
|
|
| 684 | +hieEvIdsOfTerm = runFVSelectiveList isId . evTermFVs
|
|
| 686 | 685 | |
| 687 | 686 | instance ToHie (EvBindContext (LocatedA TcEvBinds)) where
|
| 688 | 687 | toHie (EvBindContext sc sp (L span (EvBinds bs)))
|
| ... | ... | @@ -598,17 +598,79 @@ instance Outputable EvVarSource where |
| 598 | 598 | ppr (EvInstBind True cls) = text "bound due to a superclass of " <+> ppr cls
|
| 599 | 599 | ppr (EvLetBind deps) = text "bound by a let, depending on:" <+> ppr deps
|
| 600 | 600 | |
| 601 | +-- | Evidence binding dependency with additional details.
|
|
| 602 | +data EvBindDep
|
|
| 603 | + = EvidenceVar Name
|
|
| 604 | + -- ^ Evidence variable such as a type class constructor.
|
|
| 605 | + --
|
|
| 606 | + -- For example, @C:HasField@, @$dShow@ (dictionaries) or @$fCList@.
|
|
| 607 | + --
|
|
| 608 | + -- This is the default representation of a 'EvBindDep'.
|
|
| 609 | + | RecordField
|
|
| 610 | + -- ^ Evidence variable of a record selector.
|
|
| 611 | + --
|
|
| 612 | + -- This is for example generated with @-XOverloadedRecordDot@, where
|
|
| 613 | + -- the evidence includes a reference to which record selector is used
|
|
| 614 | + -- to implement @getField@.
|
|
| 615 | + Name
|
|
| 616 | + -- ^ 'Name' of the record selector
|
|
| 617 | + Name
|
|
| 618 | + -- ^ 'Name' of the parent type.
|
|
| 619 | + | TypeableEvidence
|
|
| 620 | + -- ^ Evidence of a @Typeable@ constraint.
|
|
| 621 | + Name
|
|
| 622 | + -- ^ Name of the type the evidence was generated for.
|
|
| 623 | + deriving (Eq, Ord)
|
|
| 624 | + |
|
| 625 | +instance Outputable EvBindDep where
|
|
| 626 | + ppr = \ case
|
|
| 627 | + EvidenceVar n -> ppr n
|
|
| 628 | + RecordField sel parent -> ppr sel <+> text "of Record" <+> ppr parent
|
|
| 629 | + TypeableEvidence n -> ppr n <+> text "bound by Typeable"
|
|
| 630 | + |
|
| 631 | +evBindDepName :: EvBindDep -> Name
|
|
| 632 | +evBindDepName = \ case
|
|
| 633 | + EvidenceVar n -> n
|
|
| 634 | + RecordField selector _record -> selector
|
|
| 635 | + TypeableEvidence n -> n
|
|
| 636 | + |
|
| 637 | +evBindDepHieName :: EvBindDep -> HieName
|
|
| 638 | +evBindDepHieName = toHieName . evBindDepName
|
|
| 639 | + |
|
| 640 | +instance Binary EvBindDep where
|
|
| 641 | + put_ bh = \ case
|
|
| 642 | + EvidenceVar n -> do
|
|
| 643 | + putByte bh 0
|
|
| 644 | + put_ bh n
|
|
| 645 | + RecordField n sel -> do
|
|
| 646 | + putByte bh 1
|
|
| 647 | + put_ bh n
|
|
| 648 | + put_ bh sel
|
|
| 649 | + TypeableEvidence n -> do
|
|
| 650 | + putByte bh 2
|
|
| 651 | + put_ bh n
|
|
| 652 | + |
|
| 653 | + get bh =
|
|
| 654 | + getByte bh >>= \ case
|
|
| 655 | + 0 -> EvidenceVar <$> get bh
|
|
| 656 | + 1 -> RecordField <$> get bh <*> get bh
|
|
| 657 | + 2 -> TypeableEvidence <$> get bh
|
|
| 658 | + t -> fail $ "EvBindDep: Unknown tag: " ++ show t
|
|
| 659 | + |
|
| 601 | 660 | -- | Eq/Ord instances compare on the converted HieName,
|
| 602 | 661 | -- as non-exported names may have different uniques after
|
| 603 | 662 | -- a roundtrip
|
| 604 | -newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [Name] }
|
|
| 663 | +newtype EvBindDeps = EvBindDeps { getEvBindDeps :: [EvBindDep] }
|
|
| 605 | 664 | deriving Outputable
|
| 606 | 665 | |
| 666 | +evBindDepsNames :: EvBindDeps -> [Name]
|
|
| 667 | +evBindDepsNames = map evBindDepName . getEvBindDeps
|
|
| 668 | + |
|
| 607 | 669 | instance Eq EvBindDeps where
|
| 608 | - (==) = coerce ((==) `on` map toHieName)
|
|
| 670 | + (==) = coerce ((==) `on` map evBindDepHieName)
|
|
| 609 | 671 | |
| 610 | 672 | instance Ord EvBindDeps where
|
| 611 | - compare = coerce (compare `on` map toHieName)
|
|
| 673 | + compare = coerce (compare `on` map evBindDepHieName)
|
|
| 612 | 674 | |
| 613 | 675 | instance Binary EvBindDeps where
|
| 614 | 676 | put_ bh (EvBindDeps xs) = put_ bh xs
|
| ... | ... | @@ -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
|
| ... | ... | @@ -3,16 +3,23 @@ At point (13,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]
|
|
| 6 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 7 | +│ field1 of Record Thing]
|
|
| 7 | 8 | │ with scope: ModuleScope
|
| 8 | 9 | │
|
| 9 | 10 | │ Defined at <no location info>
|
| 10 | 11 | └
|
| 11 | 12 | |
|
| 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 | +|
|
|
| 12 | 19 | `- ┌
|
| 13 | - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 20 | + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
|
|
| 14 | 21 | │ is a usage of an external evidence variable
|
| 15 | - │ Defined in `GHC.Internal.Records'
|
|
| 22 | + │ Defined at HasFieldQueries.hs:9:21
|
|
| 16 | 23 | └
|
| 17 | 24 | |
| 18 | 25 | ==========================
|
| ... | ... | @@ -23,16 +30,23 @@ At point (16,27), we found: |
| 23 | 30 | ==========================
|
| 24 | 31 | ┌
|
| 25 | 32 | │ $dHasField at HasFieldQueries.hs:16:1-32, of type: HasField "field1" Thing Char
|
| 26 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 33 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 34 | +│ field1 of Record Thing]
|
|
| 27 | 35 | │ with scope: LocalScope HasFieldQueries.hs:16:1-32
|
| 28 | 36 | │ bound at: HasFieldQueries.hs:16:1-32
|
| 29 | 37 | │ Defined at <no location info>
|
| 30 | 38 | └
|
| 31 | 39 | |
|
| 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 | +|
|
|
| 32 | 46 | `- ┌
|
| 33 | - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 47 | + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
|
|
| 34 | 48 | │ is a usage of an external evidence variable
|
| 35 | - │ Defined in `GHC.Internal.Records'
|
|
| 49 | + │ Defined at HasFieldQueries.hs:9:21
|
|
| 36 | 50 | └
|
| 37 | 51 | |
| 38 | 52 | ==========================
|
| ... | ... | @@ -40,16 +54,23 @@ At point (23,17), we found: |
| 40 | 54 | ==========================
|
| 41 | 55 | ┌
|
| 42 | 56 | │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing
|
| 43 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 57 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 58 | +│ nested1 of Record NestedThing]
|
|
| 44 | 59 | │ with scope: ModuleScope
|
| 45 | 60 | │
|
| 46 | 61 | │ Defined at <no location info>
|
| 47 | 62 | └
|
| 48 | 63 | |
|
| 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 | +|
|
|
| 49 | 70 | `- ┌
|
| 50 | - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 71 | + │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing
|
|
| 51 | 72 | │ is a usage of an external evidence variable
|
| 52 | - │ Defined in `GHC.Internal.Records'
|
|
| 73 | + │ Defined at HasFieldQueries.hs:20:34
|
|
| 53 | 74 | └
|
| 54 | 75 | |
| 55 | 76 | ==========================
|
| ... | ... | @@ -65,16 +86,23 @@ At point (23,25), we found: |
| 65 | 86 | |
|
| 66 | 87 | `- ┌
|
| 67 | 88 | │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
|
| 68 | - │ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 89 | + │ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 90 | + │ field1 of Record Thing]
|
|
| 69 | 91 | │ with scope: ModuleScope
|
| 70 | 92 | │
|
| 71 | 93 | │ Defined at <no location info>
|
| 72 | 94 | └
|
| 73 | 95 | |
|
| 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 | + |
|
|
| 74 | 102 | `- ┌
|
| 75 | - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 103 | + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
|
|
| 76 | 104 | │ is a usage of an external evidence variable
|
| 77 | - │ Defined in `GHC.Internal.Records'
|
|
| 105 | + │ Defined at HasFieldQueries.hs:9:21
|
|
| 78 | 106 | └
|
| 79 | 107 | |
| 80 | 108 | ==========================
|
| ... | ... | @@ -147,16 +175,23 @@ At point (37,14), we found: |
| 147 | 175 | |
|
| 148 | 176 | `- ┌
|
| 149 | 177 | │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
|
| 150 | - │ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 178 | + │ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 179 | + │ field1 of Record Thing]
|
|
| 151 | 180 | │ with scope: ModuleScope
|
| 152 | 181 | │
|
| 153 | 182 | │ Defined at <no location info>
|
| 154 | 183 | └
|
| 155 | 184 | |
|
| 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 | + |
|
|
| 156 | 191 | `- ┌
|
| 157 | - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 192 | + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
|
|
| 158 | 193 | │ is a usage of an external evidence variable
|
| 159 | - │ Defined in `GHC.Internal.Records'
|
|
| 194 | + │ Defined at HasFieldQueries.hs:9:21
|
|
| 160 | 195 | └
|
| 161 | 196 | |
| 162 | 197 | ==========================
|
| ... | ... | @@ -164,16 +199,23 @@ At point (41,21), we found: |
| 164 | 199 | ==========================
|
| 165 | 200 | ┌
|
| 166 | 201 | │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing
|
| 167 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 202 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 203 | +│ nested1 of Record NestedThing]
|
|
| 168 | 204 | │ with scope: ModuleScope
|
| 169 | 205 | │
|
| 170 | 206 | │ Defined at <no location info>
|
| 171 | 207 | └
|
| 172 | 208 | |
|
| 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 | +|
|
|
| 173 | 215 | `- ┌
|
| 174 | - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 216 | + │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing
|
|
| 175 | 217 | │ is a usage of an external evidence variable
|
| 176 | - │ Defined in `GHC.Internal.Records'
|
|
| 218 | + │ Defined at HasFieldQueries.hs:20:34
|
|
| 177 | 219 | └
|
| 178 | 220 | |
| 179 | 221 | ==========================
|
| ... | ... | @@ -181,15 +223,22 @@ At point (41,30), we found: |
| 181 | 223 | ==========================
|
| 182 | 224 | ┌
|
| 183 | 225 | │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char
|
| 184 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 226 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 227 | +│ field1 of Record Thing]
|
|
| 185 | 228 | │ with scope: ModuleScope
|
| 186 | 229 | │
|
| 187 | 230 | │ Defined at <no location info>
|
| 188 | 231 | └
|
| 189 | 232 | |
|
| 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 | +|
|
|
| 190 | 239 | `- ┌
|
| 191 | - │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 240 | + │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char
|
|
| 192 | 241 | │ is a usage of an external evidence variable
|
| 193 | - │ Defined in `GHC.Internal.Records'
|
|
| 242 | + │ Defined at HasFieldQueries.hs:9:21
|
|
| 194 | 243 | └
|
| 195 | 244 |
| 1 | +module Main where
|
|
| 2 | + |
|
| 3 | +import Data.Dynamic
|
|
| 4 | +import Data.Typeable
|
|
| 5 | +import TestUtils
|
|
| 6 | + |
|
| 7 | +data Thing = Thing {field1 :: Char, field2 :: Bool}
|
|
| 8 | + deriving (Show, Eq)
|
|
| 9 | + |
|
| 10 | +castFromDynamic :: Dynamic -> Maybe Thing
|
|
| 11 | +castFromDynamic d = fromDynamic d
|
|
| 12 | + -- ^ this is the point
|
|
| 13 | + |
|
| 14 | +rep :: Thing -> TypeRep
|
|
| 15 | +rep d = typeOf d
|
|
| 16 | + -- ^ this is the point
|
|
| 17 | + |
|
| 18 | +points =
|
|
| 19 | + [ (11,21)
|
|
| 20 | + , (15,10)
|
|
| 21 | + ]
|
|
| 22 | + |
|
| 23 | +main = do
|
|
| 24 | + (df, hf) <- readTestHie "HieTypeable.hie"
|
|
| 25 | + let refmap = generateReferencesMap $ getAsts $ hie_asts hf
|
|
| 26 | + |
|
| 27 | + traverse (explainEv df hf refmap) points
|
|
| 28 | + return () |
| 1 | +==========================
|
|
| 2 | +At point (11,21), 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: []
|
|
| 15 | + │ with scope: ModuleScope
|
|
| 16 | + │
|
|
| 17 | + │ Defined at <no location info>
|
|
| 18 | + └
|
|
| 19 | + |
|
| 20 | +==========================
|
|
| 21 | +At point (15,10), we found:
|
|
| 22 | +==========================
|
|
| 23 | +┌
|
|
| 24 | +│ $dTypeable at HieTypeable.hs:1:1, of type: Typeable Thing
|
|
| 25 | +│ is an evidence variable bound by a let, depending on: []
|
|
| 26 | +│ with scope: ModuleScope
|
|
| 27 | +│
|
|
| 28 | +│ Defined at <no location info>
|
|
| 29 | +└
|
|
| 30 | + |
| ... | ... | @@ -3,16 +3,23 @@ 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]
|
|
| 6 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 7 | +│ a of Record A]
|
|
| 7 | 8 | │ with scope: ModuleScope
|
| 8 | 9 | │
|
| 9 | 10 | │ Defined at <no location info>
|
| 10 | 11 | └
|
| 11 | 12 | |
|
| 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 | +|
|
|
| 12 | 19 | `- ┌
|
| 13 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 20 | + │ a at NoFieldSelectorQueries.hs:1:1, of type: A -> Int
|
|
| 14 | 21 | │ is a usage of an external evidence variable
|
| 15 | - │ Defined in `GHC.Internal.Records'
|
|
| 22 | + │ Defined at NoFieldSelectorQueries.hs:9:14
|
|
| 16 | 23 | └
|
| 17 | 24 | |
| 18 | 25 | ==========================
|
| ... | ... | @@ -39,16 +46,23 @@ At point (30,15), we found: |
| 39 | 46 | ==========================
|
| 40 | 47 | ┌
|
| 41 | 48 | │ $dHasField at NoFieldSelectorQueries.hs:30:1-17, of type: HasField "n" B A
|
| 42 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 49 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 50 | +│ n of Record B]
|
|
| 43 | 51 | │ with scope: LocalScope NoFieldSelectorQueries.hs:30:1-17
|
| 44 | 52 | │ bound at: NoFieldSelectorQueries.hs:30:1-17
|
| 45 | 53 | │ Defined at <no location info>
|
| 46 | 54 | └
|
| 47 | 55 | |
|
| 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 | +|
|
|
| 48 | 62 | `- ┌
|
| 49 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 63 | + │ n at NoFieldSelectorQueries.hs:30:1-17, of type: B -> A
|
|
| 50 | 64 | │ is a usage of an external evidence variable
|
| 51 | - │ Defined in `GHC.Internal.Records'
|
|
| 65 | + │ Defined at NoFieldSelectorQueries.hs:10:24
|
|
| 52 | 66 | └
|
| 53 | 67 | |
| 54 | 68 | ==========================
|
| ... | ... | @@ -56,16 +70,23 @@ At point (30,17), we found: |
| 56 | 70 | ==========================
|
| 57 | 71 | ┌
|
| 58 | 72 | │ $dHasField at NoFieldSelectorQueries.hs:30:1-17, of type: HasField "b" A Char
|
| 59 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 73 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 74 | +│ b of Record A]
|
|
| 60 | 75 | │ with scope: LocalScope NoFieldSelectorQueries.hs:30:1-17
|
| 61 | 76 | │ bound at: NoFieldSelectorQueries.hs:30:1-17
|
| 62 | 77 | │ Defined at <no location info>
|
| 63 | 78 | └
|
| 64 | 79 | |
|
| 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 | +|
|
|
| 65 | 86 | `- ┌
|
| 66 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 87 | + │ b at NoFieldSelectorQueries.hs:30:1-17, of type: A -> Char
|
|
| 67 | 88 | │ is a usage of an external evidence variable
|
| 68 | - │ Defined in `GHC.Internal.Records'
|
|
| 89 | + │ Defined at NoFieldSelectorQueries.hs:9:24
|
|
| 69 | 90 | └
|
| 70 | 91 | |
| 71 | 92 | ==========================
|
| ... | ... | @@ -73,16 +94,23 @@ At point (33,16), we found: |
| 73 | 94 | ==========================
|
| 74 | 95 | ┌
|
| 75 | 96 | │ $dHasField at NoFieldSelectorQueries.hs:33:1-16, of type: HasField "c" C Float
|
| 76 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 97 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 98 | +│ c of Record C]
|
|
| 77 | 99 | │ with scope: LocalScope NoFieldSelectorQueries.hs:33:1-16
|
| 78 | 100 | │ bound at: NoFieldSelectorQueries.hs:33:1-16
|
| 79 | 101 | │ Defined at <no location info>
|
| 80 | 102 | └
|
| 81 | 103 | |
|
| 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 | +|
|
|
| 82 | 110 | `- ┌
|
| 83 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 111 | + │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float
|
|
| 84 | 112 | │ is a usage of an external evidence variable
|
| 85 | - │ Defined in `GHC.Internal.Records'
|
|
| 113 | + │ Defined at NoFieldSelectorQueries.hs:12:9
|
|
| 86 | 114 | └
|
| 87 | 115 | |
| 88 | 116 | ==========================
|
| ... | ... | @@ -90,16 +118,23 @@ At point (36,16), we found: |
| 90 | 118 | ==========================
|
| 91 | 119 | ┌
|
| 92 | 120 | │ $dHasField at NoFieldSelectorQueries.hs:36:1-16, of type: HasField "c" C Float
|
| 93 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 121 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 122 | +│ c of Record C]
|
|
| 94 | 123 | │ with scope: LocalScope NoFieldSelectorQueries.hs:36:1-16
|
| 95 | 124 | │ bound at: NoFieldSelectorQueries.hs:36:1-16
|
| 96 | 125 | │ Defined at <no location info>
|
| 97 | 126 | └
|
| 98 | 127 | |
|
| 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 | +|
|
|
| 99 | 134 | `- ┌
|
| 100 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 135 | + │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float
|
|
| 101 | 136 | │ is a usage of an external evidence variable
|
| 102 | - │ Defined in `GHC.Internal.Records'
|
|
| 137 | + │ Defined at NoFieldSelectorQueries.hs:12:9
|
|
| 103 | 138 | └
|
| 104 | 139 | |
| 105 | 140 | ==========================
|
| ... | ... | @@ -107,16 +142,23 @@ At point (40,23), we found: |
| 107 | 142 | ==========================
|
| 108 | 143 | ┌
|
| 109 | 144 | │ $dHasField at NoFieldSelectorQueries.hs:1:1, of type: HasField "c" C Float
|
| 110 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 145 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 146 | +│ c of Record C]
|
|
| 111 | 147 | │ with scope: ModuleScope
|
| 112 | 148 | │
|
| 113 | 149 | │ Defined at <no location info>
|
| 114 | 150 | └
|
| 115 | 151 | |
|
| 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 | +|
|
|
| 116 | 158 | `- ┌
|
| 117 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 159 | + │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float
|
|
| 118 | 160 | │ is a usage of an external evidence variable
|
| 119 | - │ Defined in `GHC.Internal.Records'
|
|
| 161 | + │ Defined at NoFieldSelectorQueries.hs:12:9
|
|
| 120 | 162 | └
|
| 121 | 163 | |
| 122 | 164 | ==========================
|
| ... | ... | @@ -124,16 +166,23 @@ At point (43,15), we found: |
| 124 | 166 | ==========================
|
| 125 | 167 | ┌
|
| 126 | 168 | │ $dHasField at NoFieldSelectorQueries.hs:43:1-15, of type: HasField "e" C Int
|
| 127 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 169 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 170 | +│ e of Record C]
|
|
| 128 | 171 | │ with scope: LocalScope NoFieldSelectorQueries.hs:43:1-15
|
| 129 | 172 | │ bound at: NoFieldSelectorQueries.hs:43:1-15
|
| 130 | 173 | │ Defined at <no location info>
|
| 131 | 174 | └
|
| 132 | 175 | |
|
| 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 | +|
|
|
| 133 | 182 | `- ┌
|
| 134 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 183 | + │ e at NoFieldSelectorQueries.hs:43:1-15, of type: C -> Int
|
|
| 135 | 184 | │ is a usage of an external evidence variable
|
| 136 | - │ Defined in `GHC.Internal.Records'
|
|
| 185 | + │ Defined at NoFieldSelectorQueries.hs:14:9
|
|
| 137 | 186 | └
|
| 138 | 187 | |
| 139 | 188 | ==========================
|
| ... | ... | @@ -141,15 +190,22 @@ At point (46,15), we found: |
| 141 | 190 | ==========================
|
| 142 | 191 | ┌
|
| 143 | 192 | │ $dHasField at NoFieldSelectorQueries.hs:46:1-15, of type: HasField "e" C Int
|
| 144 | -│ is an evidence variable bound by a let, depending on: [C:HasField]
|
|
| 193 | +│ is an evidence variable bound by a let, depending on: [C:HasField,
|
|
| 194 | +│ e of Record C]
|
|
| 145 | 195 | │ with scope: LocalScope NoFieldSelectorQueries.hs:46:1-15
|
| 146 | 196 | │ bound at: NoFieldSelectorQueries.hs:46:1-15
|
| 147 | 197 | │ Defined at <no location info>
|
| 148 | 198 | └
|
| 149 | 199 | |
|
| 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 | +|
|
|
| 150 | 206 | `- ┌
|
| 151 | - │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a
|
|
| 207 | + │ e at NoFieldSelectorQueries.hs:43:1-15, of type: C -> Int
|
|
| 152 | 208 | │ is a usage of an external evidence variable
|
| 153 | - │ Defined in `GHC.Internal.Records'
|
|
| 209 | + │ Defined at NoFieldSelectorQueries.hs:14:9
|
|
| 154 | 210 | └
|
| 155 | 211 |
| 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 -> String
|
|
| 5 | -At (22,29), got type: MyChild -> String
|
|
| 6 | -At (22,6) - (22,8), got type: String
|
|
| 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]
|
|
| 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: String |
|
| 9 | +At (22,25) - (22,29), got type: [Char] |
| ... | ... | @@ -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('HieTypeable', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) |