Opened 16 years ago

Closed 6 years ago

#68 closed feature request (wontfix)

Warnings for unitialized fields

Reported by: nobody Owned by:
Priority: normal Milestone:
Component: Compiler Version: None
Keywords: warnings Cc: stefan@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonmar)

Would it be possible to add flag to disable warnings for unitialized fields just when using constructor with zero fields? I mean, if I use

  Foo {}

to construct empty record, it is a bit unpleasant that I get flooded by dozens of useless warnings; but I don't want to disable them -- they are useful when I forget to initialize some field(s).

Zdenek Dvorak

Attachments (1)

unitialized_waring.dpatch (95.5 KB) - added by ste 7 years ago.
A proposition for this feature request

Download all attachments as: .zip

Change History (11)

comment:1 Changed 12 years ago by simonmar

Component: NoneCompiler
Description: modified (diff)
Type: support requestfeature request

comment:2 Changed 11 years ago by igloo

Architecture: Unknown
difficulty: Easy (1 hr)
Keywords: warnings added
Milestone: _|_
Operating System: Unknown

comment:3 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:5 Changed 8 years ago by igloo

Owner: nobody deleted
Status: assignednew

comment:6 Changed 8 years ago by simonmar

difficulty: Easy (1 hr)Easy (less than 1 hour)

comment:7 Changed 8 years ago by simonmar

Description: modified (diff)
Type of failure: None/Unknown

Not clear if this is a good idea, but we'll leave it here anyway.

Changed 7 years ago by ste

Attachment: unitialized_waring.dpatch added

A proposition for this feature request

comment:8 Changed 7 years ago by ste

Cc: stefan@… added
Status: newinfoneeded

To get started with ghc hacking I created this patch. If this patch (or something similar) should be added to ghc, just tell me and I will add the necessary documentation and test cases. (This patch breaks test case ds041.hs due to a changed warning text.)

comment:9 Changed 7 years ago by simonpj

Thanks for contriubting a patch.

However, I'm not clear of the original intent here. Consider

data T = T { x,y::Int }
f = T { x = 3 }
g = T {}

It would be very odd to get a warning from f but not from g. I'm not sure this is what the original requester was asking. I thought he didn't want a warning when T had zero fields -- and indeed you don't get a warning then.

Puzzled.

Simon

comment:10 Changed 6 years ago by igloo

Resolution: Nonewontfix
Status: infoneededclosed

There doesn't seem to be a consensus that anything should be done, so I'm closing this ticket.

Note: See TracTickets for help on using tickets.