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
-- ,
analyseBinding n
analyseBinding n
-- , analyseRewriteRule n
-- , analyseInstanceDeclaration n
, analyseInstanceDeclaration n
-- , analyseClassDeclaration n
-- , analyseDataDeclaration n
]

View File

@ -108,27 +108,32 @@ fileToTestCase sourceFilePath =
analysis =
execState ( analyseHieFile hieFile ) emptyAnalysis
testModule =
Module
( DefiniteUnitId ( DefUnitId ( stringToInstalledUnitId "main" ) ) )
testModuleName
reachableSet =
reachable
analysis
( Set.singleton
Declaration
{ declModule =
Module
( DefiniteUnitId ( DefUnitId ( stringToInstalledUnitId "main" ) ) )
testModuleName
testModule
, declOccName =
mkOccName varName "root"
}
)
dead =
allDeclarations analysis Set.\\ reachableSet
Set.filter
( \d -> declModule d == testModule )
( allDeclarations analysis Set.\\ reachableSet )
unless
( Set.null dead )
( 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

View File

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