Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Tobias Decking
GHC
Commits
3b7d2756
Commit
3b7d2756
authored
Oct 04, 2004
by
simonpj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[project @ 2004-10-04 09:35:08 by simonpj]
Sort decls in cycle for error message
parent
ae0b2a9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
ghc/compiler/typecheck/TcTyClsDecls.lhs
ghc/compiler/typecheck/TcTyClsDecls.lhs
+12
-5
No files found.
ghc/compiler/typecheck/TcTyClsDecls.lhs
View file @
3b7d2756
...
...
@@ -49,7 +49,7 @@ import Var ( TyVar, idType, idName )
import VarSet ( elemVarSet )
import Name ( Name )
import Outputable
import Util ( zipLazy, isSingleton, notNull )
import Util ( zipLazy, isSingleton, notNull
, sortLe
)
import List ( partition )
import SrcLoc ( Located(..), unLoc, getLoc )
import ListSetOps ( equivClasses )
...
...
@@ -683,19 +683,26 @@ badGenericMethodType op op_ty
ptext SLIT("You can only use type variables, arrows, and tuples")])
recSynErr syn_decls
= setSrcSpan (getLoc (head s
yn
_decls)) $
= setSrcSpan (getLoc (head s
orted
_decls)) $
addErr (sep [ptext SLIT("Cycle in type synonym declarations:"),
nest 2 (vcat (map ppr_decl s
yn
_decls))])
nest 2 (vcat (map ppr_decl s
orted
_decls))])
where
sorted_decls = sortLocated syn_decls
ppr_decl (L loc decl) = ppr loc <> colon <+> ppr decl
recClsErr cls_decls
= setSrcSpan (getLoc (head
cls
_decls)) $
= setSrcSpan (getLoc (head
sorted
_decls)) $
addErr (sep [ptext SLIT("Cycle in class declarations (via superclasses):"),
nest 2 (vcat (map ppr_decl
cls
_decls))])
nest 2 (vcat (map ppr_decl
sorted
_decls))])
where
sorted_decls = sortLocated cls_decls
ppr_decl (L loc decl) = ppr loc <> colon <+> ppr (decl { tcdSigs = [] })
sortLocated :: [Located a] -> [Located a]
sortLocated things = sortLe le things
where
le (L l1 _) (L l2 _) = l1 <= l2
exRecConErr name
= ptext SLIT("Can't combine named fields with locally-quantified type variables or context")
$$
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment