-
Notifications
You must be signed in to change notification settings - Fork 175
Merge ghc-imported-from into ghc-mod #810
Changes from 6 commits
2485221
5126454
4e4f69c
bd62eb0
5d26b71
6339f63
875b513
ae39594
47becac
ffc755b
cfb9693
07e4be3
af4e620
1736e24
d9c9477
7b8d5a7
7fa7b12
1557ef1
d276260
7106525
048eaac
13e5cda
f52077c
50a52d2
1339dc5
ec38b27
84579ef
b94f2f4
6b11e9d
ae4badb
fb1c146
fa1417a
40e3daf
b1c1b2a
9eb0cc8
6f83fab
2edda72
704cff6
cdbe0ef
e2f6092
f6ba25b
0961feb
ea1d4a0
c37907c
e413cea
5eefa23
122cfd5
f3c9268
fc02ddc
a9fa573
4897f16
2be2742
8d4d2c7
21a81b2
e36a3c3
83f27c6
c995e15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,7 @@ Library | |
Language.Haskell.GhcMod.Flag | ||
Language.Haskell.GhcMod.Gap | ||
Language.Haskell.GhcMod.GhcPkg | ||
Language.Haskell.GhcMod.ImportedFrom | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "H" comes before "I", I like to keep this list (semi) sorted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
Language.Haskell.GhcMod.HomeModuleGraph | ||
Language.Haskell.GhcMod.Info | ||
Language.Haskell.GhcMod.Lang | ||
|
@@ -174,9 +175,10 @@ Library | |
, bytestring < 0.11 | ||
, binary < 0.9 && >= 0.5.1.0 | ||
, containers < 0.6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't remove the bounds please :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted ghc-mod.cabal:
|
||
, cabal-helper < 0.8 && >= 0.7.1.0 | ||
, cabal-helper | ||
, deepseq < 1.5 | ||
, directory < 1.3 | ||
, exceptions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upper bounds please. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now
|
||
, filepath < 1.5 | ||
, ghc < 8.2 && >= 7.6 | ||
, ghc-paths < 0.2 | ||
|
@@ -193,6 +195,9 @@ Library | |
, transformers-base < 0.5 | ||
, mtl < 2.3 && >= 2.0 | ||
, monad-control < 1.1 && >= 1 | ||
, parsec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upper bounds too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
, process | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate depdency, thats already declared above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed. |
||
, process-streaming | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem to be used for much anything important. I'd rather not depend on it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed; not used anymore. |
||
, split < 0.3 | ||
, haskell-src-exts < 1.18 | ||
, text < 1.3 | ||
|
@@ -209,6 +214,12 @@ Library | |
if impl(ghc >= 8.0) | ||
Build-Depends: ghc-boot | ||
|
||
if impl(ghc >= 8.0) | ||
Build-Depends: haddock-api >= 2.17.2 | ||
|
||
if impl(ghc >=7.10 && < 7.12) | ||
Build-Depends: haddock-api <= 2.16.1 | ||
|
||
Executable ghc-mod | ||
Default-Language: Haskell2010 | ||
Main-Is: GHCMod.hs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{-# LANGUAGE CPP #-} | ||
module ImportedFromSpec where | ||
|
||
import Control.Applicative | ||
import Language.Haskell.GhcMod | ||
import System.FilePath | ||
import Test.Hspec | ||
import TestUtils | ||
import Prelude | ||
|
||
import Language.Haskell.GhcMod.Utils | ||
|
||
--------------------------------------------------- | ||
import Language.Haskell.GhcMod.ImportedFrom | ||
import System.FilePath() | ||
import Test.Hspec | ||
|
||
import Control.Exception as E | ||
import System.Directory | ||
--------------------------------------------------- | ||
|
||
isRight :: forall a b. Either a b -> Bool | ||
isRight = either (const False) (const True) | ||
|
||
spec :: Spec | ||
spec = do | ||
describe "checkImportedFrom" $ do | ||
it "can look up Maybe" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 11 11 (Expression "Maybe") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up Just" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 12 7 (Expression "Just") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up Just" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 16 10 (Expression "Just") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up String" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 20 14 (Expression "String") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up Int" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 22 23 (Expression "Int") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up DL.length" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 23 5 (Expression "DL.length") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up print" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 25 8 (Expression "print") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up DM.fromList" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 27 5 (Expression "DM.fromList") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up Safe.headMay" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 29 6 (Expression "Safe.headMay") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up Foo.Bar.length" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom01.hs" 34 17 (Expression "Foo.Bar.length") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up map" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom02.hs" 14 5 (Expression "map") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up head" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom02.hs" 16 5 (Expression "head") | ||
res `shouldSatisfy` isRight | ||
|
||
it "can look up when" $ do | ||
withDirectory_ "test/data/imported-from" $ do | ||
(res, _) <- runGmOutDef $ runGhcModT defaultOptions $ importedFrom "ImportedFrom03.hs" 15 5 (Expression "when") | ||
res `shouldSatisfy` isRight |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- ImportedFrom01.hs | ||
|
||
module ImportedFrom01 where | ||
|
||
import Data.Maybe | ||
import qualified Data.List as DL | ||
import qualified Data.Map as DM | ||
import qualified Safe | ||
import qualified Data.List as Foo.Bar | ||
|
||
f :: a -> Maybe a | ||
f x = Just x | ||
|
||
g :: IO () | ||
g = do | ||
let (Just _, _) = (Just 3, Just 4) | ||
|
||
return () | ||
|
||
s = "boo" :: String | ||
s' = head s | ||
t = Just 100 :: Maybe Int | ||
r = DL.length [1, 2, 3] | ||
|
||
main = print "Hello, World!" | ||
|
||
h = DM.fromList [("x", "y")] | ||
|
||
sh = Safe.headMay [] | ||
|
||
i = 3 :: Int | ||
i' = 3 :: Integer | ||
|
||
len = Foo.Bar.length |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- ImportedFrom02.hs | ||
|
||
module ImportedFrom02 where | ||
|
||
import Data.List hiding (map) | ||
import System.Environment (getArgs) | ||
import qualified Safe | ||
|
||
|
||
|
||
|
||
|
||
|
||
m = map (+1) [1, 2, 3] | ||
|
||
h = head [1, 2, 3] | ||
|
||
h' = Safe.headMay [] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- ImportedFrom03.hs | ||
|
||
module ImportedFrom03 where | ||
|
||
import Control.Monad ( forM_, liftM, filterM, when, unless ) | ||
import Control.Monad.Identity | ||
import Control.Monad.Reader | ||
import Control.Monad.Trans.Writer.Lazy | ||
|
||
|
||
|
||
|
||
|
||
main = do | ||
when True $ do print "hah" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're backpatching cabal-helper to <0.7, please don't :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted this one, sorry for the weirdness.