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

Commits:

2 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,18 @@ 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 lit)
    
    372
    + = do { (lit', fvs) <- rnQualLit lit
    
    373
    +      ; return (HsQualLit x lit', fvs)
    
    374
    +      }
    
    375
    +
    
    376
    +  where
    
    377
    +    rnQualLit :: HsQualLit GhcPs -> RnM (HsQualLit GhcRn, FreeNames)
    
    378
    +    rnQualLit QualLit{..}
    
    379
    +      = do { (funName, fvs) <- lookupNameWithQualifier fromStringName ql_mod
    
    380
    +           ; let lit = QualLit{ql_ext = L noAnn funName, ..}
    
    381
    +           ; pure (lit, fvs) }
    
    382
    +
    
    376 383
     
    
    377 384
     rnExpr (HsApp x fun arg)
    
    378 385
       = do { (fun',fvFun) <- rnLExpr fun
    

  • 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)