Hello community, here is the log from the commit of package ghc-haskell-tools-debug for openSUSE:Factory checked in at 2017-08-31 20:56:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-haskell-tools-debug (Old) and /work/SRC/openSUSE:Factory/.ghc-haskell-tools-debug.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-haskell-tools-debug" Thu Aug 31 20:56:00 2017 rev:2 rq:513372 version:0.8.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-haskell-tools-debug/ghc-haskell-tools-debug.changes 2017-04-12 18:06:45.078258134 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-haskell-tools-debug.new/ghc-haskell-tools-debug.changes 2017-08-31 20:56:04.310718224 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:06:41 UTC 2017 - psimons@suse.com + +- Update to version 0.8.0.0. + +------------------------------------------------------------------- Old: ---- haskell-tools-debug-0.5.0.0.tar.gz New: ---- haskell-tools-debug-0.8.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-haskell-tools-debug.spec ++++++ --- /var/tmp/diff_new_pack.78zVec/_old 2017-08-31 20:56:05.278582236 +0200 +++ /var/tmp/diff_new_pack.78zVec/_new 2017-08-31 20:56:05.282581674 +0200 @@ -18,7 +18,7 @@ %global pkg_name haskell-tools-debug Name: ghc-%{pkg_name} -Version: 0.5.0.0 +Version: 0.8.0.0 Release: 0 Summary: Debugging Tools for Haskell-tools License: BSD-3-Clause @@ -27,6 +27,7 @@ Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: chrpath BuildRequires: ghc-Cabal-devel +BuildRequires: ghc-filepath-devel BuildRequires: ghc-ghc-devel BuildRequires: ghc-ghc-paths-devel BuildRequires: ghc-haskell-tools-ast-devel @@ -35,6 +36,7 @@ BuildRequires: ghc-haskell-tools-refactor-devel BuildRequires: ghc-references-devel BuildRequires: ghc-rpm-macros +BuildRequires: ghc-template-haskell-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ haskell-tools-debug-0.5.0.0.tar.gz -> haskell-tools-debug-0.8.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-debug-0.5.0.0/Language/Haskell/Tools/Debug.hs new/haskell-tools-debug-0.8.0.0/Language/Haskell/Tools/Debug.hs --- old/haskell-tools-debug-0.5.0.0/Language/Haskell/Tools/Debug.hs 2017-01-31 20:47:45.000000000 +0100 +++ new/haskell-tools-debug-0.8.0.0/Language/Haskell/Tools/Debug.hs 2017-06-07 10:55:20.000000000 +0200 @@ -1,14 +1,21 @@ {-# LANGUAGE StandaloneDeriving , DeriveGeneric + , LambdaCase #-} module Language.Haskell.Tools.Debug where +import Control.Monad +import Control.Reference import Control.Monad.IO.Class (MonadIO(..)) import Data.Maybe (Maybe(..), fromJust) import GHC.Generics (Generic(..)) +import System.FilePath (pathSeparator, (</>), (<.>)) +import DynFlags (xopt) import GHC hiding (loadModule) import GHC.Paths ( libdir ) +import Language.Haskell.TH.LanguageExtensions (Extension(..)) +import StringBuffer (hGetStringBuffer) import Language.Haskell.Tools.AST (NodeInfo(..)) import Language.Haskell.Tools.AST.FromGHC @@ -17,24 +24,30 @@ import Language.Haskell.Tools.RangeDebug (srcInfoDebug) import Language.Haskell.Tools.RangeDebug.Instances () import Language.Haskell.Tools.Refactor.Perform (performCommand, readCommand) +import Language.Haskell.Tools.Refactor.RefactorBase import Language.Haskell.Tools.Refactor.Prepare -import Language.Haskell.Tools.Refactor.RefactorBase (RefactorChange(..), IsBoot(..), SourceFileKey(..)) +import Language.Haskell.Tools.Refactor.RefactorBase (RefactorChange(..), SourceFileKey(..)) import Language.Haskell.Tools.Transform -- | Should be only used for testing demoRefactor :: String -> String -> [String] -> String -> IO () -demoRefactor command workingDir args moduleName = +demoRefactor command workingDir args moduleName = runGhc (Just libdir) $ do initGhcFlags _ <- useFlags args useDirs [workingDir] - modSum <- loadModule workingDir moduleName + ms <- loadModule workingDir moduleName + let modSum = ms { ms_hspp_opts = (ms_hspp_opts ms) { hscTarget = HscAsm, ghcLink = LinkInMemory } } p <- parseModule modSum t <- typecheckModule p - + let annots = pm_annotations $ tm_parsed_module t + hasCPP = Cpp `xopt` ms_hspp_opts modSum - liftIO $ putStrLn $ show annots + liftIO $ putStrLn "=========== tokens:" + liftIO $ putStrLn $ show (fst annots) + liftIO $ putStrLn "=========== comments:" + liftIO $ putStrLn $ show (snd annots) liftIO $ putStrLn "=========== parsed source:" liftIO $ putStrLn $ show (pm_parsed_source p) liftIO $ putStrLn "=========== renamed source:" @@ -49,34 +62,45 @@ transformed <- addTypeInfos (typecheckedSource t) =<< (runTrf (fst annots) (getPragmaComments $ snd annots) $ trfModuleRename modSum parseTrf (fromJust $ tm_renamed_source t) (pm_parsed_source p)) liftIO $ putStrLn $ srcInfoDebug transformed liftIO $ putStrLn "=========== ranges fixed:" - let commented = fixRanges $ placeComments (getNormalComments $ snd annots) transformed + sourceOrigin <- if hasCPP then liftIO $ hGetStringBuffer (workingDir </> map (\case '.' -> pathSeparator; c -> c) moduleName <.> "hs") + else return (fromJust $ ms_hspp_buf $ pm_mod_summary p) + let commented = fixRanges $ placeComments (fst annots) (getNormalComments $ snd annots) $ fixMainRange sourceOrigin transformed liftIO $ putStrLn $ srcInfoDebug commented liftIO $ putStrLn "=========== cut up:" let cutUp = cutUpRanges commented liftIO $ putStrLn $ srcInfoDebug cutUp liftIO $ putStrLn $ show $ getLocIndices cutUp - liftIO $ putStrLn $ show $ mapLocIndices (fromJust $ ms_hspp_buf $ pm_mod_summary p) (getLocIndices cutUp) + + liftIO $ putStrLn $ show $ mapLocIndices sourceOrigin (getLocIndices cutUp) liftIO $ putStrLn "=========== sourced:" - let sourced = rangeToSource (fromJust $ ms_hspp_buf $ pm_mod_summary p) cutUp + let sourced = (if hasCPP then extractStayingElems else id) $ rangeToSource sourceOrigin cutUp liftIO $ putStrLn $ srcInfoDebug sourced liftIO $ putStrLn "=========== pretty printed:" let prettyPrinted = prettyPrint sourced liftIO $ putStrLn prettyPrinted - transformed <- performCommand (readCommand command) ((SourceFileKey NormalHs moduleName), sourced) [] - case transformed of - Right [ContentChanged (_, correctlyTransformed)] -> do - liftIO $ putStrLn "=========== transformed AST:" - liftIO $ putStrLn $ srcInfoDebug correctlyTransformed - liftIO $ putStrLn "=========== transformed & prettyprinted:" - let prettyPrinted = prettyPrint correctlyTransformed - liftIO $ putStrLn prettyPrinted - liftIO $ putStrLn "===========" - -- TODO: implement - Right _ -> error "The output shoud be one module changed" + transformed <- performCommand (either error id $ readCommand command) ((SourceFileKey (moduleSourceFile moduleName) moduleName), sourced) [] + case transformed of + Right changes -> do + forM_ changes $ \case + ContentChanged (mod, correctlyTransformed) -> do + liftIO $ putStrLn $ "=========== transformed AST (" ++ (mod ^. sfkModuleName) ++ "):" + liftIO $ putStrLn $ srcInfoDebug correctlyTransformed + liftIO $ putStrLn $ "=========== transformed & prettyprinted (" ++ (mod ^. sfkModuleName) ++ "):" + let prettyPrinted = prettyPrint correctlyTransformed + liftIO $ putStrLn prettyPrinted + liftIO $ putStrLn "===========" + ModuleRemoved mod -> do + liftIO $ putStrLn $ "=========== module removed: " ++ mod + ModuleCreated mod cont _ -> do + liftIO $ putStrLn $ "=========== created AST (" ++ mod ++ "):" + liftIO $ putStrLn $ srcInfoDebug cont + liftIO $ putStrLn $ "=========== created & prettyprinted (" ++ mod ++ "):" + let prettyPrinted = prettyPrint cont + liftIO $ putStrLn prettyPrinted Left transformProblem -> do liftIO $ putStrLn "===========" liftIO $ putStrLn transformProblem liftIO $ putStrLn "===========" - + deriving instance Generic SrcSpan deriving instance Generic (NodeInfo sema src) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-debug-0.5.0.0/Language/Haskell/Tools/RangeDebug/Instances.hs new/haskell-tools-debug-0.8.0.0/Language/Haskell/Tools/RangeDebug/Instances.hs --- old/haskell-tools-debug-0.5.0.0/Language/Haskell/Tools/RangeDebug/Instances.hs 2017-01-31 20:47:45.000000000 +0100 +++ new/haskell-tools-debug-0.8.0.0/Language/Haskell/Tools/RangeDebug/Instances.hs 2017-05-17 11:30:04.000000000 +0200 @@ -3,7 +3,7 @@ , MultiParamTypeClasses , StandaloneDeriving , DeriveGeneric - , UndecidableInstances + , UndecidableInstances #-} module Language.Haskell.Tools.RangeDebug.Instances where @@ -17,16 +17,16 @@ -- Annotations instance TreeDebug e dom st => TreeDebug (Ann e) dom st where treeDebug' i (Ann a e) = identLine i ++ show (a ^. sourceInfo) ++ " " ++ take 40 (show e) ++ "..." ++ treeDebug' (i+1) e - + identLine :: Int -> String identLine i = "\n" ++ replicate (i*2) ' ' - + instance TreeDebug e dom st => TreeDebug (AnnListG e) dom st where - treeDebug' i (AnnListG a ls) = identLine i ++ show (a ^. sourceInfo) ++ " <*>" ++ concatMap (treeDebug' (i + 1)) ls - + treeDebug' i (AnnListG a ls) = identLine i ++ show (a ^. sourceInfo) ++ " <*>" ++ concatMap (treeDebug' (i + 1)) ls + instance TreeDebug e dom st => TreeDebug (AnnMaybeG e) dom st where treeDebug' i (AnnMaybeG a e) = identLine i ++ show (a ^. sourceInfo) ++ " <?>" ++ maybe "" (\e -> treeDebug' (i + 1) e) e - + -- Modules instance (SourceInfo st, Domain dom) => TreeDebug UModule dom st instance (SourceInfo st, Domain dom) => TreeDebug UModuleHead dom st @@ -85,6 +85,7 @@ instance (SourceInfo st, Domain dom) => TreeDebug UBracket dom st instance (SourceInfo st, Domain dom) => TreeDebug UTopLevelPragma dom st instance (SourceInfo st, Domain dom) => TreeDebug URule dom st +instance (SourceInfo st, Domain dom) => TreeDebug URuleVar dom st instance (SourceInfo st, Domain dom) => TreeDebug UAnnotationSubject dom st instance (SourceInfo st, Domain dom) => TreeDebug UMinimalFormula dom st instance (SourceInfo st, Domain dom) => TreeDebug UExprPragma dom st @@ -113,6 +114,7 @@ instance (SourceInfo st, Domain dom) => TreeDebug ULanguageExtension dom st instance (SourceInfo st, Domain dom) => TreeDebug UMatchLhs dom st instance (SourceInfo st, Domain dom) => TreeDebug UInlinePragma dom st +instance (SourceInfo st, Domain dom) => TreeDebug USpecializePragma dom st -- ULiteral instance (SourceInfo st, Domain dom) => TreeDebug ULiteral dom st @@ -138,4 +140,4 @@ instance (SourceInfo st, Domain dom) => TreeDebug LineNumber dom st instance (SourceInfo st, Domain dom) => TreeDebug UPhaseControl dom st instance (SourceInfo st, Domain dom) => TreeDebug PhaseNumber dom st -instance (SourceInfo st, Domain dom) => TreeDebug PhaseInvert dom st \ No newline at end of file +instance (SourceInfo st, Domain dom) => TreeDebug PhaseInvert dom st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-debug-0.5.0.0/haskell-tools-debug.cabal new/haskell-tools-debug-0.8.0.0/haskell-tools-debug.cabal --- old/haskell-tools-debug-0.5.0.0/haskell-tools-debug.cabal 2017-01-31 20:56:03.000000000 +0100 +++ new/haskell-tools-debug-0.8.0.0/haskell-tools-debug.cabal 2017-07-01 12:39:07.000000000 +0200 @@ -1,5 +1,5 @@ name: haskell-tools-debug -version: 0.5.0.0 +version: 0.8.0.0 synopsis: Debugging Tools for Haskell-tools description: Debugging Tools for Haskell-tools homepage: https://github.com/haskell-tools/haskell-tools @@ -12,24 +12,25 @@ cabal-version: >=1.10 library - ghc-options: -O2 exposed-modules: Language.Haskell.Tools.Debug other-modules: Language.Haskell.Tools.DebugGhcAST , Language.Haskell.Tools.RangeDebug , Language.Haskell.Tools.RangeDebug.Instances build-depends: base >= 4.9 && < 4.10 + , filepath >= 1.4 && < 1.5 + , template-haskell >= 2.11 && < 2.12 , references >= 0.3 && < 0.4 , ghc >= 8.0 && < 8.1 , ghc-paths >= 0.1 && < 0.2 - , haskell-tools-ast >= 0.5 && < 0.6 - , haskell-tools-backend-ghc >= 0.5 && < 0.6 - , haskell-tools-refactor >= 0.5 && < 0.6 - , haskell-tools-prettyprint >= 0.5 && < 0.6 + , haskell-tools-ast >= 0.8 && < 0.9 + , haskell-tools-backend-ghc >= 0.8 && < 0.9 + , haskell-tools-refactor >= 0.8 && < 0.9 + , haskell-tools-prettyprint >= 0.8 && < 0.9 default-language: Haskell2010 - + executable ht-debug build-depends: base >= 4.9 && < 5.0 - , haskell-tools-debug >= 0.5 && < 0.6 + , haskell-tools-debug >= 0.8 && < 0.9 hs-source-dirs: exe main-is: Main.hs - default-language: Haskell2010 \ No newline at end of file + default-language: Haskell2010