id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
7101	Specialise broken for implicit parameters	pcapriotti		"The `tcrun019` test case is failing with optimization on. Here is an even simpler test case:

{{{
{-# LANGUAGE ImplicitParams, RankNTypes #-}

module Main where

f :: (?x :: Int) => ((?x :: Int) => Int) -> Bool -> Int
f g False = g
f g True = let ?x = ?x + 1
           in f g False

h :: (?x :: Int) => Int
h = ?x

main :: IO ()
main = print (let ?x = 0 in f h True)
}}}

What happens is that `f` gets incorrectly specialized, and, as a result, the
recursive call to `f` uses the old binding for the implicit parameter.

I think the problem was introduced with the refactoring in
5a8ac0f823c151c062a3f1903574030423bb255c, which broke the test for implicit
parameter constraints in `Specialise.lhs`.

The attached patch seems to fix it.
"	bug	closed	normal	7.6.1	Compiler	7.4.2	fixed			Unknown/Multiple	Unknown/Multiple	Incorrect result at runtime	Unknown	simplCore/should_run/T7101			
