[commit: ghc] master: Fixes ghci :unset -X<ext> so that it doesn't fail to reverse option. (fixes trac #9293) (3e4f49b)

git at git.haskell.org git at git.haskell.org
Fri Nov 21 17:31:35 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3e4f49b04e6e97256b4d34221e209e1051bf06ae/ghc

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

commit 3e4f49b04e6e97256b4d34221e209e1051bf06ae
Author: Muhaimin Ahsan <leroux at fezrev.com>
Date:   Fri Nov 21 11:31:44 2014 -0600

    Fixes ghci :unset -X<ext> so that it doesn't fail to reverse option. (fixes trac #9293)
    
    Summary: ghci unset could not reverse language extensions.
    
    Reviewers: hvr, thomie, austin
    
    Reviewed By: hvr, thomie, austin
    
    Subscribers: goldfire, hvr, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D516
    
    GHC Trac Issues: #9293


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

3e4f49b04e6e97256b4d34221e209e1051bf06ae
 ghc/InteractiveUI.hs                                          | 1 +
 testsuite/tests/ghci/scripts/{ghci057.hs => T9293.hs}         | 1 -
 testsuite/tests/ghci/scripts/{ghci057.script => T9293.script} | 2 +-
 testsuite/tests/ghci/scripts/{ghci057.stderr => T9293.stderr} | 0
 testsuite/tests/ghci/scripts/{ghci057.stdout => T9293.stdout} | 0
 testsuite/tests/ghci/scripts/all.T                            | 1 +
 testsuite/tests/safeHaskell/ghci/p12.stderr                   | 4 ++--
 testsuite/tests/safeHaskell/ghci/p5.stderr                    | 6 +++---
 8 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index f5a1bbe..7fdda0b 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -2182,6 +2182,7 @@ unsetOptions str
            ]
 
          no_flag ('-':'f':rest) = return ("-fno-" ++ rest)
+         no_flag ('-':'X':rest) = return ("-XNo" ++ rest)
          no_flag f = throwGhcException (ProgramError ("don't know how to reverse " ++ f))
 
      in if (not (null rest3))
diff --git a/testsuite/tests/ghci/scripts/ghci057.hs b/testsuite/tests/ghci/scripts/T9293.hs
similarity index 97%
copy from testsuite/tests/ghci/scripts/ghci057.hs
copy to testsuite/tests/ghci/scripts/T9293.hs
index 2a6b836..f7329c9 100644
--- a/testsuite/tests/ghci/scripts/ghci057.hs
+++ b/testsuite/tests/ghci/scripts/T9293.hs
@@ -1,4 +1,3 @@
 module Test where
 data T a where
   C :: T Int
-
diff --git a/testsuite/tests/ghci/scripts/ghci057.script b/testsuite/tests/ghci/scripts/T9293.script
similarity index 96%
copy from testsuite/tests/ghci/scripts/ghci057.script
copy to testsuite/tests/ghci/scripts/T9293.script
index 547fce5..c2fbf46 100644
--- a/testsuite/tests/ghci/scripts/ghci057.script
+++ b/testsuite/tests/ghci/scripts/T9293.script
@@ -9,7 +9,7 @@ data T a where C :: T Int
 putStrLn "Should work, GADTs is in force from :set"
 :load ghci057.hs
 
-:set -XNoGADTs
+:unset -XGADTs
 :set
 
 putStrLn "Should fail, GADTs is now disabled"
diff --git a/testsuite/tests/ghci/scripts/ghci057.stderr b/testsuite/tests/ghci/scripts/T9293.stderr
similarity index 100%
copy from testsuite/tests/ghci/scripts/ghci057.stderr
copy to testsuite/tests/ghci/scripts/T9293.stderr
diff --git a/testsuite/tests/ghci/scripts/ghci057.stdout b/testsuite/tests/ghci/scripts/T9293.stdout
similarity index 100%
copy from testsuite/tests/ghci/scripts/ghci057.stdout
copy to testsuite/tests/ghci/scripts/T9293.stdout
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 624f431..12bfebf 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -190,3 +190,4 @@ test('T9181', normal, ghci_script, ['T9181.script'])
 test('T9086b', normal, ghci_script, ['T9086b.script'])
 test('T9140', combined_output, ghci_script, ['T9140.script'])
 test('T9658', normal, ghci_script, ['T9658.script'])
+test('T9293', normal, ghci_script_without_flag('-fno-warn-tabs'), ['T9293.script'])
diff --git a/testsuite/tests/safeHaskell/ghci/p12.stderr b/testsuite/tests/safeHaskell/ghci/p12.stderr
index fc43305..3b259c3 100644
--- a/testsuite/tests/safeHaskell/ghci/p12.stderr
+++ b/testsuite/tests/safeHaskell/ghci/p12.stderr
@@ -1,7 +1,7 @@
-don't know how to reverse -XSafe
+Some flags have not been recognized: -XNoSafe
 Some flags have not been recognized: -fno-package-trust
 
 <no location info>:
     Data.ByteString: Can't be safely imported!
-    The package (bytestring-0.10.1.0) the module resides in isn't trusted.
+    The package (bytestring-0.10.5.0) the module resides in isn't trusted.
 
diff --git a/testsuite/tests/safeHaskell/ghci/p5.stderr b/testsuite/tests/safeHaskell/ghci/p5.stderr
index 3f649f7..7e70988 100644
--- a/testsuite/tests/safeHaskell/ghci/p5.stderr
+++ b/testsuite/tests/safeHaskell/ghci/p5.stderr
@@ -1,7 +1,7 @@
-don't know how to reverse -XSafe
+Some flags have not been recognized: -XNoSafe
 ghc-stage2: <no location info>: Incompatible Safe Haskell flags! (Safe, Trustworthy)
 Usage: For basic information, try the `--help' option.
-don't know how to reverse -XTrustworthy
+Some flags have not been recognized: -XNoTrustworthy
 ghc-stage2: <no location info>: Incompatible Safe Haskell flags! (Safe, Unsafe)
 Usage: For basic information, try the `--help' option.
-don't know how to reverse -XUnsafe
+Some flags have not been recognized: -XNoUnsafe



More information about the ghc-commits mailing list