Skip to content

Record pattern synonyms cause spurious name shadowing warnings

The example given in the documentation gives a warning when compiled with -Wall:

{-# LANGUAGE PatternSynonyms #-}
{-# OPTIONS_GHC -Wall #-}
module Test where

-- Test.hs:13:24: warning: [-Wname-shadowing]
--     This binding for ‘x’ shadows the existing binding
--       defined at Test.hs:13:15
-- 
-- Test.hs:13:27: warning: [-Wname-shadowing]
--     This binding for ‘y’ shadows the existing binding
--       defined at Test.hs:13:18
pattern Point :: Int -> Int -> (Int, Int)
pattern Point{x, y} = (x, y)

I don't see anything being shadowed here, so I don't think GHC should produce these warnings.

Also, the type signature for that example in the documentation is pattern Point :: (Int, Int), which doesn't compile. Should I file a separate bug for that?

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information