Apoorv Ingle pushed to branch wip/ani/T27156 at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • compiler/GHC/Rename/Expr.hs
    ... ... @@ -40,7 +40,6 @@ import GHC.Rename.Unbound ( reportUnboundName )
    40 40
     import GHC.Rename.Splice  ( rnTypedBracket, rnUntypedBracket, rnTypedSplice
    
    41 41
                               , rnUntypedSpliceExpr, checkThLocalNameWithLift, checkThLocalNameNoLift )
    
    42 42
     import GHC.Rename.HsType
    
    43
    -import GHC.Rename.Lit
    
    44 43
     import GHC.Rename.Pat
    
    45 44
     
    
    46 45
     import GHC.Driver.DynFlags
    
    ... ... @@ -369,10 +368,11 @@ rnExpr (HsOverLit x lit)
    369 368
                      return (HsApp noExtField (noLocA neg) (noLocA (HsOverLit x lit'))
    
    370 369
                             , fvs ) }
    
    371 370
     
    
    372
    -rnExpr (HsQualLit x lit) = do
    
    373
    -  ((lit', desugaredExpr), fvs) <- rnQualLit lit
    
    374
    -  let origExpr = HsQualLit x lit'
    
    375
    -  return (mkExpandedExpr origExpr desugaredExpr, fvs)
    
    371
    +rnExpr (HsQualLit x QualLit{..})
    
    372
    + = do { (funName, fvs) <- lookupNameWithQualifier fromStringName ql_mod
    
    373
    +      ; let lit' = QualLit{ql_ext = L noAnn funName, ..}
    
    374
    +      ; return (HsQualLit x lit', fvs)
    
    375
    +      }
    
    376 376
     
    
    377 377
     rnExpr (HsApp x fun arg)
    
    378 378
       = do { (fun',fvFun) <- rnLExpr fun
    

  • compiler/GHC/Rename/Utils.hs
    ... ... @@ -41,7 +41,7 @@ module GHC.Rename.Utils (
    41 41
     where
    
    42 42
     
    
    43 43
     
    
    44
    -import GHC.Prelude hiding (init, last, scanl, tail)
    
    44
    +import GHC.Prelude
    
    45 45
     
    
    46 46
     import GHC.Core.Type
    
    47 47
     import GHC.Hs
    

  • compiler/GHC/Tc/Gen/Expand.hs
    ... ... @@ -131,6 +131,20 @@ tcExpand e@(HsOverLabel (_, rs_table) v)
    131 131
       | otherwise
    
    132 132
       = pprPanic "tcExpand" (vcat [ text "Should Never Happen: could not find fromLabel in rs_table"
    
    133 133
                                   , ppr e] )
    
    134
    +
    
    135
    +------------------------------------------
    
    136
    +-- Qualified Literals
    
    137
    +tcExpand e@(HsQualLit _ QualLit{ql_val = ql_val, ql_ext = (L _ fromStringName)})
    
    138
    +  = do { let hsLit = case ql_val of
    
    139
    +                        -- See Note [Implementation of QualifiedStrings]
    
    140
    +                        HsQualString st s -> HsString st s
    
    141
    +       ;  return $ Just $
    
    142
    +          HSE { hse_ctxt = ExprCtxt e
    
    143
    +              , hse_exp = wrapGenSpan $ genHsApps fromStringName [genLHsLit hsLit]
    
    144
    +              }
    
    145
    +       }
    
    146
    +
    
    147
    +
    
    134 148
     ------------------------------------------
    
    135 149
     -- Operator Applications
    
    136 150
     tcExpand e@(OpApp _ arg1 op arg2)
    
    ... ... @@ -186,7 +200,7 @@ tcExpand (HsDo _ do_or_lc stmts)
    186 200
       -- ApplicativeDo are typechecked using tcDoStmts
    
    187 201
       = do isApplicativeDo <- xoptM LangExt.ApplicativeDo
    
    188 202
            if isApplicativeDo
    
    189
    -         then return Nothing
    
    203
    +         then return Nothing -- to be fixed by #24406
    
    190 204
              -- Expand expression on the fly otherwise
    
    191 205
              -- See Note [Typechecking by expansion: overview]
    
    192 206
              else do { hse <- expandDoStmts do_or_lc stmts
    
    ... ... @@ -254,10 +268,9 @@ tcExpand e@(RecordUpd (Just rs_table) (L l expr) (OverloadedRecUpdFields { olRec
    254 268
     
    
    255 269
     
    
    256 270
     
    
    257
    ----------
    
    258
    --- We return ExpandedThingRn as is for now,
    
    259
    --- but after removing all the calls to mkExpandExpr in the renamer,
    
    260
    --- this case should never happen, as the renamer will never produce an ExpandedThingRn
    
    271
    +------------------------
    
    272
    +-- XExpr
    
    273
    +-- Expansions are idempotent, XExprs do not expand again
    
    261 274
     tcExpand (XExpr (ExpandedThingRn hse))
    
    262 275
       = return (Just hse)
    
    263 276