git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Don't warn unused data constructors when none imported
commitb20be15a207fa9740a690bb27bd819d18dc5c36b authorNicholas Wolverson <nicholas.wolverson@gmail.com> dateThu 12 Nov 2015, 22:54 (11 years ago) parent6a894b4
1 file changed+5−3
src/Language/PureScript/Linter/Imports.hs+5−3
src/Language/PureScript/Linter/Imports.hs+5−3
@@ -57,9 +57,11 @@ findUnusedImports (Module _ _ _ mdecls mexports) env usedImps = do
5757 forM_ (mapMaybe getTypeRef declrefs) $ \(tn, c) -> do
5858 let allCtors = dctorsForType mni tn
5959 when (runProperName tn `elem` usedNames) $ case (c, null $ usedDctors `intersect` allCtors) of
60− (_, True) -> tell $ errorMessage $ UnusedDctorImport tn
61− (Just ctors, False) -> let ddiff = ctors \\ usedDctors
62− in unless (null ddiff) $ tell $ errorMessage $ UnusedDctorExplicitImport tn ddiff
60+ (Nothing, True) -> tell $ errorMessage $ UnusedDctorImport tn
61+ (Just (_:_), True) -> tell $ errorMessage $ UnusedDctorImport tn
62+ (Just ctors, _) ->
63+ let ddiff = ctors \\ usedDctors
64+ in unless (null ddiff) $ tell $ errorMessage $ UnusedDctorExplicitImport tn ddiff
6365 _ -> return ()
6466 return ()
6567