[commit: ghc] master: Driver: `ghc ../Test` (without file extension) should work (e02beb1)

git at git.haskell.org git at git.haskell.org
Sat Jun 18 10:48:48 UTC 2016


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

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

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

commit e02beb1849416f5af8ec56acd17f37b5dc7c24a4
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Tue Jun 14 00:10:19 2016 +0200

    Driver: `ghc ../Test` (without file extension) should work
    
    Reviewed by: bgamari
    
    Differential Revision: https://phabricator.haskell.org/D2331
    
    GHC Trac Issues: #12192


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

e02beb1849416f5af8ec56acd17f37b5dc7c24a4
 compiler/main/DriverPhases.hs    | 2 +-
 ghc/Main.hs                      | 4 ++--
 testsuite/tests/driver/T12192.hs | 1 +
 testsuite/tests/driver/all.T     | 3 +++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
index 84eee1b..650bb15 100644
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@ -348,7 +348,7 @@ isSourceSuffix suff  = isHaskellishSuffix suff || isCishSuffix suff
 --         specified suffix is a Haskell one.
 isHaskellishTarget :: (String, Maybe Phase) -> Bool
 isHaskellishTarget (f,Nothing) =
-  looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f
+  looksLikeModuleName f || isHaskellSrcFilename f || not (hasExtension f)
 isHaskellishTarget (_,Just phase) =
   phase `notElem` [ As True, As False, Cc, Cobjc, Cobjcxx, CmmCpp, Cmm
                   , StopLn]
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 1a6cbeb..4870ce4 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -306,7 +306,7 @@ partition_args (arg:args) srcs objs
          the flag parser, and we want them to generate errors later in
          checkOptions, so we class them as source files (#5921)
 
-       - and finally we consider everything not containing a '.' to be
+       - and finally we consider everything without an extension to be
          a comp manager input, as shorthand for a .hs or .lhs filename.
 
       Everything else is considered to be a linker object, and passed
@@ -316,7 +316,7 @@ looks_like_an_input :: String -> Bool
 looks_like_an_input m =  isSourceFilename m
                       || looksLikeModuleName m
                       || "-" `isPrefixOf` m
-                      || '.' `notElem` m
+                      || not (hasExtension m)
 
 -- -----------------------------------------------------------------------------
 -- Option sanity checks
diff --git a/testsuite/tests/driver/T12192.hs b/testsuite/tests/driver/T12192.hs
new file mode 100644
index 0000000..ce6da02
--- /dev/null
+++ b/testsuite/tests/driver/T12192.hs
@@ -0,0 +1 @@
+module T12192 where
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 54c84bc..36ba99b 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -488,3 +488,6 @@ test('T12135',
       extra_clean(['T12135.o', 'T12135.hi', 'T12135', 'T12135a/T12135.h', 'T12135b/T12135.h'])],
      run_command,
      ['$MAKE -s --no-print-directory T12135'])
+
+test('T12192', normal, run_command,
+     ['mkdir foo && (cd foo && {compiler} -v0 ../T12192)'])



More information about the ghc-commits mailing list