diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-06-18 16:27:12 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-06-24 12:02:33 -0400 |
commit | 4023d4d96a9492eb686883539153b2be7d23e1c7 (patch) | |
tree | bfb9c456cf37e4ff4bc9b2d3c3bacde8e543999b | |
parent | 74c874148fbea996cadf1d9fa50f2a44488dd82b (diff) | |
download | haskell-4023d4d96a9492eb686883539153b2be7d23e1c7.tar.gz |
Fix desugaring with unboxed types (#19883)
-rw-r--r-- | compiler/GHC/HsToCore/Expr.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/deSugar/should_compile/T19883.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/deSugar/should_compile/all.T | 1 |
3 files changed, 21 insertions, 1 deletions
diff --git a/compiler/GHC/HsToCore/Expr.hs b/compiler/GHC/HsToCore/Expr.hs index b79f5862b9..b98f5c86f9 100644 --- a/compiler/GHC/HsToCore/Expr.hs +++ b/compiler/GHC/HsToCore/Expr.hs @@ -797,7 +797,9 @@ dsSyntaxExpr (SyntaxExprTc { syn_expr = expr ; core_res_wrap <- dsHsWrapper res_wrap ; let wrapped_args = zipWithEqual "dsSyntaxExpr" ($) core_arg_wraps arg_exprs ; dsWhenNoErrs (zipWithM_ dsNoLevPolyExpr wrapped_args [ mk_msg n | n <- [1..] ]) - (\_ -> core_res_wrap (mkApps fun wrapped_args)) } + (\_ -> core_res_wrap (mkCoreApps fun wrapped_args)) } + -- Use mkCoreApps instead of mkApps: + -- unboxed types are possible with RebindableSyntax (#19883) where mk_msg n = LevityCheckInSyntaxExpr (DsArgNum n) expr dsSyntaxExpr NoSyntaxExprTc _ = panic "dsSyntaxExpr" diff --git a/testsuite/tests/deSugar/should_compile/T19883.hs b/testsuite/tests/deSugar/should_compile/T19883.hs new file mode 100644 index 0000000000..80cfc9860c --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T19883.hs @@ -0,0 +1,17 @@ +{-# Language DataKinds #-} +{-# Language NoImplicitPrelude #-} +{-# Language RebindableSyntax #-} + +module T19883 where + +import GHC.Types +import qualified Prelude + +class Eq (a :: TYPE r) where + (==) :: a -> a -> Bool + +class Num (a :: TYPE r) where + fromInteger :: Prelude.Integer -> a + +roundDef :: forall (a :: TYPE IntRep) . (Eq a, Num a) => a -> () +roundDef 0 = () diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 6e6f486b4a..89583f4bb8 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -111,3 +111,4 @@ test('T13208', [], makefile_test, ['T13208']) test('T16615', normal, compile, ['-ddump-ds -dsuppress-uniques']) test('T18112', [grep_errmsg('cast')], compile, ['-ddump-ds']) test('T19969', normal, compile, ['-ddump-simpl -dsuppress-uniques']) +test('T19883', normal, compile, ['']) |