diff options
author | Mario Blažević <blamario@protonmail.com> | 2021-03-07 12:01:56 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-21 02:47:25 -0400 |
commit | 10124b16538091806953d732e24ca485a0664895 (patch) | |
tree | 179bba83b2daccb63cad2b8d6288209b614ec77d /testsuite/tests | |
parent | 5b157eb2bea7fc4ad654c83258cf1ab6ad0f85f0 (diff) | |
download | haskell-10124b16538091806953d732e24ca485a0664895.tar.gz |
template-haskell: Add support for default declarations
Fixes #19373
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/th/T19373.hs | 15 | ||||
-rw-r--r-- | testsuite/tests/th/T19373.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/th/T19373.hs b/testsuite/tests/th/T19373.hs new file mode 100644 index 0000000000..0e29f71544 --- /dev/null +++ b/testsuite/tests/th/T19373.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main where + +import Data.Monoid (Sum) +import Language.Haskell.TH + +dec :: DecsQ +dec = [d| default (Int, Double) + |] + +$([d| default (Integer, Sum Integer) + |]) + +main = runQ dec >>= putStrLn . pprint + >> print (4 <> 8) diff --git a/testsuite/tests/th/T19373.stdout b/testsuite/tests/th/T19373.stdout new file mode 100644 index 0000000000..4dbafb7ef2 --- /dev/null +++ b/testsuite/tests/th/T19373.stdout @@ -0,0 +1,2 @@ +default (GHC.Types.Int, GHC.Types.Double) +Sum {getSum = 12} diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 90ca816cd8..a19ad09ec9 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -524,6 +524,7 @@ test('T18612', normal, compile, ['']) test('T18740c', normal, compile_fail, ['']) test('T18740d', normal, compile_fail, ['']) test('T19363', normal, compile_and_run, ['']) +test('T19373', normal, compile_and_run, ['']) test('T19377', normal, compile, ['']) test('T17804', normal, compile, ['']) test('T19470', only_ways(['ghci']), ghci_script, ['T19470.script']) |