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 WIP - - - - - 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: ===================================== changelog.d/record-dot-evidence ===================================== @@ -1,12 +1,15 @@ section: compiler -synopsis: Record selector functions as evidence for `HasField` constraints during .hie file generation. +synopsis: Record selector functions as evidence for ``HasField`` constraints during .hie file generation. description: { - We record the record selector `foo` of an expression such as `f.foo` as evidence for - solving the constraint `HasField "foo" record ty`. + We record the record selector ``foo`` of an expression such as ``f.foo`` as evidence for + solving the constraint ``HasField "foo" record ty``. - This allows us to point to the definition source location of the record selector `foo`, allowing + This allows us to point to the definition source location of the record selector ``foo``, allowing users to jump to definition using the evidence variables. -} + As the field selector ``.foo`` of ``f.foo`` now has its own node in the .hie file, the type + reported at ``.foo`` is now the type of the selector function, e.g. ``Foo -> Int``, instead of + the type of the whole expression ``f.foo``. +} issues: #25418 mrs: !16694 ===================================== compiler/GHC/Iface/Ext/Ast.hs ===================================== @@ -23,6 +23,7 @@ import GHC.Core.DataCon ( dataConWrapperType ) import GHC.Core.Type ( Type, ForAllTyFlag(..) ) import GHC.Core.TyCon ( TyCon, tyConClass_maybe ) import GHC.Core.InstEnv +import GHC.Core.Predicate ( isEvId ) import GHC.Hs import GHC.Hs.Syn.Type @@ -32,13 +33,13 @@ import GHC.Types.Basic import GHC.Types.UnresolvedImport ( isGeneratedImport ) import GHC.Types.FieldLabel import GHC.Types.Avail ( Avails ) -import GHC.Types.Id ( isDataConId_maybe, isId, idDetails ) +import GHC.Types.Id ( isDataConId_maybe, isId, isLocalId, idDetails ) import GHC.Types.Id.Info ( IdDetails(..), recSelParentName ) import GHC.Types.Name ( Name, nameSrcSpan, nameUnique, wiredInNameTyThing_maybe, getName ) import GHC.Types.Name.Env ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv ) import GHC.Types.Name.Reader ( RecFieldInfo(..), WithUserRdr(..) ) import GHC.Types.SrcLoc -import GHC.Types.Var ( Id, Var, EvId, varName, varType, varUnique ) +import GHC.Types.Var ( Id, Var, varName, varType, varUnique ) import GHC.Types.Var.Env import GHC.Types.Var.FV @@ -681,30 +682,29 @@ instance ToHie (Context (Located Name)) where instance ToHie (Context (Located (WithUserRdr Name))) where toHie (C c (L l (WithUserRdr _ n))) = toHie $ C c (L l n) -hieEvIdsOfTerm :: EvTerm -> [EvId] --- Returns only EvIds satisfying relevantEvId -hieEvIdsOfTerm = runFVSelectiveList isId . evTermFVs +-- | Find the free variables of the evidence term. +-- +-- These need to be processed by 'mkEvBindDep_maybe' to filter +-- evidence variables irrelevant to the user and add better +-- evidence locations. +hieIdsOfTerm :: EvTerm -> [Id] +hieIdsOfTerm = runFVSelectiveList isId . evTermFVs instance ToHie (EvBindContext (LocatedA TcEvBinds)) where toHie (EvBindContext sc sp (L span (EvBinds bs))) = concatMapM go $ bagToList bs where go evbind = do - let evDeps = hieEvIdsOfTerm $ eb_rhs evbind - depNames = EvBindDeps $ map classifyEvBindDep evDeps + let evDeps = mapMaybe (\v -> (,) v <$> mkEvBindDep_maybe v) + $ hieIdsOfTerm $ eb_rhs evbind + depNames = EvBindDeps $ map snd evDeps concatM $ [ toHie (C (EvidenceVarBind (EvLetBind depNames) (combineScopes sc (mkScope span)) sp) (L span $ eb_lhs evbind)) - , toHie $ map (C EvidenceVarUse . L span) $ evDeps + , toHie $ map (C EvidenceVarUse . L span . fst) evDeps ] toHie _ = pure [] -classifyEvBindDep :: EvId -> EvBindDep -classifyEvBindDep evId = - case idDetails evId of - RecSelId{sel_tycon} -> RecordField (varName evId) (recSelParentName sel_tycon) - _ -> EvidenceVar (varName evId) - instance ToHie (LocatedA HsWrapper) where toHie (L osp wrap) = case wrap of @@ -717,7 +717,7 @@ instance ToHie (LocatedA HsWrapper) where toHie $ C (EvidenceVarBind EvWrapperBind (mkScope osp) (getRealSpanA osp)) $ L osp a (WpEvApp a) -> - concatMapM (toHie . C EvidenceVarUse . L osp) $ hieEvIdsOfTerm a + concatMapM (toHie . C EvidenceVarUse . L osp) $ hieIdsOfTerm a _ -> pure [] instance HiePass p => HasType (LocatedA (HsBind (GhcPass p))) where ===================================== compiler/GHC/Iface/Ext/Types.hs ===================================== @@ -621,12 +621,7 @@ instance Outputable EvVarSource where -- | Evidence binding dependency with additional details. data EvBindDep = EvidenceVar Name - -- ^ Evidence variable such as a type class constructor. - -- - -- For example, @C:HasField@, @$dShow@ (dictionaries) or @$fCList@. - -- - -- This is the default representation of a 'EvBindDep'. - | RecordField + | EvidenceRecordField -- ^ Evidence variable of a record selector. -- -- This is for example generated with @-XOverloadedRecordDot@, where @@ -636,17 +631,26 @@ data EvBindDep -- ^ 'Name' of the record selector Name -- ^ 'Name' of the parent type. - deriving (Eq, Ord) instance Outputable EvBindDep where ppr = \ case EvidenceVar n -> ppr n - RecordField sel parent -> ppr sel <+> text "of Record" <+> ppr parent + EvidenceRecordField sel parent -> ppr sel <+> text "of record" <+> ppr parent + +mkEvBindDep_maybe :: Id -> Maybe EvBindDep +mkEvBindDep_maybe v = case idDetails v of + RecSelId{sel_tycon} -> Just $ EvidenceRecordField n (recSelParentName sel_tycon) + DFunId{} -> Just $ EvidenceVar n + ClassOpId{} | isEvId v -> Just $ EvidenceVar n + _ | isLocalId v, isEvId v -> Just $ EvidenceVar n + _ -> Nothing + where + n = varName v evBindDepName :: EvBindDep -> Name evBindDepName = \ case EvidenceVar n -> n - RecordField selector _record -> selector + EvidenceRecordField selector _record -> selector evBindDepHieName :: EvBindDep -> HieName evBindDepHieName = toHieName . evBindDepName @@ -656,15 +660,15 @@ instance Binary EvBindDep where EvidenceVar n -> do putByte bh 0 put_ bh n - RecordField n sel -> do + EvidenceRecordField sel parent -> do putByte bh 1 - put_ bh n put_ bh sel + put_ bh parent get bh = getByte bh >>= \ case 0 -> EvidenceVar <$> get bh - 1 -> RecordField <$> get bh <*> get bh + 1 -> EvidenceRecordField <$> get bh <*> get bh t -> fail $ "EvBindDep: Unknown tag: " ++ show t -- | Eq/Ord instances compare on the converted HieName, ===================================== testsuite/tests/hiefile/should_run/EvidenceInternalIds.hs ===================================== @@ -0,0 +1,27 @@ +{-# LANGUAGE DataKinds #-} +module Main where + +import TestUtils +import GHC.Stack +import GHC.TypeLits +import Data.Proxy + +callee :: HasCallStack => Int +callee = length (prettyCallStack callStack) + +caller :: HasCallStack => Int +caller = callee +-- ^ + +sym :: String +sym = symbolVal (Proxy :: Proxy "hello") +-- ^ + +points :: [(Int, Int)] +points = [(13,10), (17,7)] + +main :: IO () +main = do + (df, hf) <- readTestHie "EvidenceInternalIds.hie" + let refmap = generateReferencesMap $ getAsts $ hie_asts hf + mapM_ (explainEv df hf refmap) points ===================================== testsuite/tests/hiefile/should_run/EvidenceInternalIds.stdout ===================================== @@ -0,0 +1,38 @@ +========================== +At point (13,10), we found: +========================== +┌ +│ $dIP at EvidenceInternalIds.hs:13:1-15, of type: HasCallStack +│ is an evidence variable bound by a let, depending on: [$dIP] +│ with scope: LocalScope EvidenceInternalIds.hs:13:1-15 +│ bound at: EvidenceInternalIds.hs:13:1-15 +│ Defined at <no location info> +└ +| +`- ┌ + │ $dIP at EvidenceInternalIds.hs:13:1-15, of type: HasCallStack + │ is an evidence variable bound by a let, depending on: [$dIP] + │ with scope: LocalScope EvidenceInternalIds.hs:13:1-15 + │ bound at: EvidenceInternalIds.hs:13:1-15 + │ Defined at <no location info> + └ + | + `- ┌ + │ $dIP at EvidenceInternalIds.hs:13:1-15, of type: HasCallStack + │ is an evidence variable bound by a HsWrapper + │ with scope: LocalScope EvidenceInternalIds.hs:13:1-15 + │ bound at: EvidenceInternalIds.hs:13:1-15 + │ Defined at <no location info> + └ + +========================== +At point (17,7), we found: +========================== +┌ +│ $dKnownSymbol at EvidenceInternalIds.hs:1:1, of type: KnownSymbol "hello" +│ is an evidence variable bound by a let, depending on: [] +│ with scope: ModuleScope +│ +│ Defined at <no location info> +└ + ===================================== testsuite/tests/hiefile/should_run/HasFieldQueries.hs ===================================== @@ -3,8 +3,6 @@ module Main where import TestUtils import GHC.Records -import GHC.TypeLits -import Data.Tree data Thing = Thing {field1 :: Char, field2 :: Bool} deriving (Show, Eq) @@ -44,17 +42,17 @@ prefixNested x = (.nested1.field1) x points = - [ (13,17) - , (16,25) - , (16,27) - , (23,17) - , (23,25) - , (27,20) - , (27,28) - , (33,22) - , (37,14) - , (41,21) - , (41,30) + [ (11,17) + , (14,25) + , (14,27) + , (21,17) + , (21,25) + , (25,20) + , (25,28) + , (31,22) + , (35,14) + , (39,21) + , (39,30) ] main = do ===================================== testsuite/tests/hiefile/should_run/HasFieldQueries.stdout ===================================== @@ -1,80 +1,59 @@ ========================== -At point (13,17), we found: +At point (11,17), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ field1 of Record Thing] +│ is an evidence variable bound by a let, depending on: [field1 of record Thing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined at HasFieldQueries.hs:9:21 + │ Defined at HasFieldQueries.hs:7:21 └ ========================== -At point (16,25), we found: +At point (14,25), we found: ========================== ========================== -At point (16,27), we found: +At point (14,27), we found: ========================== ┌ -│ $dHasField at HasFieldQueries.hs:16:1-32, of type: HasField "field1" Thing Char -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ field1 of Record Thing] -│ with scope: LocalScope HasFieldQueries.hs:16:1-32 -│ bound at: HasFieldQueries.hs:16:1-32 +│ $dHasField at HasFieldQueries.hs:14:1-32, of type: HasField "field1" Thing Char +│ is an evidence variable bound by a let, depending on: [field1 of record Thing] +│ with scope: LocalScope HasFieldQueries.hs:14:1-32 +│ bound at: HasFieldQueries.hs:14:1-32 │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined at HasFieldQueries.hs:9:21 + │ Defined at HasFieldQueries.hs:7:21 └ ========================== -At point (23,17), we found: +At point (21,17), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ nested1 of Record NestedThing] +│ is an evidence variable bound by a let, depending on: [nested1 of record NestedThing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing │ is a usage of an external evidence variable - │ Defined at HasFieldQueries.hs:20:34 + │ Defined at HasFieldQueries.hs:18:34 └ ========================== -At point (23,25), we found: +At point (21,25), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char @@ -86,84 +65,77 @@ At point (23,25), we found: | `- ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char - │ is an evidence variable bound by a let, depending on: [C:HasField, - │ field1 of Record Thing] + │ is an evidence variable bound by a let, depending on: [field1 of record Thing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | - +- ┌ - | │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a - | │ is a usage of an external evidence variable - | │ Defined in `GHC.Internal.Records' - | └ - | `- ┌ │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined at HasFieldQueries.hs:9:21 + │ Defined at HasFieldQueries.hs:7:21 └ ========================== -At point (27,20), we found: +At point (25,20), we found: ========================== ┌ -│ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "nested1" r r +│ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "nested1" r r │ is an evidence variable bound by a let, depending on: [$dHasField] -│ with scope: LocalScope HasFieldQueries.hs:27:1-40 -│ bound at: HasFieldQueries.hs:27:1-40 +│ with scope: LocalScope HasFieldQueries.hs:25:1-40 +│ bound at: HasFieldQueries.hs:25:1-40 │ Defined at <no location info> └ | `- ┌ - │ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "nested1" r r + │ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "nested1" r r │ is an evidence variable bound by a type signature - │ with scope: LocalScope HasFieldQueries.hs:27:1-40 - │ bound at: HasFieldQueries.hs:27:1-40 + │ with scope: LocalScope HasFieldQueries.hs:25:1-40 + │ bound at: HasFieldQueries.hs:25:1-40 │ Defined at <no location info> └ ========================== -At point (27,28), we found: +At point (25,28), we found: ========================== ┌ -│ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "field2" r Bool +│ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "field2" r Bool │ is an evidence variable bound by a let, depending on: [$dHasField] -│ with scope: LocalScope HasFieldQueries.hs:27:1-40 -│ bound at: HasFieldQueries.hs:27:1-40 +│ with scope: LocalScope HasFieldQueries.hs:25:1-40 +│ bound at: HasFieldQueries.hs:25:1-40 │ Defined at <no location info> └ | `- ┌ - │ $dHasField at HasFieldQueries.hs:27:1-40, of type: HasField "field2" r Bool + │ $dHasField at HasFieldQueries.hs:25:1-40, of type: HasField "field2" r Bool │ is an evidence variable bound by a type signature - │ with scope: LocalScope HasFieldQueries.hs:27:1-40 - │ bound at: HasFieldQueries.hs:27:1-40 + │ with scope: LocalScope HasFieldQueries.hs:25:1-40 + │ bound at: HasFieldQueries.hs:25:1-40 │ Defined at <no location info> └ ========================== -At point (33,22), we found: +At point (31,22), we found: ========================== ┌ -│ $dHasField at HasFieldQueries.hs:33:1-27, of type: HasField "field1" x Char +│ $dHasField at HasFieldQueries.hs:31:1-27, of type: HasField "field1" x Char │ is an evidence variable bound by a let, depending on: [$dHasField] -│ with scope: LocalScope HasFieldQueries.hs:33:1-27 -│ bound at: HasFieldQueries.hs:33:1-27 +│ with scope: LocalScope HasFieldQueries.hs:31:1-27 +│ bound at: HasFieldQueries.hs:31:1-27 │ Defined at <no location info> └ | `- ┌ - │ $dHasField at HasFieldQueries.hs:33:1-27, of type: HasField "field1" x Char + │ $dHasField at HasFieldQueries.hs:31:1-27, of type: HasField "field1" x Char │ is an evidence variable bound by a HsWrapper - │ with scope: LocalScope HasFieldQueries.hs:33:1-27 - │ bound at: HasFieldQueries.hs:33:1-27 + │ with scope: LocalScope HasFieldQueries.hs:31:1-27 + │ bound at: HasFieldQueries.hs:31:1-27 │ Defined at <no location info> └ ========================== -At point (37,14), we found: +At point (35,14), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char @@ -175,70 +147,49 @@ At point (37,14), we found: | `- ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char - │ is an evidence variable bound by a let, depending on: [C:HasField, - │ field1 of Record Thing] + │ is an evidence variable bound by a let, depending on: [field1 of record Thing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | - +- ┌ - | │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a - | │ is a usage of an external evidence variable - | │ Defined in `GHC.Internal.Records' - | └ - | `- ┌ │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined at HasFieldQueries.hs:9:21 + │ Defined at HasFieldQueries.hs:7:21 └ ========================== -At point (41,21), we found: +At point (39,21), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "nested1" NestedThing Thing -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ nested1 of Record NestedThing] +│ is an evidence variable bound by a let, depending on: [nested1 of record NestedThing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ nested1 at HasFieldQueries.hs:1:1, of type: NestedThing -> Thing │ is a usage of an external evidence variable - │ Defined at HasFieldQueries.hs:20:34 + │ Defined at HasFieldQueries.hs:18:34 └ ========================== -At point (41,30), we found: +At point (39,30), we found: ========================== ┌ │ $dHasField at HasFieldQueries.hs:1:1, of type: HasField "field1" Thing Char -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ field1 of Record Thing] +│ is an evidence variable bound by a let, depending on: [field1 of record Thing] │ with scope: ModuleScope │ │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at HasFieldQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ field1 at HasFieldQueries.hs:1:1, of type: Thing -> Char │ is a usage of an external evidence variable - │ Defined at HasFieldQueries.hs:9:21 + │ Defined at HasFieldQueries.hs:7:21 └ ===================================== testsuite/tests/hiefile/should_run/NoFieldSelectorQueries.hs ===================================== @@ -37,13 +37,13 @@ multi1b = valD.c -- ^ -- 6 multi1c :: C -> Float -multi1c someC = someC.c -- Where does this point to? +multi1c someC = someC.c -- ^ -- 7 multi3 = valE.e -- ^ -- 8 -multi4 = valD.e -- This is a run-time error, but where does it point to? +multi4 = valD.e -- ^ -- 9 ===================================== testsuite/tests/hiefile/should_run/NoFieldSelectorQueries.stdout ===================================== @@ -3,19 +3,12 @@ At point (23,16), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:1:1, of type: HasField "a" A Int -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ a of Record A] +│ is an evidence variable bound by a let, depending on: [a of record A] │ with scope: ModuleScope │ │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ a at NoFieldSelectorQueries.hs:1:1, of type: A -> Int │ is a usage of an external evidence variable @@ -46,19 +39,12 @@ At point (30,15), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:30:1-17, of type: HasField "n" B A -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ n of Record B] +│ is an evidence variable bound by a let, depending on: [n of record B] │ with scope: LocalScope NoFieldSelectorQueries.hs:30:1-17 │ bound at: NoFieldSelectorQueries.hs:30:1-17 │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ n at NoFieldSelectorQueries.hs:30:1-17, of type: B -> A │ is a usage of an external evidence variable @@ -70,19 +56,12 @@ At point (30,17), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:30:1-17, of type: HasField "b" A Char -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ b of Record A] +│ is an evidence variable bound by a let, depending on: [b of record A] │ with scope: LocalScope NoFieldSelectorQueries.hs:30:1-17 │ bound at: NoFieldSelectorQueries.hs:30:1-17 │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ b at NoFieldSelectorQueries.hs:30:1-17, of type: A -> Char │ is a usage of an external evidence variable @@ -94,19 +73,12 @@ At point (33,16), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:33:1-16, of type: HasField "c" C Float -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ c of Record C] +│ is an evidence variable bound by a let, depending on: [c of record C] │ with scope: LocalScope NoFieldSelectorQueries.hs:33:1-16 │ bound at: NoFieldSelectorQueries.hs:33:1-16 │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float │ is a usage of an external evidence variable @@ -118,19 +90,12 @@ At point (36,16), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:36:1-16, of type: HasField "c" C Float -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ c of Record C] +│ is an evidence variable bound by a let, depending on: [c of record C] │ with scope: LocalScope NoFieldSelectorQueries.hs:36:1-16 │ bound at: NoFieldSelectorQueries.hs:36:1-16 │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float │ is a usage of an external evidence variable @@ -142,19 +107,12 @@ At point (40,23), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:1:1, of type: HasField "c" C Float -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ c of Record C] +│ is an evidence variable bound by a let, depending on: [c of record C] │ with scope: ModuleScope │ │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ c at NoFieldSelectorQueries.hs:1:1, of type: C -> Float │ is a usage of an external evidence variable @@ -166,19 +124,12 @@ At point (43,15), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:43:1-15, of type: HasField "e" C Int -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ e of Record C] +│ is an evidence variable bound by a let, depending on: [e of record C] │ with scope: LocalScope NoFieldSelectorQueries.hs:43:1-15 │ bound at: NoFieldSelectorQueries.hs:43:1-15 │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ e at NoFieldSelectorQueries.hs:43:1-15, of type: C -> Int │ is a usage of an external evidence variable @@ -190,19 +141,12 @@ At point (46,15), we found: ========================== ┌ │ $dHasField at NoFieldSelectorQueries.hs:46:1-15, of type: HasField "e" C Int -│ is an evidence variable bound by a let, depending on: [C:HasField, -│ e of Record C] +│ is an evidence variable bound by a let, depending on: [e of record C] │ with scope: LocalScope NoFieldSelectorQueries.hs:46:1-15 │ bound at: NoFieldSelectorQueries.hs:46:1-15 │ Defined at <no location info> └ | -+- ┌ -| │ C:HasField at NoFieldSelectorQueries.hs:1:1, of type: forall {k} (x :: k) r a. (r -> a) -> HasField x r a -| │ is a usage of an external evidence variable -| │ Defined in `GHC.Internal.Records' -| └ -| `- ┌ │ e at NoFieldSelectorQueries.hs:43:1-15, of type: C -> Int │ is a usage of an external evidence variable ===================================== testsuite/tests/hiefile/should_run/RecordDotTypes.stdout ===================================== @@ -1,9 +1,9 @@ At (22,6), got type: MyRecord At (22,20), got type: MyRecord -> Integer At (22,25), got type: MyRecord -At (22,28), got type: MyChild -> [Char] -At (22,29), got type: MyChild -> [Char] -At (22,6) - (22,8), got type: [Char] +At (22,28), got type: MyChild -> String +At (22,29), got type: MyChild -> String +At (22,6) - (22,8), got type: String At (22,17) - (22,20), got type: Integer At (22,25) - (22,27), got type: MyChild -At (22,25) - (22,29), got type: [Char] +At (22,25) - (22,29), got type: String ===================================== testsuite/tests/hiefile/should_run/all.T ===================================== @@ -12,3 +12,4 @@ test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files([ test('T25709', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('HasFieldQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) test('NoFieldSelectorQueries', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) +test('EvidenceInternalIds', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f8122cfedc3a4330817ccee64c6dfce6... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f8122cfedc3a4330817ccee64c6dfce6... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help