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

#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 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{ $ 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15367 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#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: | -------------------------------------+------------------------------------- Comment (by simonpj): Indeed. Perhaps you can enhance the message to say "Perhaps you intended to use UnboxedTuples` (or whatever our standard wording is for such suggestions)? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15367#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15367: Misleading error message when unboxed tuples used in sums without -XUnboxedTuples -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15073 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => duplicate * related: => #15073 Comment: This is an (indirect) duplicate of #15073, which has been fixed in GHC 8.6.1. In GHC 8.6.1, your program does indeed suggest enabling `UnboxedTuples`: {{{ $ /opt/ghc/8.6.1/bin/ghc Bug.hs [1 of 1] Compiling Lib ( Bug.hs, Bug.o ) Bug.hs:5:1: error: • Illegal unboxed tuple type as function argument: (# Int, Int #) Perhaps you intended to use UnboxedTuples • In the type synonym declaration for ‘Foo’ | 5 | type Foo = (# (# Int, Int #) | Int #) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15367#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC