Opened 6 years ago

Closed 6 years ago

#5300 closed bug (fixed)

Infinite context reduction stack overflow

Reported by: dsf Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.0.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case: typecheck/should_fail/T5300
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The contrived example below gets a Context reduction stack overflow error no matter how big you make the context reduction stack. I'm not sure whether this constitutes a fixable bug or not.

{-# LANGUAGE FunctionalDependencies, MultiParamTypeClasses #-}

import Control.Monad.State (StateT)

class C1 a b c | a -> b
class C2 a b c

data T b = T

f1 :: (Monad m, C1 a b c) => a -> StateT (T b) m a
f1 f = undefined

f2 :: (Monad m, C1 a1 b1 c1, C2 a2 b2 c2) => a1 -> StateT (T b2) m a2
f2 fm = f1 fm >>= return . undefined

Change History (1)

comment:1 Changed 6 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: typecheck/should_fail/T5300

The HEAD (upcoming 7.2) gives

    Ambiguous type variable `c0' in the constraint:
      (C1 a1 b2 c0) arising from a use of `f1'
    Probable fix: add a type signature that fixes these type variable(s)
    In the first argument of `(>>=)', namely `f1 fm'
    In the expression: f1 fm >>= return . undefined
    In an equation for `f2': f2 fm = f1 fm >>= return . undefined

which seems right. So I think this one is fixed. I'll add it as a regression test though. Thanks.


Note: See TracTickets for help on using tickets.