summaryrefslogtreecommitdiff
path: root/testsuite/tests/tcplugins/TcPlugin_EmitWanted.hs
blob: 1b9af199027491346011ae0600eaa428c9968f0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# OPTIONS_GHC -dcore-lint #-}
{-# OPTIONS_GHC -fplugin EmitWantedPlugin #-}

module TcPlugin_EmitWanted where

import Definitions
  ( MyClass(methC) )

foo :: MyClass a => a
foo = methC

bar :: Bool
bar = foo
  -- We need to solve [W] MyClass a.
  -- The plugin emits [W] a ~# (), and solves [W] MyClass a
  -- using the coercion hole.
  -- We then report an error for the unsolved a ~# () constraint,
  -- where we get to see whether the source location of the newly
  -- emitted Wanted constraint is as expected.
  --
  -- The crucial thing is that the error message should have
  -- the correct SrcSpan, in this case line 13 column 7.