Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
723365de
Commit
723365de
authored
Oct 19, 2010
by
simonpj@microsoft.com
Browse files
Reject programs with equality superclasses for now
parent
d8cb9db5
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/typecheck/TcMType.lhs
View file @
723365de
...
...
@@ -1135,10 +1135,12 @@ check_pred_ty dflags ctxt pred@(ClassP cls tys)
how_to_allow = parens (ptext (sLit "Use -XFlexibleContexts to permit this"))
check_pred_ty dflags
_
pred@(EqPred ty1 ty2)
check_pred_ty dflags
ctxt
pred@(EqPred ty1 ty2)
= do { -- Equational constraints are valid in all contexts if type
-- families are permitted
; checkTc (xopt Opt_TypeFamilies dflags) (eqPredTyErr pred)
; checkTc (case ctxt of ClassSCCtxt {} -> False; _ -> True)
(eqSuperClassErr pred)
-- Check the form of the argument types
; checkValidMonoType ty1
...
...
@@ -1295,11 +1297,16 @@ checkThetaCtxt ctxt theta
= vcat [ptext (sLit "In the context:") <+> pprTheta theta,
ptext (sLit "While checking") <+> pprSourceTyCtxt ctxt ]
eqSuperClassErr :: PredType -> SDoc
eqSuperClassErr pred
= hang (ptext (sLit "Alas, GHC 7.0 still cannot handle equality superclasses:"))
2 (ppr pred)
badPredTyErr, eqPredTyErr, predTyVarErr :: PredType -> SDoc
badPredTyErr
sty
= ptext (sLit "Illegal constraint") <+> pprPred
sty
eqPredTyErr
sty
= ptext (sLit "Illegal equational constraint") <+> pprPred
sty
$$
parens (ptext (sLit "Use -XTypeFamilies to permit this"))
badPredTyErr
pred
= ptext (sLit "Illegal constraint") <+> pprPred
pred
eqPredTyErr
pred
= ptext (sLit "Illegal equational constraint") <+> pprPred
pred
$$
parens (ptext (sLit "Use -XTypeFamilies to permit this"))
predTyVarErr pred = sep [ptext (sLit "Non type-variable argument"),
nest 2 (ptext (sLit "in the constraint:") <+> pprPred pred)]
dupPredWarn :: [[PredType]] -> SDoc
...
...
Write
Preview
Supports
Markdown
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