[commit: ghc] master: Deprecate Data.Version.versionTags (#2496) (137b331)

git at git.haskell.org git at git.haskell.org
Fri Nov 21 23:10:20 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/137b33133f49a994e5d147c5b30a8fcfc610eada/ghc

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

commit 137b33133f49a994e5d147c5b30a8fcfc610eada
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Sat Nov 22 00:03:19 2014 +0100

    Deprecate Data.Version.versionTags (#2496)
    
    The library submission was accepted:
    
      http://www.haskell.org/pipermail/libraries/2014-September/023777.html
    
    The T5892ab testcases were changed to use `Data.Tree` instead of `Data.Version`
    
    Reviewed By: ekmett
    
    Differential Revision: https://phabricator.haskell.org/D395


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

137b33133f49a994e5d147c5b30a8fcfc610eada
 libraries/base/Data/Version.hs                   |  2 ++
 libraries/base/System/Info.hs                    |  2 +-
 testsuite/tests/rename/should_fail/T5892a.hs     | 12 ++++++------
 testsuite/tests/rename/should_fail/T5892a.stderr |  8 ++++----
 testsuite/tests/rename/should_fail/T5892b.hs     | 12 ++++++------
 testsuite/tests/rename/should_fail/T5892b.stderr |  4 +---
 testsuite/tests/rename/should_fail/all.T         |  4 ++--
 utils/ghc-pkg/Main.hs                            |  2 +-
 8 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/libraries/base/Data/Version.hs b/libraries/base/Data/Version.hs
index 8a0f9c8..3761d81 100644
--- a/libraries/base/Data/Version.hs
+++ b/libraries/base/Data/Version.hs
@@ -92,6 +92,8 @@ data Version =
                 -- on the entity that this version applies to.
         }
   deriving (Read,Show,Typeable)
+{-# DEPRECATED versionTags "See GHC ticket #2496" #-}
+-- TODO. Remove all references to versionTags in GHC 7.12 release.
 
 instance Eq Version where
   v1 == v2  =  versionBranch v1 == versionBranch v2
diff --git a/libraries/base/System/Info.hs b/libraries/base/System/Info.hs
index 1791cdb..c345cf9 100644
--- a/libraries/base/System/Info.hs
+++ b/libraries/base/System/Info.hs
@@ -29,7 +29,7 @@ import Data.Version
 -- | The version of 'compilerName' with which the program was compiled
 -- or is being interpreted.
 compilerVersion :: Version
-compilerVersion = Version {versionBranch=[major, minor], versionTags=[]}
+compilerVersion = Version [major, minor] []
   where (major, minor) = compilerVersionRaw `divMod` 100
 
 #include "ghcplatform.h"
diff --git a/testsuite/tests/rename/should_fail/T5892a.hs b/testsuite/tests/rename/should_fail/T5892a.hs
index c0ad989..13d7c3f 100644
--- a/testsuite/tests/rename/should_fail/T5892a.hs
+++ b/testsuite/tests/rename/should_fail/T5892a.hs
@@ -3,10 +3,10 @@
 
 module T5892a where
 
-import Data.Version ( Version( Version, versionBranch ))
--- Not importing its field: versionTags
+import Data.Tree ( Tree( Node, rootLabel ))
+-- Not importing field 'subForest'
 
-foo :: Version -> Version
-foo (Version {..}) -- Pattern match does not bind versionTags 
-  = let versionBranch = []
-    in Version {..}   -- Hence warning here
+foo :: Tree [Int] -> Tree [Int]
+foo (Node {..}) -- Pattern match does not bind 'subForest'
+  = let rootLabel = []
+    in Node {..}   -- Hence warning here
diff --git a/testsuite/tests/rename/should_fail/T5892a.stderr b/testsuite/tests/rename/should_fail/T5892a.stderr
index 1600d8f..5e9e4d3 100644
--- a/testsuite/tests/rename/should_fail/T5892a.stderr
+++ b/testsuite/tests/rename/should_fail/T5892a.stderr
@@ -1,10 +1,10 @@
 
 T5892a.hs:12:8: Warning:
-    Fields of ‘Version’ not initialised: Data.Version.versionTags
-    In the expression: Version {..}
-    In the expression: let versionBranch = [] in Version {..}
+    Fields of ‘Node’ not initialised: Data.Tree.subForest
+    In the expression: Node {..}
+    In the expression: let rootLabel = [] in Node {..}
     In an equation for ‘foo’:
-        foo (Version {..}) = let versionBranch = ... in Version {..}
+        foo (Node {..}) = let rootLabel = ... in Node {..}
 
 <no location info>: 
 Failing due to -Werror.
diff --git a/testsuite/tests/rename/should_fail/T5892b.hs b/testsuite/tests/rename/should_fail/T5892b.hs
index 6bcea27..737fd1f 100644
--- a/testsuite/tests/rename/should_fail/T5892b.hs
+++ b/testsuite/tests/rename/should_fail/T5892b.hs
@@ -1,11 +1,11 @@
 {-# LANGUAGE RecordWildCards #-}
 module T5892b where
 
-import Data.Version ( Version( Version, versionBranch ))
--- Not importing its field: versionTags
+import Data.Tree ( Tree( Node, rootLabel ))
+-- Not importing field 'subForest'
 
-Version{..} = Version [] []
--- Binds versionBranch only
+Node{..} = Node [] []
+-- Binds 'rootLabel' only
 
-foo = T5892b.versionBranch
-bar = T5892b.versionTags
+foo = T5892b.rootLabel
+bar = T5892b.subForest
diff --git a/testsuite/tests/rename/should_fail/T5892b.stderr b/testsuite/tests/rename/should_fail/T5892b.stderr
index 3d25973..994ea78 100644
--- a/testsuite/tests/rename/should_fail/T5892b.stderr
+++ b/testsuite/tests/rename/should_fail/T5892b.stderr
@@ -1,4 +1,2 @@
 
-T5892b.hs:11:7:
-    Not in scope: ‘T5892b.versionTags’
-    Perhaps you meant ‘T5892b.versionBranch’ (line 7)
+T5892b.hs:11:7: Not in scope: ‘T5892b.subForest’
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 4c61a8a..d81b743 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -98,8 +98,8 @@ test('T5657', normal, compile_fail, [''])
 test('T5745',
      extra_clean(['T5745a.hi', 'T5745a.o', 'T5745b.hi', 'T5745b.o']),
      multimod_compile_fail, ['T5745', '-v0'])
-test('T5892a', normal, compile_fail, [''])
-test('T5892b', normal, compile_fail, [''])
+test('T5892a', normal, compile_fail, ['-package containers'])
+test('T5892b', normal, compile_fail, ['-package containers'])
 test('T5951', normal, compile_fail, [''])
 test('T6060', normal, compile_fail, [''])
 test('T6148', normal, compile_fail, [''])
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index b1c7a4b..2b0b4cc 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -493,7 +493,7 @@ readPackageArg False str = Id `fmap` readGlobPkgId str
 
 -- globVersion means "all versions"
 globVersion :: Version
-globVersion = Version{ versionBranch=[], versionTags=["*"] }
+globVersion = Version [] ["*"]
 
 -- -----------------------------------------------------------------------------
 -- Package databases



More information about the ghc-commits mailing list