mirror of
https://github.com/ocharles/weeder.git
synced 2024-11-26 16:52:55 +03:00
Instances retain everything
This commit is contained in:
parent
2a1940f8cd
commit
fa58203900
@ -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
|
||||
]
|
||||
|
@ -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
|
||||
|
9
tests/test-cases/Instances retain top level bindings.hs
Normal file
9
tests/test-cases/Instances retain top level bindings.hs
Normal file
@ -0,0 +1,9 @@
|
||||
module Test () where
|
||||
|
||||
alive :: String
|
||||
alive = "Alive"
|
||||
|
||||
data T = T
|
||||
|
||||
instance Show T where
|
||||
show T = alive
|
Loading…
Reference in New Issue
Block a user