diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/th/T17804.hs | 26 | ||||
-rw-r--r-- | testsuite/tests/th/T17804.stderr | 10 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 1 |
3 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/th/T17804.hs b/testsuite/tests/th/T17804.hs new file mode 100644 index 0000000000..152812a728 --- /dev/null +++ b/testsuite/tests/th/T17804.hs @@ -0,0 +1,26 @@ +{-# OPTIONS_GHC -Wimplicit-lift #-} +{-# LANGUAGE TemplateHaskell #-} +module T17804 where + +import Language.Haskell.TH.Syntax + +warning1 :: Lift t => t -> Q Exp +warning1 x = [| x |] + +warning2 :: Lift t => t -> Code Q t +warning2 x = [|| x ||] + +noWarning1 :: Q Exp +noWarning1 = [| \x -> x |] + +noWarning2 :: Code Q (a -> a) +noWarning2 = [|| \x -> x ||] + +i :: Int +i = 0 + +noWarning3 :: Q Exp +noWarning3 = [| i |] + +noWarning4 :: Code Q Int +noWarning4 = [|| i ||] diff --git a/testsuite/tests/th/T17804.stderr b/testsuite/tests/th/T17804.stderr new file mode 100644 index 0000000000..6a18945635 --- /dev/null +++ b/testsuite/tests/th/T17804.stderr @@ -0,0 +1,10 @@ + +T17804.hs:8:17: warning: [-Wimplicit-lift] + • The variable ‘x’ is implicitly lifted in the TH quotation + • In the Template Haskell quotation [| x |] + +T17804.hs:11:18: warning: [-Wimplicit-lift] + • The variable ‘x’ is implicitly lifted in the TH quotation + • In the Template Haskell quotation [|| x ||] + In the expression: [|| x ||] + In an equation for ‘warning2’: warning2 x = [|| x ||] diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 235c0148f7..fbc8428503 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -520,3 +520,4 @@ test('T18740c', normal, compile_fail, ['']) test('T18740d', normal, compile_fail, ['']) test('T19363', normal, compile_and_run, ['']) test('T19377', normal, compile, ['']) +test('T17804', normal, compile, ['']) |