Skip to content
Snippets Groups Projects
Commit 48565ca8 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Tuples cannot contain unboxed types

This bug allowed, for example

  f = let x = ( 1#, 'x' ) in x

which is ill-typed because you can't put an unboxed value in a tuple.
Core Lint fails on this program.

The patch makes the program be rejcted up-front.
parent 8d573292
No related branches found
Tags ghc-darcs-git-switchover
No related merge requests found
......@@ -314,7 +314,9 @@ tcExpr in_expr@(ExplicitPArr _ exprs) res_ty -- maybe empty
-- The scrutinee should have a rigid type if x,y do
-- The general scheme is the same as in tcIdApp
tcExpr (ExplicitTuple exprs boxity) res_ty
= do { tvs <- newBoxyTyVars [argTypeKind | e <- exprs]
= do { let kind = case boxity of { Boxed -> liftedTypeKind
; Unboxed -> argTypeKind }
; tvs <- newBoxyTyVars [kind | e <- exprs]
; let tup_tc = tupleTyCon boxity (length exprs)
tup_res_ty = mkTyConApp tup_tc (mkTyVarTys tvs)
; checkWiredInTyCon tup_tc -- Ensure instances are available
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment