Commit 85eebc52 authored by Simon Marlow's avatar Simon Marlow
Browse files

getMainDeclBinder should return Nothing for a binding with no variables

See test rn003
parent 30098da6
......@@ -428,7 +428,10 @@ collect_pat other acc = acc -- Literals, vars, wildcard
getMainDeclBinder :: HsDecl name -> Maybe name
getMainDeclBinder (TyClD d) = Just (tcdName d)
getMainDeclBinder (ValD d) = Just ((unLoc . head) (collectAcc d []))
getMainDeclBinder (ValD d)
= case collectAcc d [] of
[] -> Nothing -- see rn003
(name:_) -> Just (unLoc name)
getMainDeclBinder (SigD d) = sigNameNoLoc d
getMainDeclBinder (ForD (ForeignImport name _ _)) = Just (unLoc name)
getMainDeclBinder (ForD (ForeignExport name _ _)) = Just (unLoc name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment