[GHC] #15367: Misleading error message when unboxed tuples used in sums without -XUnboxedTuples

GHC ghc-devs at haskell.org
Thu Jul 12 11:35:25 UTC 2018


#15367: Misleading error message when unboxed tuples used in sums without
-XUnboxedTuples
-------------------------------------+-------------------------------------
        Reporter:  osa1              |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by osa1:

Old description:

> {{{
> $ cat lib.hs
> {-# LANGUAGE UnboxedSums #-}
>
> module Lib where
>
> type Foo = (# (# Int, Int #) | Int #)
>
> $ ghc lib.hs
> [1 of 1] Compiling Lib              ( lib.hs, lib.o )
>
> lib.hs:5:1: error:
>     • Illegal unboxed tuple type as function argument: (# Int, Int #)
>     • In the type synonym declaration for ‘Foo’
>   |
> 5 | type Foo = (# (# Int, Int #) | Int #)
>   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }}}
>
> But there's nothing illegal about this type, we just need to enable
> `UnboxedTuples`. The error message is misleading.

New description:

 {{{
 $ cat lib.hs
 {-# LANGUAGE UnboxedSums #-}

 module Lib where

 type Foo = (# (# Int, Int #) | Int #)

 $ ghc lib.hs
 [1 of 1] Compiling Lib              ( lib.hs, lib.o )

 lib.hs:5:1: error:
     • Illegal unboxed tuple type as function argument: (# Int, Int #)
     • In the type synonym declaration for ‘Foo’
   |
 5 | type Foo = (# (# Int, Int #) | Int #)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 }}}

 But there's nothing illegal about this type, we just need to enable
 `UnboxedTuples`. The error message is misleading.

 (We should also check using unboxed sums inside tuples)

--

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15367#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list