[GHC] #11274: Confused type checker with typed holes and a missing instance (also panic)

#11274: Confused type checker with typed holes and a missing instance (also panic) -------------------------------------+------------------------------------- Reporter: Xandaros | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If your file contains a typed hole and a case where an instance is missing, the type checker will not find the missing instance and only report the hole. If -fdefer-typed-holes is set, this results in a panic. (Using ghci, the panic occurs when any definition of the module is being evaluated) Minimal working example: {{{#!hs {-# OPTIONS_GHC -fdefer-typed-holes #-} data Asd = Asd someHole = _asd missingInstance :: Asd -> Asd -> Bool missingInstance x y = x == y }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11274 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11274: Confused type checker with typed holes and a missing instance (also panic)
-------------------------------------+-------------------------------------
Reporter: Xandaros | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#11274: Confused type checker with typed holes and a missing instance (also panic) -------------------------------------+------------------------------------- Reporter: Xandaros | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | typecheck/should_fail/T11274 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => typecheck/should_fail/T11274 * status: new => closed * resolution: => fixed Comment: This works in HEAD (and hence 8.0), but I've added a regression test. We rightly get {{{ T11274.hs:10:25: error: • No instance for (Eq Asd) arising from a use of ‘==’ • In the expression: x == y In an equation for ‘missingInstance’: missingInstance x y = x == y }}} I have not tested 7.10.3, but I assume you are right about it failing there. Honestly, even if we release 7.10.4 I doubt we'll fix this bug on that branch -- it's not a show-stopper, and it'd be fresh work to do so. So I'll close this as fixed. Thanks for reporting such a nice small case! Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11274#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC