[commit: ghc] master: testsuite: Add testcase for #13587 (907b0f3)

git at git.haskell.org git at git.haskell.org
Sun Apr 23 15:06:31 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/907b0f3da6f8fafaa39caba92a5611040f5de786/ghc

>---------------------------------------------------------------

commit 907b0f3da6f8fafaa39caba92a5611040f5de786
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sun Apr 23 10:04:03 2017 -0400

    testsuite: Add testcase for #13587
    
    Test Plan: Validate
    
    Reviewers: austin
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #13587
    
    Differential Revision: https://phabricator.haskell.org/D3474


>---------------------------------------------------------------

907b0f3da6f8fafaa39caba92a5611040f5de786
 testsuite/tests/th/T13587.hs  | 12 ++++++++++++
 testsuite/tests/th/T13587A.hs | 14 ++++++++++++++
 testsuite/tests/th/all.T      |  1 +
 3 files changed, 27 insertions(+)

diff --git a/testsuite/tests/th/T13587.hs b/testsuite/tests/th/T13587.hs
new file mode 100644
index 0000000..2986fd2
--- /dev/null
+++ b/testsuite/tests/th/T13587.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+import T13587A
+
+main :: IO ()
+main = do
+    let sin' = $$(importDoubleToDouble "sin")
+        cos' = $$(importDoubleToDouble "cos")
+    --
+    print (sin' 0)
+    print (cos' pi)
+
diff --git a/testsuite/tests/th/T13587A.hs b/testsuite/tests/th/T13587A.hs
new file mode 100644
index 0000000..b144cc2
--- /dev/null
+++ b/testsuite/tests/th/T13587A.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE QuasiQuotes     #-}
+
+module T13587A where
+
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+
+importDoubleToDouble :: String -> Q (TExp (Double -> Double))
+importDoubleToDouble fname = do
+    n <- newName fname
+    d <- forImpD CCall unsafe fname n [t|Double -> Double|]
+    addTopDecls [d]
+    unsafeTExpCoerce (varE n)
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index e4d4731..7c98d13 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -381,3 +381,4 @@ test('T13123', normal, compile, ['-v0'])
 test('T13098', normal, compile, ['-v0'])
 test('T11046', normal, multimod_compile, ['T11046','-v0'])
 test('T13366', normal, compile_and_run, ['-lstdc++ -v0'])
+test('T13587', expect_broken(13587), compile_and_run, ['-v0'])



More information about the ghc-commits mailing list