Instances retain everything

This commit is contained in:
Oliver Charles 2019-09-16 10:08:22 +01:00
parent 2a1940f8cd
commit fa58203900
3 changed files with 21 additions and 7 deletions

View File

@ -460,9 +460,9 @@ topLevelAnalysis n@Node{ nodeChildren } = do
[ [
-- analyseStandaloneDeriving n -- analyseStandaloneDeriving n
-- , -- ,
analyseBinding n analyseBinding n
-- , analyseRewriteRule n -- , analyseRewriteRule n
-- , analyseInstanceDeclaration n , analyseInstanceDeclaration n
-- , analyseClassDeclaration n -- , analyseClassDeclaration n
-- , analyseDataDeclaration n -- , analyseDataDeclaration n
] ]

View File

@ -108,27 +108,32 @@ fileToTestCase sourceFilePath =
analysis = analysis =
execState ( analyseHieFile hieFile ) emptyAnalysis execState ( analyseHieFile hieFile ) emptyAnalysis
testModule =
Module
( DefiniteUnitId ( DefUnitId ( stringToInstalledUnitId "main" ) ) )
testModuleName
reachableSet = reachableSet =
reachable reachable
analysis analysis
( Set.singleton ( Set.singleton
Declaration Declaration
{ declModule = { declModule =
Module testModule
( DefiniteUnitId ( DefUnitId ( stringToInstalledUnitId "main" ) ) )
testModuleName
, declOccName = , declOccName =
mkOccName varName "root" mkOccName varName "root"
} }
) )
dead = dead =
allDeclarations analysis Set.\\ reachableSet Set.filter
( \d -> declModule d == testModule )
( allDeclarations analysis Set.\\ reachableSet )
unless unless
( Set.null dead ) ( Set.null dead )
( for_ dead \d -> ( for_ dead \d ->
liftIO ( putStrLn ( declarationStableName d <> " is dead, but should be alive" ) ) liftIO ( fail ( declarationStableName d <> " is dead, but should be alive" ) )
) )
-- | Recursively search for .hie files in given directory -- | Recursively search for .hie files in given directory

View File

@ -0,0 +1,9 @@
module Test () where
alive :: String
alive = "Alive"
data T = T
instance Show T where
show T = alive