Opened 15 years ago

Closed 5 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 6 years ago.
A proposition for this feature request

Download all attachments as: .zip

Change History (11)

comment:1 Changed 11 years ago by simonmar

  • Component changed from None to Compiler
  • Description modified (diff)
  • Type changed from support request to feature request

comment:2 Changed 10 years ago by igloo

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

comment:3 Changed 8 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:4 Changed 8 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:5 Changed 7 years ago by igloo

  • Owner nobody deleted
  • Status changed from assigned to new

comment:6 Changed 7 years ago by simonmar

  • difficulty changed from Easy (1 hr) to Easy (less than 1 hour)

comment:7 Changed 7 years ago by simonmar

  • Description modified (diff)
  • Type of failure set to None/Unknown

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

Changed 6 years ago by ste

A proposition for this feature request

comment:8 Changed 6 years ago by ste

  • Cc stefan@… added
  • Status changed from new to infoneeded

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 6 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.



comment:10 Changed 5 years ago by igloo

  • Resolution changed from None to wontfix
  • Status changed from infoneeded to closed

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.