[project @ 2002-09-03 11:27:33 by simonpj]
authorsimonpj <unknown>
Tue, 3 Sep 2002 11:27:33 +0000 (11:27 +0000)
committersimonpj <unknown>
Tue, 3 Sep 2002 11:27:33 +0000 (11:27 +0000)
More comments

ghc/compiler/typecheck/TcMType.lhs
ghc/compiler/typecheck/TcMonoType.lhs

index c13993a..d4d506a 100644 (file)
@@ -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
index eedad78..ac86e09 100644 (file)
@@ -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