diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-14 00:10:19 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-18 12:46:05 +0200 |
commit | e02beb1849416f5af8ec56acd17f37b5dc7c24a4 (patch) | |
tree | 123025307704c72dbed0a92c6703118c64591c66 | |
parent | 9bb05785a7ac3ea8d2589173505891e75163d66b (diff) | |
download | haskell-e02beb1849416f5af8ec56acd17f37b5dc7c24a4.tar.gz |
Driver: `ghc ../Test` (without file extension) should work
Reviewed by: bgamari
Differential Revision: https://phabricator.haskell.org/D2331
GHC Trac Issues: #12192
-rw-r--r-- | compiler/main/DriverPhases.hs | 2 | ||||
-rw-r--r-- | ghc/Main.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/driver/T12192.hs | 1 | ||||
-rw-r--r-- | 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 84eee1bfb6..650bb15269 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 1a6cbebe3c..4870ce4d22 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 0000000000..ce6da0245b --- /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 54c84bca36..36ba99b6ef 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)']) |