diff options
-rw-r--r-- | compiler/GHC/HsToCore/Expr.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T21516.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 |
3 files changed, 12 insertions, 3 deletions
diff --git a/compiler/GHC/HsToCore/Expr.hs b/compiler/GHC/HsToCore/Expr.hs index 565338d5a7..88dc4f7d45 100644 --- a/compiler/GHC/HsToCore/Expr.hs +++ b/compiler/GHC/HsToCore/Expr.hs @@ -196,9 +196,9 @@ dsUnliftedBind (FunBind { fun_id = L l fun -- Can't be a bang pattern (that looks like a PatBind) -- so must be simply unboxed = do { (args, rhs) <- matchWrapper (mkPrefixFunRhs (L l $ idName fun)) Nothing matches - ; massert (null args) -- Functions aren't lifted - ; massert (isIdHsWrapper co_fn) - ; let rhs' = mkOptTickBox tick rhs + ; massert (null args) -- Functions aren't unlifted + ; core_wrap <- dsHsWrapper co_fn -- Can be non-identity (#21516) + ; let rhs' = core_wrap (mkOptTickBox tick rhs) ; return (bindNonRec fun rhs' body) } dsUnliftedBind (PatBind {pat_lhs = pat, pat_rhs = grhss diff --git a/testsuite/tests/typecheck/should_compile/T21516.hs b/testsuite/tests/typecheck/should_compile/T21516.hs new file mode 100644 index 0000000000..d7d180cc5f --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T21516.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DataKinds, KindSignatures, ExplicitForAll #-} +module T where + +import GHC.Exts + +a = let x :: forall (a :: TYPE IntRep). a + x = error "" + in () diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index f110e273a8..1764ccb34b 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -824,3 +824,4 @@ test('T21023', normal, compile, ['-ddump-types']) test('T21205', normal, compile, ['-O0']) test('T21323', normal, compile, ['']) test('T21315', normal, compile, ['-Wredundant-constraints']) +test('T21516', normal, compile, ['']) |