record wildcards: field not initialised reported as type error
I think that the following program should be accepted, with warnings about not initialized fields:
{-# LANGUAGE RecordWildCards #-}
data T = T { a, b :: Int }
t = T {..}
where
a = 1
-- b = 2
data S = S { x, y :: Int }
s = S { x = 1 }
but it produces
$ ghci bugrecord.hs
GHCi, version 7.0.4: 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 Main ( bugrecord.hs, interpreted )
bugrecord.hs:5:5:
Couldn't match expected type `Int' with actual type `T -> Int'
In the `b' field of a record
In the expression: T {..}
In an equation for `t':
t = T {..}
where
a = 1
Failed, modules loaded: none.
If we uncomment the definition of field b the program is accepted, with a correct warning about the undefined field y in the other record.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.4 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |