diff options
author | simonpj <unknown> | 2002-09-03 11:27:33 +0000 |
---|---|---|
committer | simonpj <unknown> | 2002-09-03 11:27:33 +0000 |
commit | a57b6d8f9eab3c50d8691d2a55c54ccccac2018c (patch) | |
tree | 7ee3e701d4d28c9866f7c75278588ca7d3c9fe47 /ghc | |
parent | 3a9075020fbffec15481ae06c84a96c5fd9a808d (diff) | |
download | haskell-a57b6d8f9eab3c50d8691d2a55c54ccccac2018c.tar.gz |
[project @ 2002-09-03 11:27:33 by simonpj]
More comments
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/compiler/typecheck/TcMType.lhs | 4 | ||||
-rw-r--r-- | ghc/compiler/typecheck/TcMonoType.lhs | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/ghc/compiler/typecheck/TcMType.lhs b/ghc/compiler/typecheck/TcMType.lhs index c13993a808..d4d506ae96 100644 --- a/ghc/compiler/typecheck/TcMType.lhs +++ b/ghc/compiler/typecheck/TcMType.lhs @@ -936,6 +936,10 @@ check_valid_theta ctxt [] check_valid_theta ctxt theta = getDOptsTc `thenNF_Tc` \ dflags -> warnTc (notNull dups) (dupPredWarn dups) `thenNF_Tc_` + -- Actually, in instance decls and type signatures, + -- duplicate constraints are eliminated by TcMonoType.hoistForAllTys, + -- so this error can only fire for the context of a class or + -- data type decl. mapTc_ (check_source_ty dflags ctxt) theta where (_,dups) = removeDups tcCmpPred theta diff --git a/ghc/compiler/typecheck/TcMonoType.lhs b/ghc/compiler/typecheck/TcMonoType.lhs index eedad78afa..ac86e09765 100644 --- a/ghc/compiler/typecheck/TcMonoType.lhs +++ b/ghc/compiler/typecheck/TcMonoType.lhs @@ -644,6 +644,9 @@ hoistForAllTys :: Type -> Type -- e.g. T -> forall a. a ==> forall a. T -> a -- T -> (?x::Int) -> Int ==> (?x::Int) -> T -> Int -- +-- Also: eliminate duplicate constraints. These can show up +-- when hoisting constraints, notably implicit parameters. +-- -- We want to 'look through' type synonyms when doing this -- so it's better done on the Type than the HsType |