#5117: OverloadedStrings induces overlapping pattern matches
-------------------------------+--------------------------------------------
Reporter: sciolizer | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.0.2 | Keywords:
Testcase: | Blockedby:
Os: Linux | Blocking:
Architecture: x86_64 (amd64) | Failure: Incorrect warning at compile-time
-------------------------------+--------------------------------------------
The OverloadedStrings extension sometimes causes GHC to warn about
overlapping pattern matches, when there are not overlapping pattern
matches.
To reproduce, create the file BadWarning.hs:
{{{
{-# LANGUAGE OverloadedStrings #-}
module BadWarning where
data MyString = MyString String
func (MyString "a") = undefined
func (MyString "bb") = undefined
func _ = undefined
}}}
Load the program with `ghci -W BadWarning.hs`, and ghci outputs
{{{
GHCi, version 7.0.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling BadWarning ( BadWarning.hs, interpreted )
BadWarning.hs:6:1:
Warning: Pattern match(es) are overlapped
In an equation for `func': func (MyString "a") = ...
Ok, modules loaded: BadWarning.
*BadWarning>
}}}
The warning goes away if you remove the OverloadedStrings extension. The
warning also goes away if you change `(MyString "bb")` to `(MyString "b")`
or `(MyString "")`.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5117>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs