Ticket #7101 (closed bug: fixed)
Specialise broken for implicit parameters
| Reported by: | pcapriotti | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.6.1 |
| Component: | Compiler | Version: | 7.4.2 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Incorrect result at runtime | Difficulty: | Unknown |
| Test Case: | simplCore/should_run/T7101 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

