diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-06-18 16:27:12 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-06-18 16:30:16 +0200 |
commit | 00438ea2e2c3cdf552081e093496626da4cf36b6 (patch) | |
tree | a77ac4392e91b32ceb7b385011a6c42d7c16dd36 | |
parent | a0622459f1d9a7068e81b8a707ffc63e153444f8 (diff) | |
download | haskell-wip/T19883.tar.gz |
Fix desugaring with unboxed types (#19883)wip/T19883
-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 6bf900da89..75566a03a6 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, ['']) |