[GHC] #8853: Alarming looking warning about non-exhaustive pattern

#8853: Alarming looking warning about non-exhaustive pattern -------------------------+------------------------------------------------- Reporter: | Owner: MikolajKonarski | Status: new Type: bug | Milestone: Priority: | Version: 7.8.1-rc2 normal | Operating System: Linux Component: | Type of failure: Incorrect warning at Compiler | compile-time Keywords: | Test Case: Architecture: | Blocking: x86_64 (amd64) | Difficulty: | Unknown | Blocked By: | Related Tickets: | -------------------------+------------------------------------------------- The attached code produces this alarming warning: ~/waste$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.8.0.20140228 ~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp [1 of 1] Compiling Main ( AlarmingPattern.hs, AlarmingPattern.o ) AlarmingPattern.hs:6:7: Warning: Pattern match(es) are non-exhaustive In an equation for ‘takeFromInv’: Patterns not matched: (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#] Linking AlarmingPattern ... ~/waste$ ./AlarmingPattern AlarmingPattern: AlarmingPattern.hs:(6,7)-(7,26): Non-exhaustive patterns in function takeFromInv -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8853: Alarming looking warning about non-exhaustive pattern -------------------------------------------------+------------------------- Reporter: MikolajKonarski | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | 7.8.1-rc2 Operating System: Linux | Keywords: Type of failure: Incorrect warning at | Architecture: compile-time | x86_64 (amd64) Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by nomeata): Is the bug about the compiler message, or the behaviour at run-time (which looks correct to me)? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8853: Alarming looking warning about non-exhaustive pattern -------------------------------------------------+------------------------- Reporter: MikolajKonarski | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | 7.8.1-rc2 Operating System: Linux | Keywords: Type of failure: Incorrect warning at | Architecture: compile-time | x86_64 (amd64) Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by MikolajKonarski): Runtime is OK. Probably the message is OK, too (I gave up trying to understand it, though:), just alarming. BTW, sorry for the bad formatting. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8853: Alarming looking warning about non-exhaustive pattern -------------------------------------------------+------------------------- Reporter: MikolajKonarski | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | 7.8.1-rc2 Operating System: Linux | Keywords: Type of failure: Incorrect warning at | Architecture: compile-time | x86_64 (amd64) Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Description changed by ezyang: Old description:
The attached code produces this alarming warning:
~/waste$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.8.0.20140228 ~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp [1 of 1] Compiling Main ( AlarmingPattern.hs, AlarmingPattern.o )
AlarmingPattern.hs:6:7: Warning: Pattern match(es) are non-exhaustive In an equation for ‘takeFromInv’: Patterns not matched: (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#] Linking AlarmingPattern ... ~/waste$ ./AlarmingPattern AlarmingPattern: AlarmingPattern.hs:(6,7)-(7,26): Non-exhaustive patterns in function takeFromInv
New description: The attached code produces this alarming warning: {{{ ~/waste$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.8.0.20140228 ~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp [1 of 1] Compiling Main ( AlarmingPattern.hs, AlarmingPattern.o ) AlarmingPattern.hs:6:7: Warning: Pattern match(es) are non-exhaustive In an equation for ‘takeFromInv’: Patterns not matched: (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#] Linking AlarmingPattern ... ~/waste$ ./AlarmingPattern AlarmingPattern: AlarmingPattern.hs:(6,7)-(7,26): Non-exhaustive patterns in function takeFromInv }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8853: Alarming looking warning about non-exhaustive pattern -------------------------------------------------+------------------------- Reporter: MikolajKonarski | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | 7.8.1-rc2 Operating System: Linux | Keywords: Type of failure: Incorrect warning at | Architecture: compile-time | x86_64 (amd64) Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by ezyang): To be clear, the error message is alarming because it refers to unboxed integers, but the source code does not. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8853: Surprising mention of unboxed integers in pattern exhaustiveness warning -------------------------------------------------+------------------------- Reporter: MikolajKonarski | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | 7.8.1-rc2 Operating System: Linux | Keywords: Type of failure: Incorrect warning at | Architecture: compile-time | x86_64 (amd64) Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by nomeata):
To be clear, the error message is alarming because it refers to unboxed integers, but the source code does not.
Ok, that was my guess as well, adjusting ticket title (unfortunately, I can’t change the ticket body to remove the distracting runtime output). I agree that the compiler would ideally not talk about unboxed integers if the code is not. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8853: Surprising mention of unboxed integers in pattern exhaustiveness warning -------------------------------------+------------------------------------- Reporter: | Owner: MikolajKonarski | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.1-rc2 Component: Compiler | Keywords: Resolution: | Architecture: x86_64 (amd64) Operating System: Linux | Difficulty: Unknown Type of failure: Incorrect | Blocked By: warning at compile-time | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Old description:
The attached code produces this alarming warning:
{{{ ~/waste$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.8.0.20140228 ~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp [1 of 1] Compiling Main ( AlarmingPattern.hs, AlarmingPattern.o )
AlarmingPattern.hs:6:7: Warning: Pattern match(es) are non-exhaustive In an equation for ‘takeFromInv’: Patterns not matched: (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#] Linking AlarmingPattern ... ~/waste$ ./AlarmingPattern AlarmingPattern: AlarmingPattern.hs:(6,7)-(7,26): Non-exhaustive patterns in function takeFromInv }}}
New description: The attached code produces this alarming warning: {{{ ~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp [1 of 1] Compiling Main ( AlarmingPattern.hs, AlarmingPattern.o ) AlarmingPattern.hs:6:7: Warning: Pattern match(es) are non-exhaustive In an equation for ‘takeFromInv’: Patterns not matched: (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#] Linking AlarmingPattern ... }}} The error message is alarming because it refers to unboxed integers, but the source code does not. -- Comment (by thomie): Reproducable with version 7.9.20140802. This ticket is listed on [wiki:Status/SLPJ-Tickets]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8853: Surprising mention of unboxed integers in pattern exhaustiveness warning -------------------------------------+------------------------------------- Reporter: MikolajKonarski | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.1-rc2 Resolution: duplicate | Keywords: | PatternMatchWarnings Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => PatternMatchWarnings -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8853#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC