[Git][ghc/ghc][wip/T18599] reconsider hsExprNeedsParens impl

Shayne Fletcher gitlab at gitlab.haskell.org
Sun Oct 25 21:25:02 UTC 2020



Shayne Fletcher pushed to branch wip/T18599 at Glasgow Haskell Compiler / GHC


Commits:
5e29a359 by Shayne Fletcher at 2020-10-25T17:24:07-04:00
reconsider hsExprNeedsParens impl

- - - - -


2 changed files:

- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Parser/PostProcess.hs


Changes:

=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -1371,7 +1371,6 @@ hsExprNeedsParens p = go
     go (NegApp{})                     = p > topPrec
     go (SectionL{})                   = True
     go (SectionR{})                   = True
-    go (Projection{})                 = True
     go (ExplicitTuple{})              = False
     go (ExplicitSum{})                = False
     go (HsLam{})                      = p > topPrec
@@ -1398,10 +1397,11 @@ hsExprNeedsParens p = go
     go (HsBinTick _ _ _ (L _ e))      = go e
     go (RecordCon{})                  = False
     go (HsRecFld{})                   = False
-    -- To be honest I'm not sure right now but we know that projection
-    -- has higher precedence than application since f r.a.b parses as
-    -- f (r.a.b) so I'm going to with False for the moment.
+
+    -- Not entirely clear about these.
     go (GetField{})                   = False
+    go (Projection{})                 = False
+
     go (XExpr x)
       | GhcTc <- ghcPass @p
       = case x of


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -19,7 +19,7 @@
 {-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
 
 module GHC.Parser.PostProcess (
-        mkGetField, mkProjection, mkFieldUpdater, mkProj, isGetField, Fbind(..), -- RecordDot
+        mkGetField, mkProjection, mkFieldUpdater, isGetField, Fbind(..), -- RecordDot
         mkHsOpApp,
         mkHsIntegral, mkHsFractional, mkHsIsString,
         mkHsDo, mkSpliceDecl,



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5e29a35991a311951978b06ab03b0e04452b10b5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5e29a35991a311951978b06ab03b0e04452b10b5
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201025/f61aed08/attachment-0001.html>


More information about the ghc-commits mailing list