Incorrect behavior when let binding implicit CallStack object
I'm trying out ghc HEAD at 062feee4.
{-# LANGUAGE ImplicitParams #-}
import GHC.Types
f :: (?loc :: CallStack) => Int
f = let y = length $ getCallStack ?loc
in if y < 2 then 3 else 4
f2 :: (?loc :: CallStack) => Int
f2 = if (length $ getCallStack ?loc) < 2 then 3 else 4
f3 :: (?loc :: [Int]) => Int
f3 = let y = length ?loc
in if y < 2 then 3 else 4
produces:
[1 of 1] Compiling Main ( Bug.hs, interpreted )
Bug.hs:5:6: warning:
Redundant constraint: ?loc::CallStack
In the type signature for:
f :: (?loc::CallStack) => Int
f3 doesn't produce an error which makes me think it's related to CallStack handling. The warning seems accurate: the returned callstack only contains the entry at f.
Trac metadata
Trac field | Value |
---|---|
Version | 7.11 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |