Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11274 closed bug (fixed)

Confused type checker with typed holes and a missing instance (also panic)

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

Description

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:

{-# OPTIONS_GHC -fdefer-typed-holes #-}
data Asd = Asd

someHole = _asd

missingInstance :: Asd -> Asd -> Bool
missingInstance x y = x == y

Change History (3)

comment:1 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

In ed213ead/ghc:

Test Trac #11274

comment:2 Changed 4 years ago by simonpj

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

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

comment:3 Changed 4 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.