File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
ghcide/src/Development/IDE/Spans Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -315,16 +315,18 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
315
315
where
316
316
instancesForName :: IO (Maybe [ClsInst ])
317
317
instancesForName = runMaybeT $ do
318
- typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingToType
318
+ typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingAsDataType
319
319
liftIO $ evalGhcEnv env $ getInstancesForType typ
320
320
321
- tyThingToType :: TyThing -> Maybe Type
322
- tyThingToType (AnId _) = Nothing
323
- tyThingToType (ACoAxiom _) = Nothing
324
- tyThingToType (AConLike cl) = case cl of
321
+ -- | Gets the datatype `Type` corresponding to a TyThing, if it repressents a datatype or
322
+ -- a data constructor.
323
+ tyThingAsDataType :: TyThing -> Maybe Type
324
+ tyThingAsDataType (AnId _) = Nothing
325
+ tyThingAsDataType (ACoAxiom _) = Nothing
326
+ tyThingAsDataType (AConLike cl) = case cl of
325
327
PatSynCon _ -> Nothing
326
328
RealDataCon dc -> Just $ mkTyConTy $ dataConTyCon dc
327
- tyThingToType (ATyCon tc) = Just $ mkTyConTy tc
329
+ tyThingAsDataType (ATyCon tc) = Just $ mkTyConTy tc
328
330
prettyInstances (Left _, _) = pure Nothing
329
331
330
332
typeLocationsAtPoint
You can’t perform that action at this time.
0 commit comments