[commit: ghc] master: Give raise# a return type of open kind (#10481) (ad089f5)

git at git.haskell.org git at git.haskell.org
Fri Jul 31 21:09:01 UTC 2015


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

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

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

commit ad089f58be522cb68c0306c21c5df9d72b6c0aff
Author: Reid Barton <rwbarton at gmail.com>
Date:   Fri Jul 31 17:09:45 2015 -0400

    Give raise# a return type of open kind (#10481)
    
    Test Plan: validate
    
    Reviewers: austin, bgamari, simonpj
    
    Reviewed By: simonpj
    
    Subscribers: simonpj, thomie
    
    Differential Revision: https://phabricator.haskell.org/D1116
    
    GHC Trac Issues: #10481


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

ad089f58be522cb68c0306c21c5df9d72b6c0aff
 compiler/prelude/primops.txt.pp                  | 3 ++-
 testsuite/.gitignore                             | 1 +
 testsuite/tests/primops/should_run/T10481.hs     | 9 +++++++++
 testsuite/tests/primops/should_run/T10481.stderr | 1 +
 testsuite/tests/primops/should_run/all.T         | 1 +
 5 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 9b107f2..6d45ed9 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -1960,7 +1960,8 @@ primop  CatchOp "catch#" GenPrimOp
    has_side_effects = True
 
 primop  RaiseOp "raise#" GenPrimOp
-   a -> b
+   b -> o
+      -- NB: the type variable "o" is "a", but with OpenKind
    with
    strictness  = { \ _arity -> mkClosedStrictSig [topDmd] botRes }
       -- NB: result is bottom
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 6ebb05a..c92ce71 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1221,6 +1221,7 @@ mk/ghcconfig*_bin_ghc-*.exe.mk
 /tests/polykinds/PolyKinds10
 /tests/primops/should_run/T6135
 /tests/primops/should_run/T7689
+/tests/primops/should_run/T10481
 /tests/profiling/should_compile/prof001
 /tests/profiling/should_compile/prof002
 /tests/profiling/should_run/2592
diff --git a/testsuite/tests/primops/should_run/T10481.hs b/testsuite/tests/primops/should_run/T10481.hs
new file mode 100644
index 0000000..bfdb356
--- /dev/null
+++ b/testsuite/tests/primops/should_run/T10481.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE MagicHash #-}
+
+import GHC.Exts
+import Control.Exception
+
+f :: ArithException -> Int#
+f x = raise# (toException x)
+
+main = print (I# (f Overflow))
diff --git a/testsuite/tests/primops/should_run/T10481.stderr b/testsuite/tests/primops/should_run/T10481.stderr
new file mode 100644
index 0000000..228377e
--- /dev/null
+++ b/testsuite/tests/primops/should_run/T10481.stderr
@@ -0,0 +1 @@
+T10481: arithmetic overflow
diff --git a/testsuite/tests/primops/should_run/all.T b/testsuite/tests/primops/should_run/all.T
index 12f9491..b21279a 100644
--- a/testsuite/tests/primops/should_run/all.T
+++ b/testsuite/tests/primops/should_run/all.T
@@ -2,3 +2,4 @@ test('T6135', normal, compile_and_run, [''])
 test('T7689', normal, compile_and_run, [''])
 # The test is using unboxed tuples, so omit ghci
 test('T9430', omit_ways(['ghci']), compile_and_run, [''])
+test('T10481', exit_code(1), compile_and_run, [''])



More information about the ghc-commits mailing list