Commit fd8f8c6a authored by Simon Marlow's avatar Simon Marlow
Browse files

FIX print020: conversion of case expressions of type 'Any' was wrong

All primitive types were getting PrimAlts, where actually case
expressions on 'Any' should get a PolyAlt.  The result was that seq on
Any compiled into a no-op, which caused :force to go into an infinite
loop.
parent c7addbef
...@@ -16,7 +16,7 @@ import CoreUtils ( rhsIsStatic, manifestArity, exprType, findDefault ) ...@@ -16,7 +16,7 @@ import CoreUtils ( rhsIsStatic, manifestArity, exprType, findDefault )
import StgSyn import StgSyn
import Type import Type
import TyCon ( isAlgTyCon ) import TyCon
import Id import Id
import Var ( Var, globalIdDetails, idType ) import Var ( Var, globalIdDetails, idType )
import TyCon ( isUnboxedTupleTyCon, isPrimTyCon, isFunTyCon, isHiBootTyCon ) import TyCon ( isUnboxedTupleTyCon, isPrimTyCon, isFunTyCon, isHiBootTyCon )
...@@ -410,10 +410,11 @@ coreToStgExpr (Let bind body) ...@@ -410,10 +410,11 @@ coreToStgExpr (Let bind body)
mkStgAltType scrut_ty alts mkStgAltType scrut_ty alts
= case splitTyConApp_maybe (repType scrut_ty) of = case splitTyConApp_maybe (repType scrut_ty) of
Just (tc,_) | isUnboxedTupleTyCon tc -> UbxTupAlt tc Just (tc,_) | isUnboxedTupleTyCon tc -> UbxTupAlt tc
| isPrimTyCon tc -> PrimAlt tc | isUnLiftedTyCon tc -> PrimAlt tc
| isHiBootTyCon tc -> look_for_better_tycon | isHiBootTyCon tc -> look_for_better_tycon
| isAlgTyCon tc -> AlgAlt tc | isAlgTyCon tc -> AlgAlt tc
| isFunTyCon tc -> PolyAlt | isFunTyCon tc -> PolyAlt
| isPrimTyCon tc -> PolyAlt -- for "Any"
| otherwise -> pprPanic "mkStgAlts" (ppr tc) | otherwise -> pprPanic "mkStgAlts" (ppr tc)
Nothing -> PolyAlt Nothing -> PolyAlt
......
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