[project @ 2003-12-17 11:29:40 by simonpj]
authorsimonpj <unknown>
Wed, 17 Dec 2003 11:29:42 +0000 (11:29 +0000)
committersimonpj <unknown>
Wed, 17 Dec 2003 11:29:42 +0000 (11:29 +0000)
commitca0b7c66f2e8e50f15a03c406408d9e86455f8eb
tree3fb2ec234c3067e047fa261b399ff6fc9e998d3a
parent69e27f1d9d475a94e61fa54af40ac7be06d872ca
[project @ 2003-12-17 11:29:40 by simonpj]
-----------------------------------------------------
  Fix a subtle loop in the context-reduction machinery
  ----------------------------------------------------

This bug was provoked by a recent change: when trying to prove
a constraint C, TcSimplify.reduce now adds C to the database before
trying to prove C, thus building recursive dictionaries.

Two bugs
a) If we add C's superclasses (which we were) we can now build a
   bogusly-recursive dictionary (see Note [SUPERCLASS-LOOP]).
   Solution: in reduce, add C only (via addIrred NoSCs) and then
   later use addWanted to add its definition plus SCs.

b) Since we can have recursive definitions, the superclass-loop
   handling machinery (findAllDeps) must carry its visited-set
   with it (which it was not doing before)

The main file is TcSimplify; but I modified a bunch of others to
take advantage of new function extendVarSetList
ghc/compiler/basicTypes/VarSet.lhs
ghc/compiler/coreSyn/CoreLint.lhs
ghc/compiler/deSugar/Desugar.lhs
ghc/compiler/deSugar/DsArrows.lhs
ghc/compiler/simplCore/OccurAnal.lhs
ghc/compiler/specialise/Specialise.lhs
ghc/compiler/typecheck/TcBinds.lhs
ghc/compiler/typecheck/TcSimplify.lhs