diff options
author | Aaron Allen <aaron@flipstone.com> | 2021-06-06 14:57:46 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-06-23 20:33:48 -0400 |
commit | 8191785ed7a28ed7a797990ce8851034162d68bd (patch) | |
tree | 3992e293a67d558760e8b7e440822922b7fb0d44 /testsuite/tests | |
parent | 633bbc1fd4762a2bb73ba1c5b9e0c279f1dd3c40 (diff) | |
download | haskell-8191785ed7a28ed7a797990ce8851034162d68bd.tar.gz |
Converts diagnostics for two errors in Ghc.Tc.Module (#19926)
This adds constructors to TcRnMessage to replace use of
TcRnUnknownMessage in Ghc.Tc.Module.
Adds a test case for the UnsafeDueToPlugin warning.
Closes #19926
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/plugins/Makefile | 5 | ||||
-rw-r--r-- | testsuite/tests/plugins/T19926.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/plugins/T19926.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/plugins/all.T | 6 | ||||
-rw-r--r-- | testsuite/tests/plugins/simple-plugin/Simple/DefaultPlugin.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/plugins/simple-plugin/simple-plugin.cabal | 1 |
6 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile index 46ef8cb3eb..2ae8aadae2 100644 --- a/testsuite/tests/plugins/Makefile +++ b/testsuite/tests/plugins/Makefile @@ -131,6 +131,11 @@ T16260: "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 T16260.hs -package-db simple-plugin/pkg.T16260/local.package.conf -fplugin Simple.TrustworthyPlugin "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 T16260.hs -package-db simple-plugin/pkg.T16260/local.package.conf -fplugin Simple.TrustworthyPlugin -fplugin-trustworthy +.PHONY: T19926 +T19926: + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 T19926.hs -package-db simple-plugin/pkg.T19926/local.package.conf -fplugin Simple.DefaultPlugin + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 T19926.hs -package-db simple-plugin/pkg.T19926/local.package.conf -fplugin Simple.DefaultPlugin -fplugin-trustworthy + .PHONY: HoleFitPlugin HoleFitPlugin: "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 HoleFitPlugin.hs -package-db hole-fit-plugin/pkg.hole-fit-plugin/local.package.conf diff --git a/testsuite/tests/plugins/T19926.hs b/testsuite/tests/plugins/T19926.hs new file mode 100644 index 0000000000..059611be05 --- /dev/null +++ b/testsuite/tests/plugins/T19926.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE Haskell2010 #-} +{-# LANGUAGE Trustworthy #-} +{-# OPTIONS_GHC -Wunsafe #-} +module T19926 where +-- Trustworthy module compiled with plugin should warn if -fplugin-trustworthy is not set diff --git a/testsuite/tests/plugins/T19926.stderr b/testsuite/tests/plugins/T19926.stderr new file mode 100644 index 0000000000..e943a7ffba --- /dev/null +++ b/testsuite/tests/plugins/T19926.stderr @@ -0,0 +1,5 @@ + +T19926.hs:3:17: warning: [-Wunsafe] + ‘T19926’ has been inferred as unsafe! + Reason: + <no location info>: warning: Use of plugins makes the module unsafe diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T index 12aba63022..7e8dbb52ef 100644 --- a/testsuite/tests/plugins/all.T +++ b/testsuite/tests/plugins/all.T @@ -208,6 +208,12 @@ test('T16260', ], makefile_test, []) +test('T19926', + [extra_files(['simple-plugin/']), + pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.T19926 TOP={top}') + ], + makefile_test, []) + test('test-hole-plugin', [extra_files(['hole-fit-plugin/']), pre_cmd('$MAKE -s --no-print-directory -C hole-fit-plugin package.hole-fit-plugin TOP={top}'), diff --git a/testsuite/tests/plugins/simple-plugin/Simple/DefaultPlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/DefaultPlugin.hs new file mode 100644 index 0000000000..6edf122376 --- /dev/null +++ b/testsuite/tests/plugins/simple-plugin/Simple/DefaultPlugin.hs @@ -0,0 +1,5 @@ +module Simple.DefaultPlugin (plugin) where +import GHC.Driver.Plugins (Plugin, defaultPlugin) + +plugin :: Plugin +plugin = defaultPlugin diff --git a/testsuite/tests/plugins/simple-plugin/simple-plugin.cabal b/testsuite/tests/plugins/simple-plugin/simple-plugin.cabal index e6f367100c..af68c5ca3b 100644 --- a/testsuite/tests/plugins/simple-plugin/simple-plugin.cabal +++ b/testsuite/tests/plugins/simple-plugin/simple-plugin.cabal @@ -21,3 +21,4 @@ Library Simple.SourcePlugin Simple.RemovePlugin Simple.TrustworthyPlugin + Simple.DefaultPlugin |