-addDupDeclErr :: Name -> Name -> TcRn ()
-addDupDeclErr name_a name_b
- = addErrAt (srcLocSpan loc2) $
- vcat [ptext SLIT("Multiple declarations of") <+> quotes (ppr name1),
- ptext SLIT("Declared at:") <+> vcat [ppr (nameSrcLoc name1), ppr loc2]]
- where
- loc2 = nameSrcLoc name2
- (name1,name2) | nameSrcLoc name_a > nameSrcLoc name_b = (name_b,name_a)
- | otherwise = (name_a,name_b)
+addDupDeclErr :: [Name] -> TcRn ()
+addDupDeclErr []
+ = panic "addDupDeclErr: empty list"
+addDupDeclErr names@(name : _)
+ = addErrAt (getSrcSpan (last sorted_names)) $