[commit: ghc] master: Fix #10489 (61b96a8)

git at git.haskell.org git at git.haskell.org
Fri Jun 5 15:09:19 UTC 2015


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

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

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

commit 61b96a86c5342fb1c850361177d60fe855d948f6
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Fri Jun 5 09:56:21 2015 -0400

    Fix #10489
    
    Dang, roles are annoying.
    
    Test case: typecheck/should_compile/T10489


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

61b96a86c5342fb1c850361177d60fe855d948f6
 compiler/hsSyn/HsUtils.hs                          | 3 ++-
 testsuite/tests/typecheck/should_compile/T10489.hs | 3 +++
 testsuite/tests/typecheck/should_compile/all.T     | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs
index f4737e7..fd3d5ef 100644
--- a/compiler/hsSyn/HsUtils.hs
+++ b/compiler/hsSyn/HsUtils.hs
@@ -504,9 +504,10 @@ mkHsWrapPat :: HsWrapper -> Pat id -> Type -> Pat id
 mkHsWrapPat co_fn p ty | isIdHsWrapper co_fn = p
                        | otherwise           = CoPat co_fn p ty
 
+-- input coercion is Nominal
 mkHsWrapPatCo :: TcCoercion -> Pat id -> Type -> Pat id
 mkHsWrapPatCo co pat ty | isTcReflCo co = pat
-                        | otherwise     = CoPat (mkWpCast co) pat ty
+                        | otherwise     = CoPat (mkWpCast (mkTcSubCo co)) pat ty
 
 mkHsDictLet :: TcEvBinds -> LHsExpr Id -> LHsExpr Id
 mkHsDictLet ev_binds expr = mkLHsWrap (mkWpLet ev_binds) expr
diff --git a/testsuite/tests/typecheck/should_compile/T10489.hs b/testsuite/tests/typecheck/should_compile/T10489.hs
new file mode 100644
index 0000000..892965e
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T10489.hs
@@ -0,0 +1,3 @@
+module T10489 where
+
+convert d = let d' = case d of '0' -> '!' in d'
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 12e2612..dbd6328 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -457,3 +457,4 @@ test('T10390', normal, compile, [''])
 test('T8555', normal, compile, [''])
 test('T8799', normal, compile, [''])
 test('T10423', normal, compile, [''])
+test('T10489', normal, compile, [''])



More information about the ghc-commits mailing list