summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToJS
diff options
context:
space:
mode:
authordoyougnu <jeffrey.young@iohk.io>2022-05-12 12:09:49 -0400
committerdoyougnu <jeffrey.young@iohk.io>2022-06-13 13:42:41 -0400
commit8c14184f7d8da8b447c60e0ea4f3cbcc86e17c5e (patch)
tree6c835d67db2d74eb7eb848ef3e0aac06ab8ee86c /compiler/GHC/StgToJS
parent83ef82482eea4b146b45683a069cffee88c9ff13 (diff)
downloadhaskell-8c14184f7d8da8b447c60e0ea4f3cbcc86e17c5e.tar.gz
JS.Expr: Fix unhandled datacon for RuntimeRep
Diffstat (limited to 'compiler/GHC/StgToJS')
-rw-r--r--compiler/GHC/StgToJS/Expr.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/GHC/StgToJS/Expr.hs b/compiler/GHC/StgToJS/Expr.hs
index 470cf8e91e..4962859938 100644
--- a/compiler/GHC/StgToJS/Expr.hs
+++ b/compiler/GHC/StgToJS/Expr.hs
@@ -309,8 +309,14 @@ resultSize xxs@(_:xs) t
resultSize xs fr
| otherwise = [(LiftedRep, 1)] -- possibly newtype family, must be boxed
resultSize [] t
- | isRuntimeRepKindedTy t' = []
- | isRuntimeRepTy t' = []
+ -- FIXME: Jeff (2022,05): Is this check actually needed? If we have a runtime
+ -- rep kinded type can't we just call typePrimReps to get the PrimReps and
+ -- then primRep size just like in the catchall case? I don't see why this
+ -- doesn't work.
+ | isRuntimeRepKindedTy t' = pprPanic "resultSize: Type was RuntimeRepKinded don't know the size! " (ppr t')
+ -- Note that RuntimeRep from Builtins.Types hits this case. A singleton of
+ -- (LiftedRep, 1) is exactly what's returned by the otherwise case for
+ -- RuntimeRep.
| Nothing <- isLiftedType_maybe t' = [(LiftedRep, 1)]
| otherwise = fmap (\p -> (p, slotCount (primRepSize p))) (typePrimReps t)
where