[GHC] #10845: Incorrect behavior when let binding implicit CallStack object
GHC
ghc-devs at haskell.org
Sun Sep 6 00:34:19 UTC 2015
#10845: Incorrect behavior when let binding implicit CallStack object
-------------------------------------+-------------------------------------
Reporter: nitromaster101 | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by nitromaster101):
There are two issues: since f3 doesn't produce any warnings, neither
should f since the only difference is the type of ?loc.
If I add some callers to f and f2:
{{{
{-# LANGUAGE ImplicitParams #-}
import GHC.Types
f :: (?loc :: CallStack) => String
f = let y = show $ map (srcLocStartLine . snd) $ getCallStack ?loc
in y
f2 :: (?loc :: CallStack) => String
f2 = show $ map (srcLocStartLine . snd) $ getCallStack ?loc
f_caller = f
f2_caller = f2
}}}
We get the warning:
{{{
[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) => String
}}}
And when we run them the call stack returned by f is wrong, it should have
two entries (the line number for f_caller and f):
{{{
*> f_caller
"[6]"
*> f2_caller
"[10,13]"
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10845#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list