Skip to content

Commit

Permalink
All tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
alanz committed Jan 20, 2025
1 parent 1ef4d88 commit a2e9ac2
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ packages
/failing-tests-for-ghc9.2.txt
/failures.txt
/tests/examples/transform/AddArgFromWhereComments.hs.expected
/tests/examples/ghc912-copied/
3 changes: 2 additions & 1 deletion configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ rm -fr dist*
# cabal configure -fdev -froundtrip --enable-tests --with-compiler=/opt/ghc/9.12.0.20241114/bin/ghc --allow-newer

# cabal configure -fdev -froundtrip --enable-tests --with-compiler=/home/alanz/.ghcup/bin/ghc-9.12.0.20241128 --allow-newer
cabal configure -fdev --enable-tests --with-compiler=/home/alanz/.ghcup/bin/ghc-9.12.0.20241128
# cabal configure -fdev --enable-tests --with-compiler=/home/alanz/.ghcup/bin/ghc-9.12.0.20241128
cabal configure -fdev --enable-tests --with-compiler=ghc-9.12.1



Expand Down
2 changes: 1 addition & 1 deletion src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ printOneComment c@(Comment _str loc _r _mo) = do
dp' <- case mep of
Just (EpaDelta _ edp _) -> do
debugM $ "printOneComment:edp=" ++ show edp
adjustDeltaForOffsetM edp
return edp
_ -> return dp
-- Start of debug printing
LayoutStartCol dOff <- getLayoutOffsetD
Expand Down
3 changes: 2 additions & 1 deletion tests/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ tt' = do
-- mkParserTest libdir "ghc912" "Module.hs"
-- mkParserTest libdir "ghc912" "tests.hs"
-- mkParserTestMD libdir "ghc912" "Fff.hs"
mkParserTestMD libdir "transform" "AddLocalDecl5.hs"
-- mkParserTestMD libdir "transform" "AddLocalDecl5.hs"
mkParserTestBC libdir "transform" "AddLocalDecl5.hs"
-- mkParserTestMD libdir "ghc912" "Module.hs"
-- mkParserTestMD libdir "ghc912" "Operator.hs"
-- Needs GHC changes
Expand Down
1 change: 0 additions & 1 deletion tests/Test/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ noChange _libdir parsed = return parsed

changeBalanceComments :: Changer
changeBalanceComments _libdir top = do
-- let (GHC.L l p) = makeDeltaAst top
let (GHC.L l p) = top
let decls0 = GHC.hsmodDecls p
decls = balanceCommentsList decls0
Expand Down
8 changes: 8 additions & 0 deletions tests/examples/ghc912/Fff.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
yes p1 p2
| g1 = e1


foo = 3
where
yes p1 p2
| g1 = e1
54 changes: 54 additions & 0 deletions tests/examples/ghc912/Operator.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module Operator where

main :: IO ()
main = do
print $ 3 + 4
-- lets make sure
print $ foo ||
-- that comments end up in the right place
bar ||
baz &&
-- even this one
quux

-- lets also make sure
print $ foo
-- that these comments end up in the right place
|| bar
|| baz
-- even when the operator is leading
&& quux

return ({- comment -} x >= 1 || y >= 2)

print $ foo || bar
print $ foo || bar
print $ foo || bar
print $ {- comment here -} foo || bar
print $ foo {- comment here -} || bar
print $ foo || {- comment here -} bar
print $ foo || bar {- comment here -}

print $ foo || bar
print $ foo || bar

{-# RULES "print" forall x. putStrLn $ show $ x = print $ x #-}

f :: Int -> Bool
f x = x == 2

g :: Int -> Bool
g y = (y == 2) /= False

roundtrip :: IO [a]
roundtrip = return $ mconcat
[ timeToText $ time_enrolled - mod time_enrolled t
, ":"
]

-- Ensure local fixity declarations are handled properly
(.@@@) :: (a -> b) -> a -> b
f .@@@ x = f x

infixr 0 .@@@
{-# RULES "printAt" forall x. putStrLn .@@@ show .@@@ x = print $ x #-}

0 comments on commit a2e9ac2

Please sign in to comment.