Apoorv Ingle pushed to branch wip/ani/hie-spans at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • compiler/GHC.hs
    ... ... @@ -1617,6 +1617,7 @@ addSourceToTokens _ _ [] = []
    1617 1617
     addSourceToTokens loc buf (t@(L span _) : ts)
    
    1618 1618
         = case span of
    
    1619 1619
           UnhelpfulSpan _ -> (t,"") : addSourceToTokens loc buf ts
    
    1620
    +      GeneratedSrcSpan _ -> (t,"") : addSourceToTokens loc buf ts
    
    1620 1621
           RealSrcSpan s _ -> (t,str) : addSourceToTokens newLoc newBuf ts
    
    1621 1622
             where
    
    1622 1623
               (newLoc, newBuf, str) = go "" loc buf
    

  • ghc/GHCi/UI.hs
    ... ... @@ -2692,8 +2692,9 @@ parseSpanArg s = do
    2692 2692
     -- @<filename>:(<line>,<col>)-(<line-end>,<col-end>)@
    
    2693 2693
     -- while simply unpacking 'UnhelpfulSpan's
    
    2694 2694
     showSrcSpan :: SrcSpan -> String
    
    2695
    -showSrcSpan (UnhelpfulSpan s)  = unpackFS (unhelpfulSpanFS s)
    
    2696
    -showSrcSpan (RealSrcSpan spn _) = showRealSrcSpan spn
    
    2695
    +showSrcSpan (UnhelpfulSpan s)    = unpackFS (unhelpfulSpanFS s)
    
    2696
    +showSrcSpan (GeneratedSrcSpan _) = unpackFS (unhelpfulSpanFS UnhelpfulGenerated)
    
    2697
    +showSrcSpan (RealSrcSpan spn _)  = showRealSrcSpan spn
    
    2697 2698
     
    
    2698 2699
     -- | Variant of 'showSrcSpan' for 'RealSrcSpan's
    
    2699 2700
     showRealSrcSpan :: RealSrcSpan -> String
    
    ... ... @@ -4235,14 +4236,14 @@ stepLocalCmd arg = withSandboxOnly ":steplocal" $ step arg
    4235 4236
           mb_span <- getCurrentBreakSpan
    
    4236 4237
           case mb_span of
    
    4237 4238
             Nothing  -> stepCmd []
    
    4238
    -        Just (UnhelpfulSpan _) -> liftIO $ putStrLn (            -- #14690
    
    4239
    -           ":steplocal is not possible." ++
    
    4240
    -           "\nCannot determine current top-level binding after " ++
    
    4241
    -           "a break on error / exception.\nUse :stepmodule.")
    
    4242
    -        Just loc -> do
    
    4239
    +        Just loc@(RealSrcSpan{}) -> do
    
    4243 4240
                md <- fromMaybe (panic "stepLocalCmd") <$> getCurrentBreakModule
    
    4244 4241
                current_toplevel_decl <- flip enclosingTickSpan loc <$> getTickArray md
    
    4245 4242
                doContinue (GHC.LocalStep (RealSrcSpan current_toplevel_decl Strict.Nothing))
    
    4243
    +        Just _ -> liftIO $ putStrLn (            -- #14690
    
    4244
    +           ":steplocal is not possible." ++
    
    4245
    +           "\nCannot determine current top-level binding after " ++
    
    4246
    +           "a break on error / exception.\nUse :stepmodule.")
    
    4246 4247
     
    
    4247 4248
     stepModuleCmd :: GhciMonad m => String -> m ()
    
    4248 4249
     stepModuleCmd arg = withSandboxOnly ":stepmodule" $ step arg
    
    ... ... @@ -4580,7 +4581,7 @@ listCmd "" = do
    4580 4581
               printForUser $ text "Not stopped at a breakpoint; nothing to list"
    
    4581 4582
           Just (RealSrcSpan pan _) ->
    
    4582 4583
               listAround pan True
    
    4583
    -      Just pan@(UnhelpfulSpan _) ->
    
    4584
    +      Just pan@_ ->
    
    4584 4585
               do resumes <- GHC.getResumeContext
    
    4585 4586
                  case resumes of
    
    4586 4587
                      [] -> panic "No resumes"
    

  • ghc/GHCi/UI/Info.hs
    ... ... @@ -168,6 +168,7 @@ findName infos span0 mi string =
    168 168
           Just name ->
    
    169 169
             case getSrcSpan name of
    
    170 170
               UnhelpfulSpan {} -> tryExternalModuleResolution
    
    171
    +          GeneratedSrcSpan {} -> tryExternalModuleResolution
    
    171 172
               RealSrcSpan   {} -> return (getName name)
    
    172 173
       where
    
    173 174
         rdrs = modInfo_rdrs mi