Specialise broken for implicit parameters
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
5a8ac0f8, which broke the test for implicit
parameter constraints in Specialise.lhs.
The attached patch seems to fix it.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |