packages feed

buildwrapper 0.7.5 → 0.7.6

raw patch · 7 files changed

+147/−65 lines, 7 files

Files

buildwrapper.cabal view
@@ -1,5 +1,5 @@ name:           buildwrapper-version:        0.7.5+version:        0.7.6 cabal-version:  >= 1.8 build-type:     Simple license:        BSD3
src/Language/Haskell/BuildWrapper/API.hs view
@@ -250,6 +250,7 @@                 getSection :: Maybe [OutlineDef]  -> T.Text -> InFileSpan -> (T.Text,Bool)
                 getSection (Just ods) objName ifs =let
                         matchods=filter (\od-> ifsOverlap (odLoc od) ifs) ods
+                        -- most precise outline def
                         bestods=sortBy (\od1 od2->let
                                 l1=iflLine $ ifsStart $ odLoc od1
                                 l2=iflLine $ ifsStart $ odLoc od2
@@ -260,6 +261,17 @@                                         in compare c2 c1
                                    a-> a
                                 ) matchods
+                        -- widest outline def (function type...)
+                        widestods=sortBy (\od1 od2->let
+                                l1=iflLine $ ifsStart $ odLoc od1
+                                l2=iflLine $ ifsStart $ odLoc od2
+                                in case compare l1 l2 of
+                                   EQ -> let
+                                        c1=iflColumn $ ifsStart $ odLoc od1
+                                        c2=iflColumn $ ifsStart $ odLoc od2
+                                        in compare c1 c2
+                                   a-> a
+                                ) matchods        
                         in case bestods of
                                 (x:_)->let 
                                         def=odName x == objName && 
@@ -272,7 +284,7 @@                                                         (Type `elem` odType x)
                                                     && (iflColumn (ifsStart $ odLoc x) + 5 == iflColumn (ifsStart ifs))    
                                                     ))  
-                                       in (odName x,def)
+                                       in (odName $ head widestods,def)
                                 _->("",False)
                 getSection _ _ _=("",False)
 --                importToUsage :: ImportDef -> [Usage]
@@ -352,7 +364,8 @@         (bf,ns)<-getBuildFlags fp mccn
         tgt<-getTargetPath fp
         input<-liftIO $ preproc bf tgt
-        pr<- liftIO $ getHSEAST input (bfAst bf)
+        let pr= getHSEAST input (bfAst bf)
+        -- liftIO $ print pr
         return (Just pr,ns)
 
 -- | get GHC typechecked AST for source file
src/Language/Haskell/BuildWrapper/Base.hs view
@@ -263,7 +263,8 @@   ,odLoc        :: InFileSpan -- ^ span in source
   ,odChildren   :: [OutlineDef] -- ^ children (constructors...)
   ,odSignature  :: Maybe T.Text -- ^ type signature if any
-  ,odComment    :: Maybe T.Text -- ^ comment if any
+  ,odComment    :: Maybe T.Text -- ^ comment if any,
+  ,odStartLineComment    :: Maybe Int -- ^ comment start line if any,
   }
   deriving (Show,Read,Eq,Ord)
      
@@ -280,10 +281,10 @@         -> InFileSpan  -- ^ span in source
         -> [OutlineDef] -- ^ children (constructors...)
         -> OutlineDef
-mkOutlineDefWithChildren n t l c=  OutlineDef n t l c Nothing Nothing
+mkOutlineDefWithChildren n t l c=  OutlineDef n t l c Nothing Nothing Nothing 
      
 instance ToJSON OutlineDef where
-        toJSON (OutlineDef n tps l c ts d)=  object ["n" .= n , "t" .= map toJSON tps, "l" .= l, "c" .= map toJSON c, "s" .= ts, "d" .= d]
+        toJSON (OutlineDef n tps l c ts d sl)=  object ["n" .= n , "t" .= map toJSON tps, "l" .= l, "c" .= map toJSON c, "s" .= ts, "d" .= d, "sl" .= sl]
      
 instance FromJSON OutlineDef where
     parseJSON (Object v) =OutlineDef <$>
