summaryrefslogtreecommitdiff
path: root/testsuite/tests/printer/Test20258.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2021-08-22 21:14:46 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-06 22:57:55 -0400
commit407d3b3a3a219dab56d0a36598c637aa45da61e1 (patch)
tree4e03381c68302e2a995c573b4b57a4250f12dbf5 /testsuite/tests/printer/Test20258.hs
parent5b41353355022c1247e0516d541b7f7fb49f0e29 (diff)
downloadhaskell-407d3b3a3a219dab56d0a36598c637aa45da61e1.tar.gz
EPA: order of semicolons and comments for top-level decls is wrong
A comment followed by a semicolon at the top level resulted in the preceding comments being attached to the following declaration. Capture the comments as belonging to the declaration preceding the semicolon instead. Closes #20258
Diffstat (limited to 'testsuite/tests/printer/Test20258.hs')
-rw-r--r--testsuite/tests/printer/Test20258.hs79
1 files changed, 79 insertions, 0 deletions
diff --git a/testsuite/tests/printer/Test20258.hs b/testsuite/tests/printer/Test20258.hs
new file mode 100644
index 0000000000..bfcad743ae
--- /dev/null
+++ b/testsuite/tests/printer/Test20258.hs
@@ -0,0 +1,79 @@
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE StandaloneKindSignatures #-}
+{-# LANGUAGE TemplateHaskell #-}
+module Test20258 where
+
+x = 1
+
+-- Comment
+;
+
+data Foo = Foo
+
+-- After TyClD
+;
+
+instance Monoid CIRB where
+ mempty = CIRB mempty mempty mempty mempty
+
+-- After InstD
+;
+
+deriving instance Eq (GenTickish 'TickishPassCore)
+
+-- After DerivD
+;
+
+transferCodingStr DeflateTransferCoding = "deflate"
+
+-- After ValD
+;
+
+getContentType :: Int
+
+-- After SigD
+;
+
+type MyMaybe :: Type -> Type
+
+-- After KindSigD
+;
+
+default (Integer)
+
+-- After DefD
+;
+
+foreign import ccall unsafe "isDoubleFinite" isDoubleFinite :: Double -> Int
+
+-- After ForD
+;
+
+{-# DEPRECATED foo2 [] #-}
+
+-- After WarningD
+;
+
+{-# ANN module FromA #-}
+
+-- After AnnD
+;
+
+{-# RULES "myrule2" id f = f #-}
+
+-- After RuleD
+;
+
+$foo
+
+-- After SpliceD
+;
+
+type role Representational representational
+
+-- After RoleAnnotD
+;
+
+getContentType = 1
+
+-- Note: skipping DocD, only generated in haddock mode