diff options
Diffstat (limited to 'testsuite/tests/tcplugins/TcPlugin_EmitWanted.hs')
-rw-r--r-- | testsuite/tests/tcplugins/TcPlugin_EmitWanted.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/tcplugins/TcPlugin_EmitWanted.hs b/testsuite/tests/tcplugins/TcPlugin_EmitWanted.hs new file mode 100644 index 0000000000..1b9af19902 --- /dev/null +++ b/testsuite/tests/tcplugins/TcPlugin_EmitWanted.hs @@ -0,0 +1,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. |