[commit: ghc] wip/T3384: No parens around HsSpliceE (7363a54)

git at git.haskell.org git at git.haskell.org
Sun Nov 13 21:05:24 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T3384
Link       : http://ghc.haskell.org/trac/ghc/changeset/7363a540251aeda951af905212eca58d792d9309/ghc

>---------------------------------------------------------------

commit 7363a540251aeda951af905212eca58d792d9309
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Fri Nov 11 10:29:58 2016 +0200

    No parens around HsSpliceE


>---------------------------------------------------------------

7363a540251aeda951af905212eca58d792d9309
 compiler/hsSyn/HsExpr.hs                          |  1 +
 testsuite/tests/ghc-api/annotations/T10276.stderr | 24 ++++--------
 testsuite/tests/printer/Ppr006.stderr             | 45 +++++++++++++++++++++++
 testsuite/tests/printer/Ppr007.stderr             | 17 +++++++++
 4 files changed, 71 insertions(+), 16 deletions(-)

diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs
index 9d93692..fe29d53 100644
--- a/compiler/hsSyn/HsExpr.hs
+++ b/compiler/hsSyn/HsExpr.hs
@@ -1067,6 +1067,7 @@ hsExprNeedsParens (HsTcBracketOut {}) = False
 hsExprNeedsParens (HsDo sc _ _)
        | isListCompExpr sc            = False
 hsExprNeedsParens (HsRecFld{})        = False
+hsExprNeedsParens (HsSpliceE{})       = False
 hsExprNeedsParens _ = True
 
 
diff --git a/testsuite/tests/ghc-api/annotations/T10276.stderr b/testsuite/tests/ghc-api/annotations/T10276.stderr
index d79fc3a..fff4c8c 100644
--- a/testsuite/tests/ghc-api/annotations/T10276.stderr
+++ b/testsuite/tests/ghc-api/annotations/T10276.stderr
@@ -8,8 +8,7 @@ Test10276.hs:11:29: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
 
 Test10276.hs:11:46: error:
     Not in scope: type constructor or class ‘M.Map’
@@ -17,8 +16,7 @@ Test10276.hs:11:46: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
 
 Test10276.hs:11:52: error:
     Not in scope: type constructor or class ‘L.Name’
@@ -26,8 +24,7 @@ Test10276.hs:11:52: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
 
 Test10276.hs:11:60: error:
     Not in scope: type constructor or class ‘L.Operand’
@@ -35,8 +32,7 @@ Test10276.hs:11:60: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
 
 Test10276.hs:14:3: error:
     ‘qqExp’ is not a (visible) method of class ‘QQExp2’
@@ -47,8 +43,7 @@ Test10276.hs:15:29: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
 
 Test10276.hs:15:46: error:
     Not in scope: type constructor or class ‘M.Map’
@@ -56,8 +51,7 @@ Test10276.hs:15:46: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
 
 Test10276.hs:15:52: error:
     Not in scope: type constructor or class ‘L.Name’
@@ -65,8 +59,7 @@ Test10276.hs:15:52: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
 
 Test10276.hs:15:60: error:
     Not in scope: type constructor or class ‘L.Operand’
@@ -74,5 +67,4 @@ Test10276.hs:15:60: error:
     In the Template Haskell quotation
       [|| fst
           $ runState
-              ($$(qqExpM x))
-              ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
+              $$(qqExpM x) ((0, M.empty) :: (Int, M.Map L.Name [L.Operand])) ||]
diff --git a/testsuite/tests/printer/Ppr006.stderr b/testsuite/tests/printer/Ppr006.stderr
new file mode 100644
index 0000000..12f1ed6
--- /dev/null
+++ b/testsuite/tests/printer/Ppr006.stderr
@@ -0,0 +1,45 @@
+Ppr006.hs:4:14: error:
+    Not in scope: type constructor or class ‘Command’
+
+Ppr006.hs:7:23: error:
+    Not in scope: ‘Macro.guessCommands’
+    No module named ‘Macro’ is imported.
+
+Ppr006.hs:12:20: error:
+    Not in scope: ‘ListWidget.moveLast’
+    No module named ‘ListWidget’ is imported.
+
+Ppr006.hs:12:41: error:
+    Not in scope: ‘ListWidget.new’
+    No module named ‘ListWidget’ is imported.
+
+Ppr006.hs:21:19: error:
+    • Not in scope: ‘help’
+    • In the quasi-quotation:
+        [help|
+        Bind the command {expansion} to the key {name}.  The same command may
+        be bound to different keys.
+        |]
+
+Ppr006.ppr.hs:3:14: error:
+    Not in scope: type constructor or class ‘Command’
+
+Ppr006.ppr.hs:8:27: error:
+    Not in scope: ‘Macro.guessCommands’
+    No module named ‘Macro’ is imported.
+
+Ppr006.ppr.hs:14:19: error:
+    Not in scope: ‘ListWidget.moveLast’
+    No module named ‘ListWidget’ is imported.
+
+Ppr006.ppr.hs:14:40: error:
+    Not in scope: ‘ListWidget.new’
+    No module named ‘ListWidget’ is imported.
+
+Ppr006.ppr.hs:26:8: error:
+    • Not in scope: ‘help’
+    • In the quasi-quotation:
+        [help|
+        Bind the command {expansion} to the key {name}.  The same command may
+        be bound to different keys.
+        |]
diff --git a/testsuite/tests/printer/Ppr007.stderr b/testsuite/tests/printer/Ppr007.stderr
new file mode 100644
index 0000000..5bb122a
--- /dev/null
+++ b/testsuite/tests/printer/Ppr007.stderr
@@ -0,0 +1,17 @@
+Ppr007.hs:7:3: error:
+    • Couldn't match expected type ‘Int’ with actual type ‘Char’
+    • In the pattern: 'a'
+      In a stmt of a 'do' block: 'a' <- return (3 :: Int)
+      In the expression:
+        do x <- getChar
+           'a' <- return (3 :: Int)
+           return ()
+
+Ppr007.ppr.hs:5:8: error:
+    • Couldn't match expected type ‘Int’ with actual type ‘Char’
+    • In the pattern: 'a'
+      In a stmt of a 'do' block: 'a' <- return (3 :: Int)
+      In the expression:
+        do x <- getChar
+           'a' <- return (3 :: Int)
+           return ()



More information about the ghc-commits mailing list