[commit: ghc] master: Add comments to TcCoercibleFail (a96c4e7)

git at git.haskell.org git at git.haskell.org
Mon Feb 8 15:07:34 UTC 2016


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

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

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

commit a96c4e7ca391ff3003d5debf187e7d177131f2fe
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Feb 4 13:00:22 2016 +0000

    Add comments to TcCoercibleFail
    
    Flag up the problem highlighted in Trac #11518 comment:15


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

a96c4e7ca391ff3003d5debf187e7d177131f2fe
 testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs     | 7 +++++++
 testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
index c102da5..833609d 100644
--- a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
+++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
@@ -20,9 +20,16 @@ foo4 = coerce $ one :: Down Int
 newtype Void = Void Void
 foo5 = coerce :: Void -> ()
 
+
+------------------------------------
+-- This next one generates an exponentally big type as it
+-- tries to unwrap.  See comment:15 in Trac #11518
+-- Adding asserions that force the types can make us
+-- run out of space.
 newtype VoidBad a = VoidBad (VoidBad (a,a))
 foo5' = coerce :: (VoidBad ()) -> ()
 
+------------------------------------
 -- This shoul fail with a context stack overflow
 newtype Fix f = Fix (f (Fix f))
 foo6 = coerce :: Fix (Either Int) -> Fix (Either Age)
diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
index 32dac6a..8c0df32 100644
--- a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
+++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
@@ -37,14 +37,14 @@ TcCoercibleFail.hs:21:8: error:
     • In the expression: coerce :: Void -> ()
       In an equation for ‘foo5’: foo5 = coerce :: Void -> ()
 
-TcCoercibleFail.hs:24:9: error:
+TcCoercibleFail.hs:30:9: error:
     • Couldn't match representation of type ‘VoidBad ()’
                                with that of ‘()’
         arising from a use of ‘coerce’
     • In the expression: coerce :: (VoidBad ()) -> ()
       In an equation for ‘foo5'’: foo5' = coerce :: (VoidBad ()) -> ()
 
-TcCoercibleFail.hs:28:8: error:
+TcCoercibleFail.hs:35:8: error:
     • Reduction stack overflow; size = 201
       When simplifying the following type:
         Coercible (Fix (Either Int)) (Fix (Either Age))
@@ -56,7 +56,7 @@ TcCoercibleFail.hs:28:8: error:
       In an equation for ‘foo6’:
           foo6 = coerce :: Fix (Either Int) -> Fix (Either Age)
 
-TcCoercibleFail.hs:29:8: error:
+TcCoercibleFail.hs:36:8: error:
     • Couldn't match representation of type ‘Either
                                                Int (Fix (Either Int))’
                                with that of ‘()’



More information about the ghc-commits mailing list