@@ -292,7 +293,8 @@                          v .: "l" <*>
                          v .: "c" <*>
                          v .:? "s" <*>
-                         v .:? "d"
+                         v .:? "d" <*>
+                         v .:? "sl"
     parseJSON _= mzero          
      
 -- | Lexer token
src/Language/Haskell/BuildWrapper/Cabal.hs view
@@ -290,7 +290,9 @@                                                 then Just (BWNote BWError "" (mkEmptySpan cf 1 1), [s2])
                                                 else 
                                                         let
-                                                                (loc,rest)=span (/= ':') s2
+                                                                (loc1,_)=span (/= '\'') s2
+                                                                (loc2,rest2)=span (/= ':') s2
+                                                                (loc,rest)=if (length loc1<length loc2) then (s2,"") else (loc2,rest2)
                                                                 (realloc,line,msg)=if null rest || ":"==rest
                                                                         then    (cf,"1",s2)
                                                                         else 
src/Language/Haskell/BuildWrapper/Src.hs view
@@ -21,11 +21,12 @@ import qualified Data.Text as T
 import Data.Char (isSpace)
 import Data.List (foldl', isPrefixOf)
+import Control.Monad.Trans.State.Lazy (State, get, evalState, put) 
 -- | get the AST
 getHSEAST :: String -- ^ input text
         -> [String] -- ^ options
-        -> IO (ParseResult (Module SrcSpanInfo, [Comment]))
+        -> (ParseResult (Module SrcSpanInfo, [Comment]))
 getHSEAST input options=do
         -- we add MultiParamTypeClasses because we may need it if the module we're parsing uses a type class with multiple parameters, which doesn't require the PRAGMA (only in the module DEFINING the type class)
         -- we add PatternGuards since GHC only gives a warning if not explicit
@@ -48,12 +49,12 @@                 else exts 
             -- fixities necessary (see http://trac.haskell.org/haskell-src-exts/ticket/189 and https://sourceforge.net/projects/eclipsefp/forums/forum/371922/topic/4808590)
             parseMode=defaultParseMode {extensions=extsFull,ignoreLinePragmas=False,ignoreLanguagePragmas=False,fixities = Just baseFixities} 
-        return $ parseFileContentsWithComments parseMode input
+        parseFileContentsWithComments parseMode input
 
 -- | get the ouline from the AST        
 getHSEOutline :: (Module SrcSpanInfo, [Comment]) -- ^ the commented AST
         -> [OutlineDef]
-getHSEOutline (Module _ _ _ _ decls,comments)=map addComment $ concatMap declOutline decls
+getHSEOutline (Module _ _ _ _ decls,comments)=evalState (mapM addComment $ concatMap declOutline decls) commentMap
         where 
                 declOutline :: Decl SrcSpanInfo -> [OutlineDef]
                 declOutline (DataFamDecl l _ h _) = [mkOutlineDef (headDecl h) [Data,Family] (makeSpan l)]
@@ -63,16 +64,16 @@                 --declOutline (GDataDecl l _ _ h cons _) = [OutlineDef (headDecl h) [Data] (makeSpan l) (map qualConDeclOutline cons)]
                 declOutline (TypeFamDecl l h _) = [mkOutlineDef (headDecl h) [Type,Family] (makeSpan l)]
                 declOutline (TypeInsDecl l t1 _) = [mkOutlineDef (typeDecl t1) [Type,Instance] (makeSpan l)] -- ++ " "++(typeDecl t2)
-                declOutline (TypeDecl l h t) = [OutlineDef (headDecl h) [Type] (makeSpan l) [] (Just $ typeDecl t) Nothing]
+                declOutline (TypeDecl l h t) = [OutlineDef (headDecl h) [Type] (makeSpan l) [] (Just $ typeDecl t) Nothing Nothing]
                 declOutline (ClassDecl l _ h _ cdecls) = [mkOutlineDefWithChildren (headDecl h) [Class] (makeSpan l) (maybe [] (concatMap classDecl) cdecls)]
                 declOutline (FunBind l matches) = let
                         n=matchDecl $ head matches
                         (ty,l2)=addTypeInfo n l
-                        in [OutlineDef n [Function] (makeSpan l2) [] ty Nothing]
+                        in [OutlineDef n [Function] (makeSpan l2) [] ty Nothing Nothing]
                 declOutline (PatBind l (PVar _ n) _ _ _)=let
                         nd=nameDecl n
                         (ty,l2)=addTypeInfo nd l
-                        in [OutlineDef nd [Function] (makeSpan l2)  [] ty Nothing]
+                        in [OutlineDef nd [Function] (makeSpan l2)  [] ty Nothing Nothing]
                 declOutline (InstDecl l _ h idecls)=[mkOutlineDefWithChildren (iheadDecl h) [Instance] (makeSpan l) (maybe [] (concatMap instDecl) idecls)]
                 declOutline (SpliceDecl l e)=[mkOutlineDef (spliceDecl e) [Splice] (makeSpan l)]
                 declOutline _ = []
@@ -142,22 +143,27 @@                                 Just (ty,ss2)->if srcSpanEndLine (srcInfoSpan ss2) == (srcSpanStartLine (srcInfoSpan ss1) - 1)
                                         then (Just ty,combSpanInfo ss2 ss1)
                                         else (Just ty,ss1)
-                commentMap:: DM.Map Int (Int,T.Text)
+                commentMap:: DM.Map Int (Int,Int,T.Text)
                 commentMap = foldl' buildCommentMap DM.empty comments     
-                addComment:: OutlineDef -> OutlineDef
-                addComment od=let
-                        st=iflLine $ ifsStart$ odLoc od
-                        -- search for comment before declaration (line above, same column)
-                        pl=DM.lookup (st-1) commentMap
-                        od2= case pl of
-                                Just (stc,t) | stc == iflColumn (ifsStart $ odLoc od) -> od{odComment=Just t}
-                                _ -> let
-                                        -- search  for comment after declaration (same line)
-                                        pl2=DM.lookup st commentMap
-                                     in case pl2 of
-                                                Just (_,t)-> od{odComment=Just t}
-                                                Nothing -> od
-                        in od2{odChildren=map addComment $ odChildren od2}
+                addComment:: OutlineDef -> State (DM.Map Int (Int,Int,T.Text)) OutlineDef
+                addComment od=do
+                        cm<-get
+                        let
+                                st=iflLine $ ifsStart$ odLoc od
+                                -- search for comment before declaration (line above, same column)
+                                pl=DM.lookup (st-1) cm
+                                (cm2,od2)= case pl of
+                                        --  | stc <= iflColumn (ifsStart $ odLoc od) 
+                                        Just (stc,stl,t)-> ( DM.delete (st-1) cm,od{odComment=Just t,odStartLineComment=Just stl})
+                                        _ -> let
+                                                -- search  for comment after declaration (same line)
+                                                pl2=DM.lookup st cm
+                                             in case pl2 of
+                                                        Just (_,_,t)-> (DM.delete st cm,od{odComment=Just t})
+                                                        Nothing -> (cm,od)
+                                children=evalState (mapM addComment $ odChildren od2) cm2
+                        put cm2
+                        return od2{odChildren=children}
 getHSEOutline _ = []
 
 -- | get the ouline from the AST        
@@ -169,21 +175,21 @@ 
 
 -- | build the comment map
-buildCommentMap ::  DM.Map Int (Int,T.Text) -- ^ the map: key is line, value is start column and comment text
+buildCommentMap ::  DM.Map Int (Int,Int,T.Text) -- ^ the map: key is line, value is start column, start line and comment text
         -> Comment -- ^  the comment
-        -> DM.Map Int (Int,T.Text)
+        -> DM.Map Int (Int,Int,T.Text)
 buildCommentMap m (Comment _ ss txt)=let
         txtTrimmed=dropWhile isSpace txt
         st=srcSpanStartLine ss
         stc=srcSpanStartColumn ss
         in case txtTrimmed of
-                ('|':rest)->DM.insert (srcSpanEndLine ss) (stc,T.pack $ dropWhile isSpace rest) m
-                ('^':rest)->DM.insert st (-1,T.pack $ dropWhile isSpace rest) m
+                ('|':rest)->DM.insert (srcSpanEndLine ss) (stc,srcSpanStartLine ss,T.pack $ dropWhile isSpace rest) m
+                ('^':rest)->DM.insert st (-1,st,T.pack $ dropWhile isSpace rest) m
                 _-> let
                         pl=DM.lookup (st-1) m
                     in case pl of
                                 -- we merge the comment text with the comment before it
-                                Just (stc2,t)->DM.insert st (stc2,T.concat [t,"\n",T.pack txt]) (DM.delete st m) 
+                                Just (stc2,sl,t)->DM.insert st (stc2,sl,T.concat [t,"\n",T.pack txt]) (DM.delete st m) 
                                 Nothing-> m
 
 
test/Language/Haskell/BuildWrapper/CMDTests.hs view
@@ -239,8 +239,28 @@         assertEqual 1 (length nsErrors5)         let (nsError6:[])=nsErrors5         assertEqual (BWNote BWError "No 'Main-Is' field found for executable BWTest\n" (mkEmptySpan cfn 1 1)) nsError6-        -+        writeFile cf $ unlines ["name: "++testProjectName,+                "version:0.1",+                "cabal-version:  >= 1.2",+                "build-type:     Simple",+                "",+                "library",+                "  hs-source-dirs:  src",+                "  exposed-modules: A",+                "  other-modules:  B.C",+                "",+                "executable BWTest",+                "  hs-source-dirs: src",+                "  main-is:        Main.hs",+                "  other-modules:  B.D",+                "  build-depends:  base," ++ testProjectName]+        synchronize api root False+        (bool6,nsErrors6)<-configure api root Target+        assertBool (not bool6)+        assertEqual 1 (length nsErrors6)+        let (nsError7:[])=nsErrors6+        assertEqual (BWNote BWError ("The field 'build-depends: "++ testProjectName ++"' refers to a library which is defined\nwithin the same package. To use this feature the package must specify at least\n'cabal-version: >= 1.8'.\n") (mkEmptySpan cfn 1 1)) nsError7+                      test_ConfigureWarnings :: Assertion test_ConfigureWarnings  = do@@ -542,16 +562,16 @@                         ]                 ,mkOutlineDef "Elem" [Type,Family] (InFileSpan (InFileLoc 13 1)(InFileLoc 13 19))                 ,mkOutlineDef "Elem [e]" [Type,Instance] (InFileSpan (InFileLoc 15 1)(InFileLoc 15 27)) -                ,OutlineDef "testfunc1" [Function] (InFileSpan (InFileLoc 17 1)(InFileLoc 18 25)) [] (Just "[Char]") Nothing-                ,OutlineDef "testfunc1bis" [Function] (InFileSpan (InFileLoc 20 1)(InFileLoc 22 25)) [] (Just "String -> [Char]") Nothing      -                ,OutlineDef "testMethod" [Function] (InFileSpan (InFileLoc 24 1)(InFileLoc 27 13))  [] (Just "forall a . (Num a) => a -> a -> a") Nothing +                ,OutlineDef "testfunc1" [Function] (InFileSpan (InFileLoc 17 1)(InFileLoc 18 25)) [] (Just "[Char]") Nothing Nothing+                ,OutlineDef "testfunc1bis" [Function] (InFileSpan (InFileLoc 20 1)(InFileLoc 22 25)) [] (Just "String -> [Char]") Nothing Nothing      +                ,OutlineDef "testMethod" [Function] (InFileSpan (InFileLoc 24 1)(InFileLoc 27 13))  [] (Just "forall a . (Num a) => a -> a -> a") Nothing Nothing                  ,mkOutlineDefWithChildren "ToString" [Class] (InFileSpan (InFileLoc 29 1)(InFileLoc 32 0))  [                         mkOutlineDef "toString" [Function] (InFileSpan (InFileLoc 30 5)(InFileLoc 30 28))                         ]                           ,mkOutlineDefWithChildren "ToString String" [Instance] (InFileSpan (InFileLoc 32 1)(InFileLoc 35 0))  [                         mkOutlineDef "toString" [Function] (InFileSpan (InFileLoc 33 5)(InFileLoc 33 18))                          ]    -                ,OutlineDef "Str" [Type] (InFileSpan (InFileLoc 35 1)(InFileLoc 35 16)) [] (Just "String") Nothing              +                ,OutlineDef "Str" [Type] (InFileSpan (InFileLoc 35 1)(InFileLoc 35 16)) [] (Just "String") Nothing Nothing                              ,mkOutlineDefWithChildren "Type1" [Data] (InFileSpan (InFileLoc 37 1)(InFileLoc 41 10))  [                          mkOutlineDef "MkType1_1" [Constructor] (InFileSpan (InFileLoc 37 12)(InFileLoc 37 25))                          ,mkOutlineDefWithChildren "MkType1_2" [Constructor] (InFileSpan (InFileLoc 38 7)(InFileLoc 41 10)) [@@ -615,28 +635,67 @@         (OutlineResult defs es is,nsErrors1)<-getOutline api root rel         assertBool (null nsErrors1)         let expected=[-                OutlineDef "testfunc1" [Function] (InFileSpan (InFileLoc 8 1)(InFileLoc 9 25)) [] (Just "[Char]") Nothing-                ,OutlineDef "testfunc1bis" [Function] (InFileSpan (InFileLoc 12 1)(InFileLoc 14 25)) [] (Just "String -> [Char]") (Just "testFunc1bis haddock")              -                ,OutlineDef "testMethod" [Function] (InFileSpan (InFileLoc 18 1)(InFileLoc 21 13))  [] (Just "forall a . (Num a) => a -> a -> a")   (Just "testMethod\n haddock") +                OutlineDef "testfunc1" [Function] (InFileSpan (InFileLoc 8 1)(InFileLoc 9 25)) [] (Just "[Char]") Nothing Nothing+                ,OutlineDef "testfunc1bis" [Function] (InFileSpan (InFileLoc 12 1)(InFileLoc 14 25)) [] (Just "String -> [Char]") (Just "testFunc1bis haddock")  (Just 11)           +                ,OutlineDef "testMethod" [Function] (InFileSpan (InFileLoc 18 1)(InFileLoc 21 13))  [] (Just "forall a . (Num a) => a -> a -> a")   (Just "testMethod\n haddock") (Just 16)                      ,mkOutlineDefWithChildren "ToString" [Class] (InFileSpan (InFileLoc 23 1)(InFileLoc 27 0))  [-                        OutlineDef "toString" [Function] (InFileSpan (InFileLoc 24 5)(InFileLoc 24 28)) [] Nothing (Just "toString comment")+                        OutlineDef "toString" [Function] (InFileSpan (InFileLoc 24 5)(InFileLoc 24 28)) [] Nothing (Just "toString comment") Nothing                         ]          -                ,OutlineDef "Str" [Type] (InFileSpan (InFileLoc 27 1)(InFileLoc 27 16)) [] (Just "String") (Just "Str haddock")          +                ,OutlineDef "Str" [Type] (InFileSpan (InFileLoc 27 1)(InFileLoc 27 16)) [] (Just "String") (Just "Str haddock") (Just 26)                              ,OutlineDef "Type1" [Data] (InFileSpan (InFileLoc 30 1)(InFileLoc 34 10))  [-                         OutlineDef "MkType1_1" [Constructor] (InFileSpan (InFileLoc 30 12)(InFileLoc 30 25)) [] Nothing (Just "MkType1 comment") +                         OutlineDef "MkType1_1" [Constructor] (InFileSpan (InFileLoc 30 12)(InFileLoc 30 25)) [] Nothing (Just "MkType1 comment") Nothing                         ,mkOutlineDefWithChildren "MkType1_2" [Constructor] (InFileSpan (InFileLoc 31 7)(InFileLoc 34 10)) [                                 mkOutlineDef "mkt2_s" [Field] (InFileSpan (InFileLoc 32 9)(InFileLoc 32 25))                                  ,mkOutlineDef "mkt2_i" [Field] (InFileSpan (InFileLoc 33 9)(InFileLoc 33 22))                                                                   ]                         -                        ] Nothing (Just "Type1 haddock")    +                        ] Nothing (Just "Type1 haddock")  (Just 29)                        ]         assertEqual (length expected) (length defs)         mapM_ (uncurry (assertEqual )) (zip expected defs)         assertEqual [] es         assertEqual [ImportDef "Data.Char" Nothing (InFileSpan (InFileLoc 5 1)(InFileLoc 5 17)) False False "" Nothing] is          +test_OutlineComments142 :: Assertion+test_OutlineComments142= do+        let api=cabalAPI+        root<-createTestProject+        synchronize api root False+        let rel="src"</>"A.hs"+        -- use api to write temp file+        write api root rel $ unlines [+                "module Module1 where",+                "",        +                "-- | Type for an entry in file",+                "data CblEntry = ",+                "  -- | This is the documentation for the 1. constructor",+                "  CblCondition { cblCondition :: String }",+                "  -- | This is the documentation for the FV",+                "  | CblFieldValue { ",+                "    cblFldName :: String, -- ^ name of the field",+                "    cblFldValues :: [String] -- ^ values of the field",+                "    } -- ^ field-values pair"                ]+        (_,nsErrors3f)<-getBuildFlags api root rel+        assertBool (null nsErrors3f)        +        (OutlineResult defs es is,nsErrors1)<-getOutline api root rel+        assertBool (null nsErrors1)+        assertEqual [] es+        assertEqual [] is+        let expected=[+                OutlineDef "CblEntry" [Data] (InFileSpan (InFileLoc 4 1)(InFileLoc 11 6)) [+                    OutlineDef "CblCondition" [Constructor] (InFileSpan (InFileLoc 6 3) (InFileLoc 6 42))+                        [+                            OutlineDef "cblCondition" [Field] (InFileSpan (InFileLoc 6 18) (InFileLoc 6 40)) [] Nothing Nothing Nothing+                        ] Nothing (Just "This is the documentation for the 1. constructor") (Just 5) +                    , OutlineDef "CblFieldValue" [Constructor] (InFileSpan (InFileLoc 8 5) (InFileLoc 11 6))+                        [+                            OutlineDef "cblFldName" [Field] (InFileSpan (InFileLoc 9 5) (InFileLoc 9 25)) [] Nothing (Just "name of the field") Nothing+                            ,OutlineDef "cblFldValues" [Field] (InFileSpan (InFileLoc 10 5) (InFileLoc 10 29)) [] Nothing (Just "values of the field") Nothing+                        ] Nothing (Just "This is the documentation for the FV") (Just 7) +                ] Nothing (Just "Type for an entry in file") (Just 3)]+        assertEqual (length expected) (length defs)+        mapM_ (uncurry (assertEqual )) (zip expected defs)          test_OutlinePreproc :: Assertion test_OutlinePreproc =  do@@ -696,8 +755,8 @@         assertBool (null nsErrors2)         let expected2=[                 mkOutlineDefWithChildren "Name" [Data] (InFileSpan (InFileLoc 5 1)(InFileLoc 9 38))  [-                  OutlineDef "Ident" [Constructor] (InFileSpan (InFileLoc 6 6)(InFileLoc 6 18)) [] Nothing (Just "/varid/ or /conid/."),-                  OutlineDef "Symbol" [Constructor] (InFileSpan (InFileLoc 7 6)(InFileLoc 7 19)) [] Nothing (Just "/varsym/ or /consym/")+                  OutlineDef "Ident" [Constructor] (InFileSpan (InFileLoc 6 6)(InFileLoc 6 18)) [] Nothing (Just "/varid/ or /conid/.") Nothing,+                  OutlineDef "Symbol" [Constructor] (InFileSpan (InFileLoc 7 6)(InFileLoc 7 19)) [] Nothing (Just "/varsym/ or /consym/") Nothing                   ]                 ]          assertEqual (length expected2) (length defs2)
test/Language/Haskell/BuildWrapper/UsagesTests.hs view
@@ -122,9 +122,9 @@       
         assertPackageModule "BWTest-0.1" "A" [1,8,1,9] v
       
-        assertVarUsage "BWTest-0.1" "A" "Cons1" [("Cons1",True,[2,13,2,18]),("reset",False,[10,8,10,13]),("reset",False,[10,17,10,22]),("getString",False,[16,12,16,17])] v
-        assertVarUsage "BWTest-0.1" "A" "Cons2" [("Cons2",True,[4,9,4,14]),("reset",False,[11,8,11,13]),("reset",False,[11,17,11,22])] v
-        assertVarUsage "BWTest-0.1" "A" "mdS" [("mdS",True,[3,9,3,12])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons1" [("MyData",True,[2,13,2,18]),("reset",False,[10,8,10,13]),("reset",False,[10,17,10,22]),("getString",False,[16,12,16,17])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons2" [("MyData",True,[4,9,4,14]),("reset",False,[11,8,11,13]),("reset",False,[11,17,11,22])] v
+        assertVarUsage "BWTest-0.1" "A" "mdS" [("MyData",True,[3,9,3,12])] v
         assertVarUsage "BWTest-0.1" "A" "reset" [("reset",True,[9,1,9,6]),("reset",True,[10,1,10,25]),("reset",True,[11,1,11,24]),("resetAll",False,[13,14,13,19])] v
         assertVarUsage "BWTest-0.1" "A" "resetAll" [("resetAll",True,[13,1,13,19])] v
         assertVarUsage "BWTest-0.1" "A" "getString" [("getString",True,[15,1,15,10]),("getString",True,[16,1,16,27]),("getString",True,[17,1,17,21])] v
@@ -134,11 +134,11 @@         assertVarUsage "base" "GHC.Num" "fromInteger" [("reset",False,[11,23,11,24])] v
         
         assertTypeUsage "BWTest-0.1" "A" "MyData" [("MyData",True,[2,6,2,12]),("reset",False,[9,10,9,16]),("reset",False,[9,20,9,26]),("getString",False,[15,14,15,20])] v
-        assertTypeUsage "BWTest-0.1" "A" "MyString" [("mdS",False,[3,14,3,22]),("MyString",True,[7,6,7,14]),("getString",False,[15,30,15,38])] v
+        assertTypeUsage "BWTest-0.1" "A" "MyString" [("MyData",False,[3,14,3,22]),("MyString",True,[7,6,7,14]),("getString",False,[15,30,15,38])] v
         assertTypeUsage "base" "Data.Maybe" "Maybe" [("getString",False,[15,24,15,29])] v
         assertTypeUsage "base" "GHC.Base" "String" [("MyString",False,[7,15,7,21])] v
         assertTypeUsage "base" "GHC.Show" "Show" [("MyData",False,[5,15,5,19])] v
-        assertTypeUsage "ghc-prim" "GHC.Types" "Int" [("Cons2",False,[4,15,4,18])] v
+        assertTypeUsage "ghc-prim" "GHC.Types" "Int" [("MyData",False,[4,15,4,18])] v
         
         vMain<-readStoredUsage (root </> ".dist-buildwrapper" </>  relMain)
         --sUMain<-fmap formatJSON (readFile  $ getUsageFile(root </> ".dist-buildwrapper" </>  relMain))
@@ -228,27 +228,27 @@         --sU<-fmap formatJSON (readFile  $ getUsageFile(root </> ".dist-buildwrapper" </>  rel))
         --putStrLn sU
         
-        assertVarUsage "BWTest-0.1" "A" "Cons1" [("Cons1",True,[9,13,9,18]),("reset",False,[17,8,17,13]),("reset",False,[17,17,17,22])] v
-        assertVarUsage "BWTest-0.1" "A" "Cons2" [("Cons2",True,[11,9,11,14]),("reset",False,[18,8,18,13]),("reset",False,[18,17,18,22])] v
-        assertVarUsage "BWTest-0.1" "A" "Cons21" [("Cons21",True,[20,14,20,20])] v
-        assertVarUsage "BWTest-0.1" "A" "Cons22" [("Cons22",True,[22,9,22,15])] v
-        assertVarUsage "BWTest-0.1" "A" "Cons31" [("export",False,[4,5,4,20]),("Cons31",True,[24,14,24,20])] v
-        assertVarUsage "BWTest-0.1" "A" "Cons32" [("Cons32",True,[26,9,26,15])] v
-        assertVarUsage "BWTest-0.1" "A" "mdS" [("mdS",True,[10,9,10,12])] v
-        assertVarUsage "BWTest-0.1" "A" "mdS2" [("mdS2",True,[21,9,21,13])] v
-        assertVarUsage "BWTest-0.1" "A" "mdS3" [("mdS3",True,[25,9,25,13])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons1" [("MyData",True,[9,13,9,18]),("reset",False,[17,8,17,13]),("reset",False,[17,17,17,22])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons2" [("MyData",True,[11,9,11,14]),("reset",False,[18,8,18,13]),("reset",False,[18,17,18,22])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons21" [("MyData2",True,[20,14,20,20])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons22" [("MyData2",True,[22,9,22,15])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons31" [("export",False,[4,5,4,20]),("MyData3",True,[24,14,24,20])] v
+        assertVarUsage "BWTest-0.1" "A" "Cons32" [("MyData3",True,[26,9,26,15])] v
+        assertVarUsage "BWTest-0.1" "A" "mdS" [("MyData",True,[10,9,10,12])] v
+        assertVarUsage "BWTest-0.1" "A" "mdS2" [("MyData2",True,[21,9,21,13])] v
+        assertVarUsage "BWTest-0.1" "A" "mdS3" [("MyData3",True,[25,9,25,13])] v
         assertVarUsage "BWTest-0.1" "A" "reset" [("export",False,[5,5,5,10]),("reset",True,[16,1,16,6]),("reset",True,[17,1,17,25]),("reset",True,[18,1,18,24])] v
         assertVarUsage "base" "GHC.Num" "fromInteger" [("reset",False,[18,23,18,24])] v
         
         assertVarUsage "base" "Data.Ord" "" [("export",False,[7,5,7,20]),("import",False,[8,8,8,16])] v
         
         assertTypeUsage "BWTest-0.1" "A" "MyData" [("export",False,[2,5,2,11]),("MyData",True,[9,6,9,12]),("reset",False,[16,10,16,16]),("reset",False,[16,20,16,26])] v
-        assertTypeUsage "BWTest-0.1" "A" "MyString" [("export",False,[6,5,6,13]),("mdS",False,[10,14,10,22]),("MyString",True,[14,6,14,14]),("mdS2",False,[21,15,21,23]),("mdS3",False,[25,15,25,23])] v
+        assertTypeUsage "BWTest-0.1" "A" "MyString" [("export",False,[6,5,6,13]),("MyData",False,[10,14,10,22]),("MyString",True,[14,6,14,14]),("MyData2",False,[21,15,21,23]),("MyData3",False,[25,15,25,23])] v
         assertTypeUsage "base" "GHC.Base" "String" [("MyString",False,[14,15,14,21])] v
         assertTypeUsage "base" "GHC.Show" "Show" [("MyData",False,[12,15,12,19]),("MyData2",False,[23,15,23,19]),("MyData3",False,[27,15,27,19])] v
         assertTypeUsage "BWTest-0.1" "A" "MyData2" [("export",False,[3,5,3,16]),("MyData2",True,[20,6,20,13])] v
         assertTypeUsage "BWTest-0.1" "A" "MyData3" [("export",False,[4,5,4,20]),("MyData3",True,[24,6,24,13])] v
-        assertTypeUsage "ghc-prim" "GHC.Types" "Int" [("Cons2",False,[11,15,11,18]),("Cons22",False,[22,16,22,19]),("Cons32",False,[26,16,26,19])] v
+        assertTypeUsage "ghc-prim" "GHC.Types" "Int" [("MyData",False,[11,15,11,18]),("MyData2",False,[22,16,22,19]),("MyData3",False,[26,16,26,19])] v
 
  
 test_GenerateReferencesExportAlias :: Assertion