[GHC] #7668: Location in -fdefer-type-errors

#7668: Location in -fdefer-type-errors -----------------------------+---------------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Consider {{{ x :: Char x = 'x' + 1 y :: Char y = 'y' + 1 }}} Run `ghci -fdefer-type-errors`: {{{ *Main> x *** Exception: G.hs:5:9: No instance for (Num Char) arising from a use of `+' In the expression: 'y' + 1 In an equation for `y': y = 'y' + 1 (deferred type error) *Main> y *** Exception: G.hs:5:9: No instance for (Num Char) arising from a use of `+' In the expression: 'y' + 1 In an equation for `y': y = 'y' + 1 (deferred type error) }}} The first exception is wrong. It seems that the missing `Num Char` instance is filled with the same error message in all places where the constraint should be supplied. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7668 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7668: Location in -fdefer-type-errors -----------------------------+---------------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by monoidal): Or even: {{{ x :: Char x = 'x' - 1 y :: Char y = 'y' + 1 }}} both messages say {{{No instance for (Num Char) arising from a use of `+'}}}. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7668#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7668: Location in -fdefer-type-errors ---------------------------------+------------------------------------------ Reporter: monoidal | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by simonpj): * difficulty: => Unknown Comment: Yes, that's a good point. It happens becuase the constraint solver "commons up" equal constraints. I suppose it could not do that when you have `-fdefer-type-errors`, but that would make the parts of the code that are perfectly ok have less sharing. I don't see an easy way to fix this. I'll just leave it open and see how pressing it seems in practice. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7668#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7668: Location in -fdefer-type-errors ----------------------------------------+----------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler (Type checker) | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------------+----------------------------------- Changes (by igloo): * component: Compiler => Compiler (Type checker) * milestone: => 7.8.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7668#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC