Possible unboxed tuples bug.

Bernard James POPE bjpop at cs.mu.OZ.AU
Sun Nov 30 01:10:41 EST 2003


Sean writes:
> Yesterday while I was mucking around in GHCi I discovered the following 
> anomaly. (The same holds for compiled code.)
> 
> I typed
> 
>  > :t (# 2, 3 #)
> 
> and got back
> 
> (# 2, 3 #) :: forall t t1. (Num t, Num t1) => (# t, t1 #)
> 
> But when I typed
> 
> :t (# 2, 3 #) :: (# Int, Int #)
> 
> I got the following
> 
> Illegal unboxed tuple type as function argument: (# Int, Int #)
>      In an expression type signature: (# Int, Int #)
>      In the type signature of the expression: (# 2, 3 #) :: (# Int, Int 
> #)
>      In the definition of `it': it = (# 2, 3 #) :: (# Int, Int #)
> Is this correct behaviour?

Hi,

This is __pure speculation__, but it looks like a possible bug 
in TcMType.checkValidType and friends.

The error message says that you can't have an unboxed tuple as an argument
to a function. However, this is not an argument.

In 
    check_tau_type rank ubx_tup ty@(TyConApp tc tys)

it has a test:

   ubx_tup_ok gla_exts = case ubx_tup of { UT_Ok -> gla_exts; other -> False }

which returns False when "ubx_tup" is not "UT_Ok". And this appears to
trigger the error message.

However, it looks like, it is "UT_NotOk", as passed down from checkValidType.

Of course I could be way off track. The logic in this piece of the compiler is
very tricky.

Cheers,
Bernie.


More information about the Glasgow-haskell-bugs mailing list