Fix a grevious error in InstEnv: Trac #5095
An claimed short-cut optimisation was actually an error. The optimisation was this: when looking up (C a b), where 'a' and 'b' are type variables, we were returning [] immediately if the instance environment had no instances of form (C a b). Why? Because the thing being looked up definitely won't match (C Int Bool), say. BUT it will *unify* with (C Int Bool) and we care very much about things it might unify with. If we neglect them we may silently allow incoherent instance selection, and that is exactly what happened in #5095. The fix is easy: remove the "optimisation".
Please register or sign in to comment