summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-10-07 13:57:59 +0300
committerVladislav Zavialov <vlad.z.4096@gmail.com>2019-10-29 21:09:13 +0300
commit5298eb4e0ac41b35f250d32550ca2b51e82f1269 (patch)
tree185369383113ff83010598bba0ed1dd07aac38cb
parent72f7ac9ad66b886f4ea9569446e20aa4f97890e4 (diff)
downloadhaskell-wip/whitespace-forward-compat.tar.gz
Whitespace forward compatibility for proposal #229wip/whitespace-forward-compat
GHC Proposal #229 changes the lexical rules of Haskell, which may require slight whitespace adjustments in certain cases. This patch changes formatting in a few places in GHC and its testsuite in a way that enables it to compile under the proposed rules.
-rw-r--r--compiler/typecheck/TcRnExports.hs2
-rw-r--r--compiler/utils/Dominators.hs6
-rw-r--r--testsuite/tests/deSugar/should_compile/ds020.hs2
-rw-r--r--testsuite/tests/determinism/determ017/A.hs6
-rw-r--r--testsuite/tests/indexed-types/should_compile/T3787.hs6
-rw-r--r--testsuite/tests/module/mod70.hs2
-rw-r--r--testsuite/tests/module/mod70.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/T13600b.hs8
-rw-r--r--testsuite/tests/parser/should_compile/T13600b.stderr20
-rw-r--r--testsuite/tests/programs/strict_anns/Main.hs4
-rw-r--r--testsuite/tests/rename/should_fail/rnfail016.hs2
-rw-r--r--testsuite/tests/simplCore/should_run/T3591.hs6
-rw-r--r--testsuite/tests/typecheck/should_fail/T11313.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/T11313.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T12529.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail112.hs2
16 files changed, 27 insertions, 47 deletions
diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs
index af8ba09a65..a4ef692c58 100644
--- a/compiler/typecheck/TcRnExports.hs
+++ b/compiler/typecheck/TcRnExports.hs
@@ -269,7 +269,7 @@ exports_from_avail (Just (dL->L _ rdr_items)) rdr_env imports this_mod
-- See Note [Avails of associated data families]
expand_tyty_gre :: GlobalRdrElt -> [GlobalRdrElt]
- expand_tyty_gre (gre @ GRE { gre_name = me, gre_par = ParentIs p })
+ expand_tyty_gre (gre@GRE { gre_name = me, gre_par = ParentIs p })
| isTyConName p, isTyConName me = [gre, gre{ gre_par = NoParent }]
expand_tyty_gre gre = [gre]
diff --git a/compiler/utils/Dominators.hs b/compiler/utils/Dominators.hs
index d6d8404564..485cc75995 100644
--- a/compiler/utils/Dominators.hs
+++ b/compiler/utils/Dominators.hs
@@ -364,11 +364,11 @@ domM = fetch domE
rootM :: Dom s Node
rootM = gets rootE
succsM :: Node -> Dom s [Node]
-succsM i = gets (IS.toList . (!i) . succE)
+succsM i = gets (IS.toList . (! i) . succE)
predsM :: Node -> Dom s [Node]
-predsM i = gets (IS.toList . (!i) . predE)
+predsM i = gets (IS.toList . (! i) . predE)
bucketM :: Node -> Dom s [Node]
-bucketM i = gets (IS.toList . (!i) . bucketE)
+bucketM i = gets (IS.toList . (! i) . bucketE)
sizeM :: Node -> Dom s Int
sizeM = fetch sizeE
sdnoM :: Node -> Dom s Int
diff --git a/testsuite/tests/deSugar/should_compile/ds020.hs b/testsuite/tests/deSugar/should_compile/ds020.hs
index c6d61461c3..a185ff2ce7 100644
--- a/testsuite/tests/deSugar/should_compile/ds020.hs
+++ b/testsuite/tests/deSugar/should_compile/ds020.hs
@@ -11,7 +11,7 @@ a ~(~[],~[],~[]) = []
b ~(x:xs:ys) = []
b ~(~x: ~xs: ~ys) = []
-c ~x ~ _ ~11111 ~3.14159265 = x
+c ~x ~_ ~11111 ~3.14159265 = x
d 11 = 4
d 12 = 3
diff --git a/testsuite/tests/determinism/determ017/A.hs b/testsuite/tests/determinism/determ017/A.hs
index 082c9380de..f3e3bb9e30 100644
--- a/testsuite/tests/determinism/determ017/A.hs
+++ b/testsuite/tests/determinism/determ017/A.hs
@@ -85,7 +85,7 @@ instance MonadFail Identity where
fail = error "Identity(fail)"
newtype Trampoline m s r = Trampoline {bounce :: m (TrampolineState m s r)}
-data TrampolineState m s r = Done r | Suspend! (s (Trampoline m s r))
+data TrampolineState m s r = Done r | Suspend !(s (Trampoline m s r))
instance (Monad m, Functor s) => Functor (Trampoline m s) where
fmap = liftM
@@ -103,11 +103,11 @@ instance (Monad m, Functor s) => Monad (Trampoline m s) where
instance (MonadFail m, Functor s) => MonadFail (Trampoline m s) where
fail = error "Trampoline(fail)"
-data Yield x y = Yield! x y
+data Yield x y = Yield !x y
instance Functor (Yield x) where
fmap f (Yield x y) = trace "fmap yield" $ Yield x (f y)
-data Await x y = Await! (x -> y)
+data Await x y = Await !(x -> y)
instance Functor (Await x) where
fmap f (Await g) = trace "fmap await" $ Await (f . g)
diff --git a/testsuite/tests/indexed-types/should_compile/T3787.hs b/testsuite/tests/indexed-types/should_compile/T3787.hs
index 5e14092611..f438674d7a 100644
--- a/testsuite/tests/indexed-types/should_compile/T3787.hs
+++ b/testsuite/tests/indexed-types/should_compile/T3787.hs
@@ -76,7 +76,7 @@ data TrampolineState s m r =
-- | Trampoline computation is finished with final value /r/.
Done r
-- | Computation is suspended, its remainder is embedded in the functor /s/.
- | Suspend! (s (Trampoline s m r))
+ | Suspend !(s (Trampoline s m r))
instance (Functor s, Monad m) => Functor (Trampoline s m) where
fmap = liftM
@@ -101,11 +101,11 @@ instance (Functor s, ParallelizableMonad m) => ParallelizableMonad (Trampoline s
instance Functor s => MonadTrans (Trampoline s) where
lift = Trampoline . liftM Done
-data Yield x y = Yield! x y
+data Yield x y = Yield !x y
instance Functor (Yield x) where
fmap f (Yield x y) = Yield x (f y)
-data Await x y = Await! (x -> y)
+data Await x y = Await !(x -> y)
instance Functor (Await x) where
fmap f (Await g) = Await (f . g)
diff --git a/testsuite/tests/module/mod70.hs b/testsuite/tests/module/mod70.hs
index cb7d51fe3b..954f39f353 100644
--- a/testsuite/tests/module/mod70.hs
+++ b/testsuite/tests/module/mod70.hs
@@ -1,3 +1,3 @@
-- !!! Illegal ~ in expression
module M where
-f x = x~1
+f x = x ~1
diff --git a/testsuite/tests/module/mod70.stderr b/testsuite/tests/module/mod70.stderr
index 616ef12376..093f166ebd 100644
--- a/testsuite/tests/module/mod70.stderr
+++ b/testsuite/tests/module/mod70.stderr
@@ -1,2 +1,2 @@
-mod70.hs:3:8: error: Pattern syntax in expression context: ~1
+mod70.hs:3:9: error: Pattern syntax in expression context: ~1
diff --git a/testsuite/tests/parser/should_compile/T13600b.hs b/testsuite/tests/parser/should_compile/T13600b.hs
index e8fd2c183f..14796426e9 100644
--- a/testsuite/tests/parser/should_compile/T13600b.hs
+++ b/testsuite/tests/parser/should_compile/T13600b.hs
@@ -1,9 +1,9 @@
module T13600b where
-f !(Just x) = f !! x
-f !y = head f
+f ! (Just x) = f !! x
+f ! y = head f
x = [1,2,3] ! Just 1
where
- f !(Just x) = f !! x
- f !y = head f
+ f ! (Just x) = f !! x
+ f ! y = head f
diff --git a/testsuite/tests/parser/should_compile/T13600b.stderr b/testsuite/tests/parser/should_compile/T13600b.stderr
deleted file mode 100644
index 244b948e0e..0000000000
--- a/testsuite/tests/parser/should_compile/T13600b.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-
-T13600b.hs:3:3: warning: [-Wmissing-space-after-bang (in -Wdefault)]
- Did you forget to enable BangPatterns?
- If you mean to bind (!) then perhaps you want
- to add a space after the bang for clarity.
-
-T13600b.hs:4:3: warning: [-Wmissing-space-after-bang (in -Wdefault)]
- Did you forget to enable BangPatterns?
- If you mean to bind (!) then perhaps you want
- to add a space after the bang for clarity.
-
-T13600b.hs:8:7: warning: [-Wmissing-space-after-bang (in -Wdefault)]
- Did you forget to enable BangPatterns?
- If you mean to bind (!) then perhaps you want
- to add a space after the bang for clarity.
-
-T13600b.hs:9:7: warning: [-Wmissing-space-after-bang (in -Wdefault)]
- Did you forget to enable BangPatterns?
- If you mean to bind (!) then perhaps you want
- to add a space after the bang for clarity.
diff --git a/testsuite/tests/programs/strict_anns/Main.hs b/testsuite/tests/programs/strict_anns/Main.hs
index d9deac65f6..dcd9103fa0 100644
--- a/testsuite/tests/programs/strict_anns/Main.hs
+++ b/testsuite/tests/programs/strict_anns/Main.hs
@@ -3,9 +3,9 @@
module Main where
-data Foo1 = Crunch1 ! Int ! Int Int deriving( Show )
+data Foo1 = Crunch1 !Int !Int Int deriving( Show )
-data Foo2 = Crunch2 ! Int Int Int deriving( Show )
+data Foo2 = Crunch2 !Int Int Int deriving( Show )
main = do
print (Crunch1 (1+1) (2+2) (3+3))
diff --git a/testsuite/tests/rename/should_fail/rnfail016.hs b/testsuite/tests/rename/should_fail/rnfail016.hs
index 7dccaa90b1..32ac6032bc 100644
--- a/testsuite/tests/rename/should_fail/rnfail016.hs
+++ b/testsuite/tests/rename/should_fail/rnfail016.hs
@@ -3,5 +3,5 @@ module ShouldFail where
-- !!! Pattern syntax in expressions
-f x = x @ x
+f x = x@x
diff --git a/testsuite/tests/simplCore/should_run/T3591.hs b/testsuite/tests/simplCore/should_run/T3591.hs
index 6b2b23b2ba..fc49c00cdb 100644
--- a/testsuite/tests/simplCore/should_run/T3591.hs
+++ b/testsuite/tests/simplCore/should_run/T3591.hs
@@ -83,7 +83,7 @@ instance Monad Identity where
m >>= k = k (runIdentity m)
newtype Trampoline m s r = Trampoline {bounce :: m (TrampolineState m s r)}
-data TrampolineState m s r = Done r | Suspend! (s (Trampoline m s r))
+data TrampolineState m s r = Done r | Suspend !(s (Trampoline m s r))
instance (Monad m, Functor s) => Functor (Trampoline m s) where
fmap = liftM
@@ -101,11 +101,11 @@ instance (Monad m, Functor s) => Monad (Trampoline m s) where
instance (Monad m, Functor s) => MonadFail (Trampoline m s) where
fail = error
-data Yield x y = Yield! x y
+data Yield x y = Yield !x y
instance Functor (Yield x) where
fmap f (Yield x y) = trace "fmap yield" $ Yield x (f y)
-data Await x y = Await! (x -> y)
+data Await x y = Await !(x -> y)
instance Functor (Await x) where
fmap f (Await g) = trace "fmap await" $ Await (f . g)
diff --git a/testsuite/tests/typecheck/should_fail/T11313.hs b/testsuite/tests/typecheck/should_fail/T11313.hs
index 68aa5b0f6c..27a4397bf0 100644
--- a/testsuite/tests/typecheck/should_fail/T11313.hs
+++ b/testsuite/tests/typecheck/should_fail/T11313.hs
@@ -2,6 +2,6 @@
module T11313 where
-x = fmap @ (*)
+x = fmap @(*)
-- test error message output, which was quite silly before
diff --git a/testsuite/tests/typecheck/should_fail/T11313.stderr b/testsuite/tests/typecheck/should_fail/T11313.stderr
index 8697d3b6c7..ba71dd4e88 100644
--- a/testsuite/tests/typecheck/should_fail/T11313.stderr
+++ b/testsuite/tests/typecheck/should_fail/T11313.stderr
@@ -1,5 +1,5 @@
-T11313.hs:5:13: error:
+T11313.hs:5:12: error:
• Expected kind ‘* -> *’, but ‘*’ has kind ‘*’
• In the type ‘(*)’
In the expression: fmap @(*)
diff --git a/testsuite/tests/typecheck/should_fail/T12529.hs b/testsuite/tests/typecheck/should_fail/T12529.hs
index ac4e31db68..a2679286e5 100644
--- a/testsuite/tests/typecheck/should_fail/T12529.hs
+++ b/testsuite/tests/typecheck/should_fail/T12529.hs
@@ -2,4 +2,4 @@
module T12529 where
-f = p @ Int
+f = p @Int
diff --git a/testsuite/tests/typecheck/should_fail/tcfail112.hs b/testsuite/tests/typecheck/should_fail/tcfail112.hs
index 5252f83b14..71f3dd4305 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail112.hs
+++ b/testsuite/tests/typecheck/should_fail/tcfail112.hs
@@ -4,7 +4,7 @@
module ShouldFail where
-data S = S { x::Int, y:: ! Int }
+data S = S { x::Int, y:: !Int }
data T = T Int !Int
data U = U Int Int