mirror of
https://github.com/ocharles/weeder.git
synced 2024-11-27 02:33:03 +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
|
-- analyseStandaloneDeriving n
|
||||||
-- ,
|
-- ,
|
||||||
analyseBinding n
|
analyseBinding n
|
||||||
-- , analyseRewriteRule n
|
-- , analyseRewriteRule n
|
||||||
-- , analyseInstanceDeclaration n
|
, analyseInstanceDeclaration n
|
||||||
-- , analyseClassDeclaration n
|
-- , analyseClassDeclaration n
|
||||||
-- , analyseDataDeclaration n
|
-- , analyseDataDeclaration n
|
||||||
]
|
]
|
||||||
|
@ -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
|
||||||
|
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