Opened 12 years ago

Closed 3 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 Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

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

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 years ago by simonmar

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

comment:2 Changed 8 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 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:4 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:5 Changed 5 years ago by igloo

  • Owner nobody deleted
  • Status changed from assigned to new

comment:6 Changed 5 years ago by simonmar

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

comment:7 Changed 5 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 3 years ago by ste

A proposition for this feature request

comment:8 Changed 3 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 3 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 3 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.