Skip to content

Unnecessary warning for record wildcards

When compiling a file with record wildcards, -Wall produces a warning about shadowed bindings. Since the presence of a wildcard indicates that the shadowing was intentional, this warning seems unnecessary.

I reproduced this with both 6.8.3 and 6.10.0.20081007:

{-# LANGUAGE RecordWildCards #-}
module WildCard where

data Record = Record {field1 :: Int, field2 :: Double}

test :: Record
test = let
    field1 = 10
    field2 = 10.0
    in Record {..}
$ ghc --make -Wall WildCard.hs
[1 of 1] Compiling WildCard         ( WildCard.hs, WildCard.o )

WildCard.hs:8:4:
    Warning: This binding for `field1' shadows the existing binding
               defined at WildCard.hs:4:22
             In the binding group for: field1, field2

WildCard.hs:9:4:
    Warning: This binding for `field2' shadows the existing binding
               defined at WildCard.hs:4:37
             In the binding group for: field1, field2
Trac metadata
Trac field Value
Version 6.8.3
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