Opened 3 years ago

Closed 3 years ago

Last modified 3 months ago

#11462 closed bug (fixed)

Use of typechecker plugin erroneously triggers "unbound implicit parameter" error

Reported by: kwf Owned by: gridaphobe
Priority: highest Milestone: 8.0.1
Component: Compiler (Type checker) Version: 8.0.1-rc1
Keywords: TypeCheckerPlugins Cc: gridaphobe
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case: T11462
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1804
Wiki Page:


To document this bug, we're going to need a typechecker plugin to test it with. I've built a dummy plugin for this purpose, so we can be sure it is not interference from a particular plugin.


name:                dummy-plugin
category:            Development
build-type:          Simple
cabal-version:       >=1.10

  hs-source-dirs:      .
  exposed-modules:     DummyPlugin
  build-depends:       base, ghc
  default-language:    Haskell2010
  GHC-options:         -Wall -O2


module DummyPlugin(plugin) where

import TcRnMonad ( TcPlugin(..), TcPluginResult(..) )
import Plugins ( defaultPlugin, Plugin(..), CommandLineOption )

plugin :: Plugin
plugin = defaultPlugin { tcPlugin = Just . thePlugin }

thePlugin :: [CommandLineOption] -> TcPlugin
thePlugin opts = TcPlugin
  { tcPluginInit  = return ()
  , tcPluginSolve = \_ _ _ _ -> return $ TcPluginOk [] []
  , tcPluginStop  = \_ -> return ()


{-# OPTIONS_GHC -fplugin=DummyPlugin #-}

module Bug where

impossible :: a
impossible = undefined

First, compile the dummy plugin. From its directory, run cabal install to install the plugin.

Then, from the main directory, run ghc Bug.hs.

Expected result: the file compiles. Actual result:

Bug.hs:6:14: error:
    • Unbound implicit parameter ?callStack::GHC.Stack.Types.CallStack
        arising from a use of implicit parameter ‘?callStack’
    • In the expression: undefined
      In an equation for ‘impossible’: impossible = undefined

Further, observe that commenting out the line which invokes the type-checker plugin (the pragma on line 1) causes the file to compile correctly.

Change History (6)

comment:1 Changed 3 years ago by thomie

Cc: gridaphobe added
Priority: highhighest

Thank you for reducing the problem to this simple testcase.

This is a regression from ghc-7.10.3.

comment:2 Changed 3 years ago by gridaphobe

Owner: set to gridaphobe

comment:3 Changed 3 years ago by gridaphobe

Differential Rev(s): Phab:D1804
Status: newpatch
Test Case: T11462

comment:4 Changed 3 years ago by Ben Gamari <ben@…>

In 835a2a24/ghc:

Default non-canonical CallStack constraints

Test Plan: `make test TEST=T11462`

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Projects: #ghc

Differential Revision:

GHC Trac Issues: #11462

comment:5 Changed 3 years ago by bgamari

Resolution: fixed
Status: patchclosed

comment:6 Changed 3 months ago by adamgundry

Keywords: TypeCheckerPlugins added
Note: See TracTickets for help on using tickets.