Commit 78e67391 authored by Ben Gamari's avatar Ben Gamari 🐢

desugar: Catch levity polymorphism in unboxed sum expressions

Fixes #13929.

(cherry picked from commit 018c40fb)
parent e545f545
......@@ -381,11 +381,11 @@ dsExpr (ExplicitTuple tup_args boxity)
mkCoreTupBoxity boxity args) }
dsExpr (ExplicitSum alt arity expr types)
= do { core_expr <- dsLExpr expr
; return $ mkCoreConApps (sumDataCon alt arity)
(map (Type . getRuntimeRep) types ++
map Type types ++
[core_expr]) }
= do { dsWhenNoErrs (dsLExprNoLP expr)
(\core_expr -> mkCoreConApps (sumDataCon alt arity)
(map (Type . getRuntimeRep) types ++
map Type types ++
[core_expr]) ) }
dsExpr (HsSCC _ cc expr@(L loc _)) = do
dflags <- getDynFlags
......
......@@ -10,3 +10,15 @@ T13929.hs:29:37: error:
Type: GUnboxed g rg
Kind: TYPE rg
In the type of expression: gunbox y
T13929.hs:33:24:
A levity-polymorphic type is not allowed here:
Type: GUnboxed f rf
Kind: TYPE rf
In the type of expression: gunbox l
T13929.hs:34:26:
A levity-polymorphic type is not allowed here:
Type: GUnboxed g rg
Kind: TYPE rg
In the type of expression: gunbox r
......@@ -437,5 +437,5 @@ test('T13677', normal, compile_fail, [''])
test('T11963', normal, compile_fail, [''])
test('T14000', normal, compile_fail, [''])
test('T11672', normal, compile_fail, [''])
test('T13929', expect_broken(13929), compile_fail, [''])
test('T13929', normal, compile_fail, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment