[GHC] #14228: PatternSynonyms Non-exhaustive with UnboxedSums
GHC
ghc-devs at haskell.org
Wed Sep 13 23:23:08 UTC 2017
#14228: PatternSynonyms Non-exhaustive with UnboxedSums
-------------------------------------+-------------------------------------
Reporter: guibou | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords: UnboxedSums,
| PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):
* keywords: UnboxedSum, PatternSynonyms => UnboxedSums, PatternSynonyms
Comment:
Wow! Great catch.
Indeed, the `ddump-simpl` output for that program looks mighty suspicious.
I'll post an abridged version below:
{{{#!hs
-- RHS size: {terms: 14, types: 20, coercions: 0, joins: 0/0}
$mJust'
:: forall (r :: TYPE rep) a.
Maybe' a -> (a -> r) -> (Void# -> r) -> r
$mJust'
= \ (@ (rep :: RuntimeRep))
(@ (r :: TYPE rep))
(@ a)
(scrut :: Maybe' a)
(cont :: a -> r)
_ ->
case scrut of {
(#_|#) x -> cont x;
(#|_#) ipv -> patError "Bug.hs:8:19-27|case"#
}
-- RHS size: {terms: 17, types: 21, coercions: 0, joins: 0/0}
$mNothing'
:: forall (r :: TYPE rep) a.
Maybe' a -> (Void# -> r) -> (Void# -> r) -> r
$mNothing'
= \ (@ (rep :: RuntimeRep))
(@ (r :: TYPE rep))
(@ a)
(scrut :: Maybe' a)
(cont :: Void# -> r)
_ ->
case scrut of {
(#_|#) ipv -> patError "Bug.hs:11:20-29|case"#;
(#|_#) ds -> case ds of { () -> cont void# }
}
}}}
Just //look// at that rubbish! The matchers for `Just'` and `Nothing'`
each take a failure continuation as an argument, but appear to ignore them
completely and just proceed directly to `patError` in case the expected
pattern wasn't matched.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14228#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list